Class: Ruby::Pennylane::Client
- Inherits:
-
Object
- Object
- Ruby::Pennylane::Client
- Includes:
- HTTParty
- Defined in:
- lib/ruby/pennylane.rb
Instance Attribute Summary collapse
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
-
#call(args) ⇒ Object
call(method: :get, element: customers, id: 3, filter: [“customer_id”, “operator”: “eq”, “value”: “4c02116c-1793-4e3d-becf-6870ef12d441”], body: { elem: { } }) method: :get by default.
-
#initialize(args = {}) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(args = {}) ⇒ Client
Returns a new instance of Client.
27 28 29 |
# File 'lib/ruby/pennylane.rb', line 27 def initialize(args = {}) @token ||= args.fetch(:token, Rails.configuration.pennylane_token) end |
Instance Attribute Details
#token ⇒ Object
Returns the value of attribute token.
25 26 27 |
# File 'lib/ruby/pennylane.rb', line 25 def token @token end |
Instance Method Details
#call(args) ⇒ Object
call(method: :get, element: customers, id: 3, filter: [“customer_id”, “operator”: “eq”, “value”: “4c02116c-1793-4e3d-becf-6870ef12d441”], body: { elem: { } }) method: :get by default
33 34 35 36 37 |
# File 'lib/ruby/pennylane.rb', line 33 def call(args) return {error: :missing_argument, status: :unprocessable_entity}.as_json unless args[:element] http_method(args) end |