Class: SpreeOxygenPelatologio::Client
- Inherits:
-
Object
- Object
- SpreeOxygenPelatologio::Client
- Includes:
- Spree::IntegrationsConcern
- Defined in:
- app/lib/spree_oxygen_pelatologio/client.rb
Defined Under Namespace
Classes: ApiError, ConfigurationError
Constant Summary collapse
- SERVICE_ENDPOINTS =
{ sandbox: 'https://sandbox.api.oxygen.gr/v1/', production: 'https://api.oxygen.gr/v1/' }.freeze
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #call(action, **kwargs, &block) ⇒ Object
-
#initialize ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
12 13 14 15 16 17 |
# File 'app/lib/spree_oxygen_pelatologio/client.rb', line 12 def initialize @integration = store_integration('oxygen_pelatologio') raise 'Integration not found' unless @integration validate! end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
10 11 12 |
# File 'app/lib/spree_oxygen_pelatologio/client.rb', line 10 def client @client end |
Instance Method Details
#call(action, **kwargs, &block) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'app/lib/spree_oxygen_pelatologio/client.rb', line 19 def call(action, **kwargs, &block) case action when :pull_products pull_products(**kwargs, &block) else raise ArgumentError, "Unknown action: #{action}" end end |