Class: Tango::Api::Client
- Inherits:
-
Object
- Object
- Tango::Api::Client
- Defined in:
- lib/tango/api/client.rb,
lib/tango/api/client/version.rb
Overview
Public client to interact with Tango API resources via Faraday.
Constant Summary collapse
- VERSION =
"0.1.2"
Instance Method Summary collapse
- #accounts ⇒ Object
- #brand_categories ⇒ Object
- #catalogs ⇒ Object
- #choice_products ⇒ Object
- #customers ⇒ Object
- #exchange_rates ⇒ Object
- #funds ⇒ Object
-
#initialize(config = Tango::Api.configuration) ⇒ Client
constructor
A new instance of Client.
- #orders ⇒ Object
- #status ⇒ Object
Constructor Details
#initialize(config = Tango::Api.configuration) ⇒ Client
Returns a new instance of Client.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/tango/api/client.rb', line 28 def initialize(config = Tango::Api.configuration) @config = case config when String cfg = Tango::Api.configuration.dup cfg.base_url = config cfg when Hash cfg = Tango::Api.configuration.dup config.each do |key, value| writer = "#{key}=" cfg.public_send(writer, value) if cfg.respond_to?(writer) end cfg else config end raise ArgumentError, "Tango::Api.configuration.base_url is required" if @config.base_url.to_s.strip.empty? @conn = build_connection end |
Instance Method Details
#accounts ⇒ Object
54 55 56 |
# File 'lib/tango/api/client.rb', line 54 def accounts Resources::Accounts.new(@conn) end |
#brand_categories ⇒ Object
82 83 84 |
# File 'lib/tango/api/client.rb', line 82 def brand_categories Resources::BrandCategories.new(@conn) end |
#catalogs ⇒ Object
50 51 52 |
# File 'lib/tango/api/client.rb', line 50 def catalogs Resources::Catalogs.new(@conn) end |
#choice_products ⇒ Object
78 79 80 |
# File 'lib/tango/api/client.rb', line 78 def choice_products Resources::ChoiceProducts.new(@conn) end |
#customers ⇒ Object
66 67 68 |
# File 'lib/tango/api/client.rb', line 66 def customers Resources::Customers.new(@conn) end |
#exchange_rates ⇒ Object
74 75 76 |
# File 'lib/tango/api/client.rb', line 74 def exchange_rates Resources::ExchangeRates.new(@conn) end |
#funds ⇒ Object
62 63 64 |
# File 'lib/tango/api/client.rb', line 62 def funds Resources::Funds.new(@conn) end |