Class: Eventbrite::Api::Client
- Inherits:
-
Object
- Object
- Eventbrite::Api::Client
- Includes:
- Helpers
- Defined in:
- lib/eventbrite/api/client.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #connection ⇒ Object
- #get_access_code_url(params = {}) ⇒ Object
- #get_access_token(access_code) ⇒ Object
- #headers ⇒ Object
-
#initialize(options) ⇒ Client
constructor
A new instance of Client.
Methods included from Helpers
Constructor Details
#initialize(options) ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/eventbrite/api/client.rb', line 11 def initialize() model :User model :Venue model :Organizer model :Order model :Event model :Category model :Format model :EventTicketClass model :UserContact model :UserContactList model :UserOrder model :UserVenue model :UserOrganizer model :OwnedEvent model :OwnedEventAttendee model :OwnedEventOrder @redirect_uri = [:redirect_uri] @consumer = [:consumer] @access_token = [:access_token] @client = OAuth2::Client.new(@consumer[:key], @consumer[:secret], { :site => 'https://www.eventbrite.com', :authorize_url => '/oauth/authorize', :token_url => '/oauth/token', }) end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
9 10 11 |
# File 'lib/eventbrite/api/client.rb', line 9 def access_token @access_token end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
9 10 11 |
# File 'lib/eventbrite/api/client.rb', line 9 def client @client end |
Instance Method Details
#connection ⇒ Object
57 58 59 |
# File 'lib/eventbrite/api/client.rb', line 57 def connection @auth_connection ||= OAuth2::AccessToken.new(@client, @access_token) end |
#get_access_code_url(params = {}) ⇒ Object
40 41 42 |
# File 'lib/eventbrite/api/client.rb', line 40 def get_access_code_url(params = {}) @client.auth_code.(params.merge(redirect_uri: @redirect_uri)) end |
#get_access_token(access_code) ⇒ Object
44 45 46 47 48 |
# File 'lib/eventbrite/api/client.rb', line 44 def get_access_token(access_code) @token = @client.auth_code.get_token(access_code, redirect_uri: @redirect_uri) @access_token = @token.token @token end |
#headers ⇒ Object
50 51 52 53 54 55 |
# File 'lib/eventbrite/api/client.rb', line 50 def headers { 'Accept' => 'application/json', 'Content-Type' => 'application/json' } end |