GithubHelp home page GithubHelp logo

dmitchell / google-ads-ruby Goto Github PK

View Code? Open in Web Editor NEW

This project forked from googleads/google-ads-ruby

0.0 1.0 0.0 598 KB

Google Ads API Ruby Client Library

Home Page: https://developers.google.com/google-ads/api/

License: Apache License 2.0

Ruby 100.00%

google-ads-ruby's Introduction

Google Ads Client Library for Ruby

google-ads-googleads uses Google API extensions to provide an easy-to-use client library for the Google Ads API.

Documentation for Users

Getting started

google-ads-googleads will allow you to connect to the Google Ads API and access all its methods.

In order to achieve so you need to set up authentication as well as install the library locally.

Installation

Install this library using gem:

$ [sudo] gem install google-ads-googleads

Alternatively, if you prefer not to or can't use the hosted gem on RubyGems, you can download the gem from the Releases page and install it from the local file:

$ [sudo] gem install google-ads-googleads-[version].gem

Or you can build it yourself from the source. After cloning the GitHub repo, navigate to the google-ads-ruby folder and run:

$ rake build
$ gem install pkg/google-ads-googleads-[version].gem

Set Up Authentication

To authenticate your API calls, you need to specify your client ID, client secret, refresh token, and developer token to the library in one of a few ways.

If you don't have a client ID or client secret yet, please see the Authorization guide to get those set up. Once you have those, the Ruby library can help you use those to generate a refresh token.

See and run the Authentication example to generate your refresh token. Once this is generated, you can provide it to the library in a few different ways.

The simplest is to copy the adwords_config.rb to your home directory and simply modify it to include the client ID, client secret, and refresh token. The library will automatically read it from the home directory if instantiated with no arguments:

adwords = Google::Ads::GoogleAds::GoogleAdsClient.new

Alternatively, if you prefer to keep the file elsewhere, you can instantiate the library by passing the path to where you keep this file:

adwords = Google::Ads::GoogleAds::GoogleAdsClient.new('path/to/file.rb')

If you prefer not to store this information in a file at all, and would rather pass the information programmatically at runtime, you can accomplish that this way:

adwords = Google::Ads::GoogleAds::GoogleAdsClient.new do |config|
  config.client_id = 'INSERT_CLIENT_ID_HERE'
  config.client_secret = 'INSERT_CLIENT_SECRET_HERE'
  config.refresh_token = 'INSERT_REFRESH_TOKEN_HERE'
  config.developer_token = 'INSERT_DEVELOPER_TOKEN_HERE'
end

You can also modify these properties after instantiation by using the configure method on the AdwordsClient, using the same structure as above.

Usage

To include the gem in your code:

require 'google/ads/google_ads'

To fetch a specific service, for example CampaignService:

adwords = Google::Ads::GoogleAds::GoogleAdsClient.new
campaign_service = adwords.service(:Campaign)

See the provided examples for more detailed demonstrations of how to use the library.

Logging

See the instructions in google_ads_config.rb for complete setup.

Logging is set up via the Config object, accessed via client.config or specified in your default config loaded when instantiating a GoogleAdsClient.

You can also specify your own logger by setting client.logger.

Authors

Author:

  • Danial Klimkin
  • Michael Cloonan

Maintainer:

  • Michael Cloonan

google-ads-ruby's People

Contributors

coryliseno avatar donovanfm avatar javoeria avatar mcloonan avatar scotttesler avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.