Class: Raas::OrderModel
- Defined in:
- lib/raas/models/order_model.rb
Instance Attribute Summary collapse
-
#account_identifier ⇒ String
Account Identifier.
-
#amount_charged ⇒ CurrencyBreakdownModel
Amount Charged.
-
#campaign ⇒ String
Campaign.
-
#created_at ⇒ DateTime
Created At.
-
#customer_identifier ⇒ String
Customer Identifier.
-
#denomination ⇒ CurrencyBreakdownModel
Denomination.
-
#email_subject ⇒ String
Email Subject.
-
#external_ref_id ⇒ String
External Reference ID.
-
#message ⇒ String
Message.
-
#notes ⇒ String
Notes.
-
#recipient ⇒ NameEmailModel
Recipient.
-
#reference_order_id ⇒ String
Reference Order ID.
-
#reward ⇒ RewardModel
Reward.
-
#reward_name ⇒ String
Reward Name.
-
#send_email ⇒ Boolean
Send Email.
-
#sender ⇒ NameEmailModel
Sender.
-
#status ⇒ String
Status.
-
#utid ⇒ String
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
-
#initialize(account_identifier = nil, amount_charged = nil, created_at = nil, customer_identifier = nil, denomination = nil, reference_order_id = nil, reward = nil, reward_name = nil, send_email = nil, status = nil, utid = nil, campaign = nil, email_subject = nil, external_ref_id = nil, message = nil, notes = nil, recipient = nil, sender = nil) ⇒ OrderModel
constructor
A new instance of OrderModel.
Methods inherited from BaseModel
Constructor Details
#initialize(account_identifier = nil, amount_charged = nil, created_at = nil, customer_identifier = nil, denomination = nil, reference_order_id = nil, reward = nil, reward_name = nil, send_email = nil, status = nil, utid = nil, campaign = nil, email_subject = nil, external_ref_id = nil, message = nil, notes = nil, recipient = nil, sender = nil) ⇒ OrderModel
Returns a new instance of OrderModel.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/raas/models/order_model.rb', line 104 def initialize(account_identifier = nil, amount_charged = nil, created_at = nil, customer_identifier = nil, denomination = nil, reference_order_id = nil, reward = nil, reward_name = nil, send_email = nil, status = nil, utid = nil, campaign = nil, email_subject = nil, external_ref_id = nil, = nil, notes = nil, recipient = nil, sender = nil) @account_identifier = account_identifier @amount_charged = amount_charged @created_at = created_at @customer_identifier = customer_identifier @denomination = denomination @reference_order_id = reference_order_id @reward = reward @reward_name = reward_name @send_email = send_email @status = status @utid = utid @campaign = campaign @email_subject = email_subject @external_ref_id = external_ref_id @message = @notes = notes @recipient = recipient @sender = sender end |
Instance Attribute Details
#account_identifier ⇒ String
Account Identifier
8 9 10 |
# File 'lib/raas/models/order_model.rb', line 8 def account_identifier @account_identifier end |
#amount_charged ⇒ CurrencyBreakdownModel
Amount Charged
12 13 14 |
# File 'lib/raas/models/order_model.rb', line 12 def amount_charged @amount_charged end |
#campaign ⇒ String
Campaign
52 53 54 |
# File 'lib/raas/models/order_model.rb', line 52 def campaign @campaign end |
#created_at ⇒ DateTime
Created At
16 17 18 |
# File 'lib/raas/models/order_model.rb', line 16 def created_at @created_at end |
#customer_identifier ⇒ String
Customer Identifier
20 21 22 |
# File 'lib/raas/models/order_model.rb', line 20 def customer_identifier @customer_identifier end |
#denomination ⇒ CurrencyBreakdownModel
Denomination
24 25 26 |
# File 'lib/raas/models/order_model.rb', line 24 def denomination @denomination end |
#email_subject ⇒ String
Email Subject
56 57 58 |
# File 'lib/raas/models/order_model.rb', line 56 def email_subject @email_subject end |
#external_ref_id ⇒ String
External Reference ID
60 61 62 |
# File 'lib/raas/models/order_model.rb', line 60 def external_ref_id @external_ref_id end |
#message ⇒ String
Message
64 65 66 |
# File 'lib/raas/models/order_model.rb', line 64 def @message end |
#notes ⇒ String
Notes
68 69 70 |
# File 'lib/raas/models/order_model.rb', line 68 def notes @notes end |
#recipient ⇒ NameEmailModel
Recipient
72 73 74 |
# File 'lib/raas/models/order_model.rb', line 72 def recipient @recipient end |
#reference_order_id ⇒ String
Reference Order ID
28 29 30 |
# File 'lib/raas/models/order_model.rb', line 28 def reference_order_id @reference_order_id end |
#reward ⇒ RewardModel
Reward
32 33 34 |
# File 'lib/raas/models/order_model.rb', line 32 def reward @reward end |
#reward_name ⇒ String
Reward Name
36 37 38 |
# File 'lib/raas/models/order_model.rb', line 36 def reward_name @reward_name end |
#send_email ⇒ Boolean
Send Email
40 41 42 |
# File 'lib/raas/models/order_model.rb', line 40 def send_email @send_email end |
#sender ⇒ NameEmailModel
Sender
76 77 78 |
# File 'lib/raas/models/order_model.rb', line 76 def sender @sender end |
#status ⇒ String
Status
44 45 46 |
# File 'lib/raas/models/order_model.rb', line 44 def status @status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'lib/raas/models/order_model.rb', line 143 def self.from_hash(hash) return nil unless hash # Extract variables from the hash account_identifier = hash['accountIdentifier'] amount_charged = CurrencyBreakdownModel.from_hash(hash['amountCharged']) if hash['amountCharged'] created_at = DateTime.rfc3339(hash['createdAt']) if hash['createdAt'] customer_identifier = hash['customerIdentifier'] denomination = CurrencyBreakdownModel.from_hash(hash['denomination']) if hash['denomination'] reference_order_id = hash['referenceOrderID'] reward = RewardModel.from_hash(hash['reward']) if hash['reward'] reward_name = hash['rewardName'] send_email = hash['sendEmail'] status = hash['status'] utid = hash['utid'] campaign = hash['campaign'] email_subject = hash['emailSubject'] external_ref_id = hash['externalRefID'] = hash['message'] notes = hash['notes'] recipient = NameEmailModel.from_hash(hash['recipient']) if hash['recipient'] sender = NameEmailModel.from_hash(hash['sender']) if hash['sender'] # Create object from extracted values OrderModel.new(account_identifier, amount_charged, created_at, customer_identifier, denomination, reference_order_id, reward, reward_name, send_email, status, utid, campaign, email_subject, external_ref_id, , notes, recipient, sender) end |
.names ⇒ Object
A mapping from model property names to API property names
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/raas/models/order_model.rb', line 79 def self.names if @_hash.nil? @_hash = {} @_hash["account_identifier"] = "accountIdentifier" @_hash["amount_charged"] = "amountCharged" @_hash["created_at"] = "createdAt" @_hash["customer_identifier"] = "customerIdentifier" @_hash["denomination"] = "denomination" @_hash["reference_order_id"] = "referenceOrderID" @_hash["reward"] = "reward" @_hash["reward_name"] = "rewardName" @_hash["send_email"] = "sendEmail" @_hash["status"] = "status" @_hash["utid"] = "utid" @_hash["campaign"] = "campaign" @_hash["email_subject"] = "emailSubject" @_hash["external_ref_id"] = "externalRefID" @_hash["message"] = "message" @_hash["notes"] = "notes" @_hash["recipient"] = "recipient" @_hash["sender"] = "sender" end @_hash end |