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 collapse

Attributes included from Configuration

#api_root_endpoint, #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_client_access_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

Constructor Details

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

Initializes a new GogoKit::Client

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

  • :oauth_token_endpoint (String)

    Endpoint for obtaining

Yields:

  • (_self)

Yield Parameters:

Raises:

  • (GogoKit::Error::ConfigurationError)

    Error is raised when supplied



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

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

  validate_credential_type!
  validate_configuration!
end

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



46
47
48
# File 'lib/gogokit/client.rb', line 46

def access_token
  @access_token
end

#client_idObject

Returns the value of attribute client_id.



46
47
48
# File 'lib/gogokit/client.rb', line 46

def client_id
  @client_id
end

#client_secretObject

Returns the value of attribute client_secret.



46
47
48
# File 'lib/gogokit/client.rb', line 46

def client_secret
  @client_secret
end

Instance Method Details

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

Perform an HTTP DELETE request

Returns:

  • (Hash)

    object containing response information



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

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

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

Perform an HTTP GET request

Returns:

  • (Hash)

    object containing response information



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

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

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

Perform an HTTP HEAD request

Returns:

  • (Hash)

    object containing response information



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

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

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

Perform an HTTP PATCH request

Returns:

  • (Hash)

    object containing response information



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

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

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

Perform an HTTP POST request

Returns:

  • (Hash)

    object containing response information



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

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

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

Perform an HTTP PUT request

Returns:

  • (Hash)

    object containing response information



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

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

#user_agentString

The User-Agent header used when making HTTP requests

Returns:

  • (String)


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

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