Sha256: 63b241803a5ce024b212fee3a24dc275377d298d1218f8cd5b4fb8b54451ed27

Contents?: true

Size: 1.78 KB

Versions: 14

Compression:

Stored size: 1.78 KB

Contents

= citygrid

Not stable yet. Use at your own risk!

== Getting Started

=== Installation

This gem is still under very active development. As such, you can obtain the latest by directly installing from github:

   gem "citygrid_api", :git => "git://github.com/CityGrid/citygrid_api.git"

You can get a relatively stable build from rubygems.org. Specifying a version number is highly recommended as there will be breaking changes until we stabilize. 

   gem "citygrid_api", "0.0.6" 

=== Configuration

Add a file called citygrid_api.rb under config/initializers. 

Configure the gem to use your publisher code with:

   CityGrid.publisher = 'your_publisher_code'
   
If you don't have a publisher code, you can obtain one at http://developer.citygridmedia.com

Move citygrid_api.yml.sample into your project. This file configures the API endpoints. Load the configuration with:

   CityGrid.load_config 'path/to/config/yml'

== Sessions

Most methods require an AuthToken. This is obtained by either using the CityGrid::Session class (preferred) or CityGrid::API::Accounts::Account.login, which would require managing your own AuthToken.

An authenticated session can be obtained with

   session = CityGrid.session 'username', 'password'
   
Once authenticated, the session will automatically pass along the AuthToken to API methods that require it when you use the call_api method

  session.call_api CityGrid::API::Advertising::Category,
    :search,
    :keywords => "pizza"
    
This corresponds to

  auth_token = 'my_auth_token' # obtained by calling CityGrid::API::Accounts::Account.login
  CityGrid::API::Advertising::Category.search :token => auth_token, :keywords => "pizza"

In the future, AuthTokens may be invalidated and there may be other methods to log in. Session and call_api will handle that for you.

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
citygrid_api-0.0.21 README.rdoc
citygrid_api-0.0.20 README.rdoc
citygrid_api-0.0.19 README.rdoc
citygrid_api-0.0.18 README.rdoc
citygrid_api-0.0.17 README.rdoc
citygrid_api-0.0.16 README.rdoc
citygrid_api-0.0.15 README.rdoc
citygrid_api-0.0.14 README.rdoc
citygrid_api-0.0.13 README.rdoc
citygrid_api-0.0.12 README.rdoc
citygrid_api-0.0.11 README.rdoc
citygrid_api-0.0.10 README.rdoc
citygrid_api-0.0.9 README.rdoc
citygrid_api-0.0.7 README.rdoc