Class: Pinterest::Client
- Inherits:
-
Object
- Object
- Pinterest::Client
- Defined in:
- lib/pinterest/client.rb
Instance Method Summary collapse
-
#access_token=(token) ⇒ Object
Update the stored access token (e.g. after a refresh).
- #audiences ⇒ Resources::Audiences
- #customer_list_uploads ⇒ Resources::CustomerListUploads
- #customer_lists ⇒ Resources::CustomerLists
-
#initialize(client_id: nil, client_secret: nil, access_token: nil, redirect_uri: nil, default_scope: nil, **options) ⇒ Client
constructor
A new instance of Client.
- #oauth ⇒ Resources::OAuth
Constructor Details
#initialize(client_id: nil, client_secret: nil, access_token: nil, redirect_uri: nil, default_scope: nil, **options) ⇒ Client
Returns a new instance of Client.
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/pinterest/client.rb', line 14 def initialize(client_id: nil, client_secret: nil, access_token: nil, redirect_uri: nil, default_scope: nil, **) @config = Configuration.new @config.client_id = client_id || Pinterest.configuration.client_id @config.client_secret = client_secret || Pinterest.configuration.client_secret @config.access_token = access_token || Pinterest.configuration.access_token @config.redirect_uri = redirect_uri || Pinterest.configuration.redirect_uri @config.default_scope = default_scope || Pinterest.configuration.default_scope .each do |key, value| @config.public_send(:"#{key}=", value) if @config.respond_to?(:"#{key}=") end end |
Instance Method Details
#access_token=(token) ⇒ Object
Update the stored access token (e.g. after a refresh).
49 50 51 52 |
# File 'lib/pinterest/client.rb', line 49 def access_token=(token) @config.access_token = token @oauth = nil # reset memoized resource so it picks up the new token end |
#audiences ⇒ Resources::Audiences
34 35 36 |
# File 'lib/pinterest/client.rb', line 34 def audiences @audiences ||= Resources::Audiences.new(@config) end |
#customer_list_uploads ⇒ Resources::CustomerListUploads
44 45 46 |
# File 'lib/pinterest/client.rb', line 44 def customer_list_uploads @customer_list_uploads ||= Resources::CustomerListUploads.new(@config) end |
#customer_lists ⇒ Resources::CustomerLists
39 40 41 |
# File 'lib/pinterest/client.rb', line 39 def customer_lists @customer_lists ||= Resources::CustomerLists.new(@config) end |
#oauth ⇒ Resources::OAuth
29 30 31 |
# File 'lib/pinterest/client.rb', line 29 def oauth @oauth ||= Resources::OAuth.new(@config) end |