Class: Raas::OrderModel
- Defined in:
- lib/raas/models/order_model.rb
Overview
Represents the response from a get order call
Instance Attribute Summary collapse
-
#account_identifier ⇒ String
The account identifier.
-
#account_number ⇒ String
The account number.
-
#amount_charged ⇒ CurrencyBreakdownModel
The order’s amount information.
-
#campaign ⇒ String
An optional campaign identifier.
-
#created_at ⇒ DateTime
When the order was placed.
-
#customer_identifier ⇒ String
The customer identifier.
-
#denomination ⇒ CurrencyBreakdownModel
Information about the gift card amount.
-
#email_subject ⇒ String
The subject of the email.
-
#etid ⇒ String
The email template id.
-
#external_ref_id ⇒ String
An external reference id.
-
#margin_share ⇒ CurrencyBreakdownModel
Margin share information.
-
#message ⇒ String
A message included with the email.
-
#notes ⇒ String
Optional customer notes.
-
#recipient ⇒ NameEmailModel
The recipient data.
-
#reference_order_id ⇒ String
The reference order id.
-
#reward ⇒ RewardModel
Contains the reward credentials.
-
#reward_name ⇒ String
The reward name.
-
#send_email ⇒ Boolean
Indicates if an email was sent to the recipient.
-
#sender ⇒ NameEmailModel
The sender data.
-
#status ⇒ String
The order’s status.
-
#utid ⇒ String
The UTID.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
Methods inherited from BaseModel
Constructor Details
#initialize(reference_order_id = nil, customer_identifier = nil, account_identifier = nil, account_number = nil, amount_charged = nil, denomination = nil, utid = nil, reward_name = nil, send_email = nil, status = nil, created_at = nil, reward = nil, sender = nil, recipient = nil, etid = nil, campaign = nil, email_subject = nil, external_ref_id = nil, message = nil, notes = nil, margin_share = nil) ⇒ OrderModel
Returns a new instance of OrderModel.
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/raas/models/order_model.rb', line 119 def initialize(reference_order_id = nil, customer_identifier = nil, account_identifier = nil, account_number = nil, amount_charged = nil, denomination = nil, utid = nil, reward_name = nil, send_email = nil, status = nil, created_at = nil, reward = nil, sender = nil, recipient = nil, etid = nil, campaign = nil, email_subject = nil, external_ref_id = nil, = nil, notes = nil, margin_share = nil) @reference_order_id = reference_order_id @customer_identifier = customer_identifier @account_identifier = account_identifier @account_number = account_number @amount_charged = amount_charged @denomination = denomination @utid = utid @reward_name = reward_name @send_email = send_email @status = status @created_at = created_at @reward = reward @sender = sender @recipient = recipient @etid = etid @campaign = campaign @email_subject = email_subject @external_ref_id = external_ref_id @message = @notes = notes @margin_share = margin_share end |
Instance Attribute Details
#account_identifier ⇒ String
The account identifier
18 19 20 |
# File 'lib/raas/models/order_model.rb', line 18 def account_identifier @account_identifier end |
#account_number ⇒ String
The account number
22 23 24 |
# File 'lib/raas/models/order_model.rb', line 22 def account_number @account_number end |
#amount_charged ⇒ CurrencyBreakdownModel
The order’s amount information
26 27 28 |
# File 'lib/raas/models/order_model.rb', line 26 def amount_charged @amount_charged end |
#campaign ⇒ String
An optional campaign identifier
70 71 72 |
# File 'lib/raas/models/order_model.rb', line 70 def campaign @campaign end |
#created_at ⇒ DateTime
When the order was placed
50 51 52 |
# File 'lib/raas/models/order_model.rb', line 50 def created_at @created_at end |
#customer_identifier ⇒ String
The customer identifier
14 15 16 |
# File 'lib/raas/models/order_model.rb', line 14 def customer_identifier @customer_identifier end |
#denomination ⇒ CurrencyBreakdownModel
Information about the gift card amount
30 31 32 |
# File 'lib/raas/models/order_model.rb', line 30 def denomination @denomination end |
#email_subject ⇒ String
The subject of the email
74 75 76 |
# File 'lib/raas/models/order_model.rb', line 74 def email_subject @email_subject end |
#etid ⇒ String
The email template id
66 67 68 |
# File 'lib/raas/models/order_model.rb', line 66 def etid @etid end |
#external_ref_id ⇒ String
An external reference id
78 79 80 |
# File 'lib/raas/models/order_model.rb', line 78 def external_ref_id @external_ref_id end |
#margin_share ⇒ CurrencyBreakdownModel
Margin share information
90 91 92 |
# File 'lib/raas/models/order_model.rb', line 90 def margin_share @margin_share end |
#message ⇒ String
A message included with the email
82 83 84 |
# File 'lib/raas/models/order_model.rb', line 82 def @message end |
#notes ⇒ String
Optional customer notes
86 87 88 |
# File 'lib/raas/models/order_model.rb', line 86 def notes @notes end |
#recipient ⇒ NameEmailModel
The recipient data
62 63 64 |
# File 'lib/raas/models/order_model.rb', line 62 def recipient @recipient end |
#reference_order_id ⇒ String
The reference order id
10 11 12 |
# File 'lib/raas/models/order_model.rb', line 10 def reference_order_id @reference_order_id end |
#reward ⇒ RewardModel
Contains the reward credentials
54 55 56 |
# File 'lib/raas/models/order_model.rb', line 54 def reward @reward end |
#reward_name ⇒ String
The reward name
38 39 40 |
# File 'lib/raas/models/order_model.rb', line 38 def reward_name @reward_name end |
#send_email ⇒ Boolean
Indicates if an email was sent to the recipient
42 43 44 |
# File 'lib/raas/models/order_model.rb', line 42 def send_email @send_email end |
#sender ⇒ NameEmailModel
The sender data
58 59 60 |
# File 'lib/raas/models/order_model.rb', line 58 def sender @sender end |
#status ⇒ String
The order’s status
46 47 48 |
# File 'lib/raas/models/order_model.rb', line 46 def status @status end |
#utid ⇒ String
The UTID
34 35 36 |
# File 'lib/raas/models/order_model.rb', line 34 def utid @utid end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/raas/models/order_model.rb', line 164 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. reference_order_id = hash['referenceOrderID'] customer_identifier = hash['customerIdentifier'] account_identifier = hash['accountIdentifier'] account_number = hash['accountNumber'] if hash['amountCharged'] amount_charged = CurrencyBreakdownModel.from_hash(hash['amountCharged']) end denomination = CurrencyBreakdownModel.from_hash(hash['denomination']) if hash['denomination'] utid = hash['utid'] reward_name = hash['rewardName'] send_email = hash['sendEmail'] status = hash['status'] created_at = APIHelper.rfc3339(hash['createdAt']) if hash['createdAt'] reward = RewardModel.from_hash(hash['reward']) if hash['reward'] sender = NameEmailModel.from_hash(hash['sender']) if hash['sender'] recipient = NameEmailModel.from_hash(hash['recipient']) if hash['recipient'] etid = hash['etid'] campaign = hash['campaign'] email_subject = hash['emailSubject'] external_ref_id = hash['externalRefID'] = hash['message'] notes = hash['notes'] margin_share = CurrencyBreakdownModel.from_hash(hash['marginShare']) if hash['marginShare'] # Create object from extracted values. OrderModel.new(reference_order_id, customer_identifier, account_identifier, account_number, amount_charged, denomination, utid, reward_name, send_email, status, created_at, reward, sender, recipient, etid, campaign, email_subject, external_ref_id, , notes, margin_share) end |
.names ⇒ Object
A mapping from model property names to API property names.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/raas/models/order_model.rb', line 93 def self.names @_hash = {} if @_hash.nil? @_hash['reference_order_id'] = 'referenceOrderID' @_hash['customer_identifier'] = 'customerIdentifier' @_hash['account_identifier'] = 'accountIdentifier' @_hash['account_number'] = 'accountNumber' @_hash['amount_charged'] = 'amountCharged' @_hash['denomination'] = 'denomination' @_hash['utid'] = 'utid' @_hash['reward_name'] = 'rewardName' @_hash['send_email'] = 'sendEmail' @_hash['status'] = 'status' @_hash['created_at'] = 'createdAt' @_hash['reward'] = 'reward' @_hash['sender'] = 'sender' @_hash['recipient'] = 'recipient' @_hash['etid'] = 'etid' @_hash['campaign'] = 'campaign' @_hash['email_subject'] = 'emailSubject' @_hash['external_ref_id'] = 'externalRefID' @_hash['message'] = 'message' @_hash['notes'] = 'notes' @_hash['margin_share'] = 'marginShare' @_hash end |