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
app token of the order.
-
#error_code ⇒ Object
error code of the order.
-
#error_message ⇒ Object
error message of the order.
-
#url ⇒ Object
url of the order.
-
#user_token ⇒ Object
user token for the order.
Class Method Summary collapse
-
.create_from_json(json_object) ⇒ Object
This method is used for creating an instance of this class by a json_object.
Instance Method Summary collapse
-
#initialize(url, user_token, app_token) ⇒ InitiateOrder
constructor
Constructor for the AboutYou::SDK::Model::InitiateOrder class.
-
#parse_error_result(json_object) ⇒ Object
This method is used for parsing the error result.
Constructor Details
#initialize(url, user_token, app_token) ⇒ InitiateOrder
Constructor for the AboutYou::SDK::Model::InitiateOrder class
-
Args :
-
url-> url of the order -
user_token-> user token for the order -
app_token-> app token of the order
-
-
Returns :
-
an instance of AboutYou::SDK::Model::InitiateOrder
-
30 31 32 33 34 35 36 |
# File 'lib/AboutYou/Model/initiate_order.rb', line 30 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
app token of the order
13 14 15 |
# File 'lib/AboutYou/Model/initiate_order.rb', line 13 def app_token @app_token end |
#error_code ⇒ Object
error code of the order
15 16 17 |
# File 'lib/AboutYou/Model/initiate_order.rb', line 15 def error_code @error_code end |
#error_message ⇒ Object
error message of the order
17 18 19 |
# File 'lib/AboutYou/Model/initiate_order.rb', line 17 def end |
#url ⇒ Object
url of the order
9 10 11 |
# File 'lib/AboutYou/Model/initiate_order.rb', line 9 def url @url end |
#user_token ⇒ Object
user token for the order
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
This method is used for creating an instance of this class by a json_object.
-
Args :
-
json_object-> the json_object received from the api
-
-
Returns :
-
Instance of AboutYou::SDK::Model::InitateOrder
-
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/AboutYou/Model/initiate_order.rb', line 47 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
This method is used for parsing the error result
-
Args :
-
json_object-> the json_object received from the api
-
65 66 67 68 |
# File 'lib/AboutYou/Model/initiate_order.rb', line 65 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 |