Class: GogoKit::Client

Inherits:
Object
  • Object
show all
Includes:
Address, Category, Country, Currency, Event, Language, Listing, MetroArea, OAuth, PaymentMethod, Root, Search, SellerListing, User, Venue, Configuration, Connection
Defined in:
lib/gogokit/client.rb,
lib/gogokit/client/root.rb,
lib/gogokit/client/user.rb,
lib/gogokit/client/event.rb,
lib/gogokit/client/oauth.rb,
lib/gogokit/client/venue.rb,
lib/gogokit/client/search.rb,
lib/gogokit/client/address.rb,
lib/gogokit/client/country.rb,
lib/gogokit/client/listing.rb,
lib/gogokit/client/category.rb,
lib/gogokit/client/currency.rb,
lib/gogokit/client/language.rb,
lib/gogokit/client/metro_area.rb,
lib/gogokit/client/payment_method.rb,
lib/gogokit/client/seller_listing.rb

Overview

Client for the viagogo API

Defined Under Namespace

Modules: Address, Category, Country, Currency, Event, Language, Listing, MetroArea, OAuth, PaymentMethod, Root, Search, SellerListing, User, Venue

Instance Attribute Summary

Attributes included from Configuration

#access_token, #api_root_endpoint, #authorization_endpoint, #client_id, #client_secret, #oauth_token_endpoint

Instance Method Summary collapse

Methods included from Venue

#get_venue, #get_venues

Methods included from Utils

#object_from_response

Methods included from User

#get_user

Methods included from SellerListing

#create_seller_listing, #create_seller_listing_preview, #create_seller_listing_update_preview, #delete_seller_listing, #get_listing_constraints, #get_listing_constraints_for_event, #get_seller_listing, #get_seller_listings, #update_seller_listing

Methods included from Search

#search

Methods included from Root

#get_root

Methods included from PaymentMethod

#get_payment_methods

Methods included from OAuth

#get_access_token, #get_authorization_code_access_token, #get_authorization_url, #get_client_access_token, #get_refresh_token

Methods included from MetroArea

#get_metro_area, #get_metro_areas

Methods included from Listing

#get_listing, #get_listings_by_event

Methods included from Language

#get_language, #get_languages

Methods included from Event

#get_event, #get_events_by_category

Methods included from Currency

#get_currencies, #get_currency

Methods included from Country

#get_countries, #get_country

Methods included from Category

#get_category, #get_genres

Methods included from Address

#get_addresses

Methods included from Configuration

#api_environment, #api_environment=, #reset!

Constructor Details

#initialize(options = {}) {|_self| ... } ⇒ GogoKit::Client

Initializes a new GogoKit::Client

is located OAuth access tokens client credentials are not a String or Symbol.

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :client_id (String)

    Client Id of your application

  • :client_secret (String)

    Client Secret of your application

  • :api_root_endpoint (String)

    Endpoint where the API root

  • :oauth_token_endpoint (String)

    Endpoint for obtaining

Yields:

  • (_self)

Yield Parameters:

Raises:

  • (GogoKit::Error::ConfigurationError)

    Error is raised when supplied



58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/gogokit/client.rb', line 58

def initialize(options = {})
  reset!

  options.each do |key, value|
    send(:"#{key}=", value)
  end
  yield self if block_given?

  validate_configuration_credentials!
  validate_configuration_api_environment!
  validate_configuration_endpoints!
end

Instance Method Details

#delete(url, options = {}) ⇒ Hash

Perform an HTTP DELETE request

Returns:

  • (Hash)

    object containing response information



81
82
83
# File 'lib/gogokit/client.rb', line 81

def delete(url, options = {})
  request(:delete, url, options)
end

#get(url, options = {}) ⇒ Hash

Perform an HTTP GET request

Returns:

  • (Hash)

    object containing response information



88
89
90
# File 'lib/gogokit/client.rb', line 88

def get(url, options = {})
  request(:get, url, options)
end

#head(url, options = {}) ⇒ Hash

Perform an HTTP HEAD request

Returns:

  • (Hash)

    object containing response information



95
96
97
# File 'lib/gogokit/client.rb', line 95

def head(url, options = {})
  request(:head, url, options)
end

#patch(url, options = {}) ⇒ Hash

Perform an HTTP PATCH request

Returns:

  • (Hash)

    object containing response information



102
103
104
# File 'lib/gogokit/client.rb', line 102

def patch(url, options = {})
  request(:patch, url, options)
end

#post(url, options = {}) ⇒ Hash

Perform an HTTP POST request

Returns:

  • (Hash)

    object containing response information



109
110
111
# File 'lib/gogokit/client.rb', line 109

def post(url, options = {})
  request(:post, url, options)
end

#put(url, options = {}) ⇒ Hash

Perform an HTTP PUT request

Returns:

  • (Hash)

    object containing response information



116
117
118
# File 'lib/gogokit/client.rb', line 116

def put(url, options = {})
  request(:put, url, options)
end

#user_agentString

The User-Agent header used when making HTTP requests

Returns:

  • (String)


74
75
76
# File 'lib/gogokit/client.rb', line 74

def user_agent
  @user_agent ||= "GogoKit Ruby Gem #{GogoKit::VERSION}"
end