Class: Ruby::Pennylane::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/ruby/pennylane.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#tokenObject

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