Class: BaseApi::Client
- Inherits:
-
Object
- Object
- BaseApi::Client
- Includes:
- Authorizations, Categories, ItemCategories, Items, Orders, Users, Configurable, HTTParty
- Defined in:
- lib/base_api/client.rb,
lib/base_api/client/items.rb,
lib/base_api/client/users.rb,
lib/base_api/client/orders.rb,
lib/base_api/client/categories.rb,
lib/base_api/client/authorizations.rb,
lib/base_api/client/item_categories.rb
Overview
TODO: 責務でクラス分ける
Defined Under Namespace
Modules: Authorizations, Categories, ItemCategories, Items, Orders, Users
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
-
#code ⇒ Object
Returns the value of attribute code.
-
#offset ⇒ Object
Returns the value of attribute offset.
-
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
-
#response ⇒ Object
Returns the value of attribute response.
Attributes included from Configurable
Instance Method Summary collapse
- #fetch_next_page(&callback) ⇒ Object
-
#initialize(options = {}) {|_self| ... } ⇒ Client
constructor
A new instance of Client.
- #inspect ⇒ Object
- #reset_response ⇒ Object
Methods included from Orders
Methods included from ItemCategories
#item_categories_add, #item_categories_delete, #item_categories_detail
Methods included from Categories
#categories, #categories_add, #categories_delete, #categories_edit
Methods included from Items
#items, #items_add, #items_add_image, #items_delete, #items_delete_image, #items_delete_variation, #items_detail, #items_edit, #items_edit_stock, #items_search
Methods included from Users
Methods included from Authorizations
#oauth_access_token, #oauth_refresh_token
Methods included from Configurable
Constructor Details
#initialize(options = {}) {|_self| ... } ⇒ Client
Returns a new instance of Client.
28 29 30 31 32 33 34 35 |
# File 'lib/base_api/client.rb', line 28 def initialize( = {}) BaseApi::Configurable.keys.each do |key| value = .key?(key) ? [key] : BaseApi.instance_variable_get(:"@#{key}") instance_variable_set(:"@#{key}", value) end yield(self) if block_given? end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
25 26 27 |
# File 'lib/base_api/client.rb', line 25 def access_token @access_token end |
#client_id ⇒ Object
Returns the value of attribute client_id.
25 26 27 |
# File 'lib/base_api/client.rb', line 25 def client_id @client_id end |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
25 26 27 |
# File 'lib/base_api/client.rb', line 25 def client_secret @client_secret end |
#code ⇒ Object
Returns the value of attribute code.
25 26 27 |
# File 'lib/base_api/client.rb', line 25 def code @code end |
#offset ⇒ Object
Returns the value of attribute offset.
25 26 27 |
# File 'lib/base_api/client.rb', line 25 def offset @offset end |
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
25 26 27 |
# File 'lib/base_api/client.rb', line 25 def refresh_token @refresh_token end |
#response ⇒ Object
Returns the value of attribute response.
25 26 27 |
# File 'lib/base_api/client.rb', line 25 def response @response end |
Instance Method Details
#fetch_next_page(&callback) ⇒ Object
48 49 50 |
# File 'lib/base_api/client.rb', line 48 def fetch_next_page(&callback) paginate(@last_page_args[:path], next_page_payload, &callback) end |
#inspect ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/base_api/client.rb', line 37 def inspect inspected = super inspected.gsub! @code, '*******' if @code inspected.gsub! @access_token, "#{'*'*28}#{@access_token[28..-1]}" if @access_token inspected.gsub! @refresh_token, "#{'*'*28}#{@refresh_token[28..-1]}" if @refresh_token inspected.gsub! @client_secret, "#{'*'*28}#{@client_secret[28..-1]}" if @client_secret inspected end |
#reset_response ⇒ Object
52 53 54 55 |
# File 'lib/base_api/client.rb', line 52 def reset_response @response = nil @last_page_args = nil end |