Class: AboutYou::SDK::Model::InitiateOrder
- Inherits:
-
Object
- Object
- AboutYou::SDK::Model::InitiateOrder
- Defined in:
- lib/AboutYou/Model/initiate_order.rb
Overview
This class represents an initiate order model
Instance Attribute Summary collapse
-
#app_token ⇒ Object
Returns the value of attribute app_token.
-
#error_code ⇒ Object
Returns the value of attribute error_code.
-
#error_message ⇒ Object
Returns the value of attribute error_message.
-
#url ⇒ Object
Returns the value of attribute url.
-
#user_token ⇒ Object
Returns the value of attribute user_token.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(url, user_token, app_token) ⇒ InitiateOrder
constructor
A new instance of InitiateOrder.
- #parse_error_result(json_object) ⇒ Object
Constructor Details
#initialize(url, user_token, app_token) ⇒ InitiateOrder
Returns a new instance of InitiateOrder.
21 22 23 24 25 26 27 |
# File 'lib/AboutYou/Model/initiate_order.rb', line 21 def initialize(url, user_token, app_token) self.url = url self.user_token = user_token self.app_token = app_token self end |
Instance Attribute Details
#app_token ⇒ Object
Returns the value of attribute app_token.
12 13 14 |
# File 'lib/AboutYou/Model/initiate_order.rb', line 12 def app_token @app_token end |
#error_code ⇒ Object
Returns the value of attribute error_code.
13 14 15 |
# File 'lib/AboutYou/Model/initiate_order.rb', line 13 def error_code @error_code end |
#error_message ⇒ Object
Returns the value of attribute error_message.
14 15 16 |
# File 'lib/AboutYou/Model/initiate_order.rb', line 14 def end |
#url ⇒ Object
Returns the value of attribute url.
10 11 12 |
# File 'lib/AboutYou/Model/initiate_order.rb', line 10 def url @url end |
#user_token ⇒ Object
Returns the value of attribute user_token.
11 12 13 |
# File 'lib/AboutYou/Model/initiate_order.rb', line 11 def user_token @user_token end |
Class Method Details
.create_from_json(json_object) ⇒ Object
Returns static.
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/AboutYou/Model/initiate_order.rb', line 34 def self.create_from_json(json_object) order = new( json_object['url'], json_object['user_token'], json_object['app_token'] ) order.parse_error_result(json_object) order end |
Instance Method Details
#parse_error_result(json_object) ⇒ Object
46 47 48 49 |
# File 'lib/AboutYou/Model/initiate_order.rb', line 46 def parse_error_result(json_object) self.error_code = json_object.key?('error_code') ? json_object['error_code'] : 0 self. = json_object.key?('error_message') ? json_object['error_message'] : nil end |