Class: Workarea::Yotpo::Gateway
- Inherits:
-
Object
- Object
- Workarea::Yotpo::Gateway
- Includes:
- Authentication
- Defined in:
- lib/workarea/yotpo/gateway.rb
Defined Under Namespace
Classes: YotpoGatewayError
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #create_order(order_details) ⇒ Object
-
#initialize(options = {}) ⇒ Gateway
constructor
A new instance of Gateway.
Methods included from Authentication
Constructor Details
#initialize(options = {}) ⇒ Gateway
Returns a new instance of Gateway.
9 10 11 12 |
# File 'lib/workarea/yotpo/gateway.rb', line 9 def initialize( = {}) requires!(, :app_key, :secret_key) @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/workarea/yotpo/gateway.rb', line 7 def @options end |
Instance Method Details
#create_order(order_details) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/workarea/yotpo/gateway.rb', line 14 def create_order(order_details) auth_creds = { utoken: token, app_key: client_id } body = order_details.merge(auth_creds).to_json response = connection.post do |req| req.url "apps/#{client_id}/purchases/" req.body = body end Response.new(response) end |