Class: Portage::Ucp::Etsy::Client
- Inherits:
-
Object
- Object
- Portage::Ucp::Etsy::Client
- Includes:
- Support::HttpClient
- Defined in:
- lib/portage/ucp/etsy/client.rb
Overview
Minimal REST client over Etsy's Open API v3
(api.etsy.com/v3/application).
Deliberately plain Net::HTTP, not an Etsy SDK (there isn't an official Ruby one) — trivially stubbable with WebMock.
Every call needs two credentials, not one: a Bearer access_token
from the shop owner's OAuth consent (see
Portage::Ucp::Etsy::AccessTokenFetcher) and the app's own
x-api-key (the OAuth client's keystring) on every single request —
Etsy checks both independently, unlike Shopify/Wix/WooCommerce/
Magento, where the bearer token alone is sufficient.
Constant Summary collapse
- BASE_URL =
"https://api.etsy.com/v3/application".freeze
Instance Method Summary collapse
- #get(path) ⇒ Object
-
#initialize(access_token:, api_key:) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(access_token:, api_key:) ⇒ Client
Returns a new instance of Client.
24 25 26 27 |
# File 'lib/portage/ucp/etsy/client.rb', line 24 def initialize(access_token:, api_key:) @access_token = access_token @api_key = api_key end |
Instance Method Details
#get(path) ⇒ Object
29 30 31 |
# File 'lib/portage/ucp/etsy/client.rb', line 29 def get(path) request(Net::HTTP::Get, path) end |