Class: Raas::OrderModel

Inherits:
BaseModel show all
Defined in:
lib/raas/models/order_model.rb

Overview

Represents the response from a get order call

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

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,
                = nil,
                = 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)
  @reference_order_id = reference_order_id
  @customer_identifier = customer_identifier
  @account_identifier = 
  @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 = message
  @notes = notes
  @margin_share = margin_share
end

Instance Attribute Details

#account_identifierString

The account identifier

Returns:



18
19
20
# File 'lib/raas/models/order_model.rb', line 18

def 
  @account_identifier
end

#account_numberString

The account number

Returns:



22
23
24
# File 'lib/raas/models/order_model.rb', line 22

def 
  @account_number
end

#amount_chargedCurrencyBreakdownModel

The order’s amount information



26
27
28
# File 'lib/raas/models/order_model.rb', line 26

def amount_charged
  @amount_charged
end

#campaignString

An optional campaign identifier

Returns:



70
71
72
# File 'lib/raas/models/order_model.rb', line 70

def campaign
  @campaign
end

#created_atDateTime

When the order was placed

Returns:

  • (DateTime)


50
51
52
# File 'lib/raas/models/order_model.rb', line 50

def created_at
  @created_at
end

#customer_identifierString

The customer identifier

Returns:



14
15
16
# File 'lib/raas/models/order_model.rb', line 14

def customer_identifier
  @customer_identifier
end

#denominationCurrencyBreakdownModel

Information about the gift card amount



30
31
32
# File 'lib/raas/models/order_model.rb', line 30

def denomination
  @denomination
end

#email_subjectString

The subject of the email

Returns:



74
75
76
# File 'lib/raas/models/order_model.rb', line 74

def email_subject
  @email_subject
end

#etidString

The email template id

Returns:



66
67
68
# File 'lib/raas/models/order_model.rb', line 66

def etid
  @etid
end

#external_ref_idString

An external reference id

Returns:



78
79
80
# File 'lib/raas/models/order_model.rb', line 78

def external_ref_id
  @external_ref_id
end

#margin_shareCurrencyBreakdownModel

Margin share information



90
91
92
# File 'lib/raas/models/order_model.rb', line 90

def margin_share
  @margin_share
end

#messageString

A message included with the email

Returns:



82
83
84
# File 'lib/raas/models/order_model.rb', line 82

def message
  @message
end

#notesString

Optional customer notes

Returns:



86
87
88
# File 'lib/raas/models/order_model.rb', line 86

def notes
  @notes
end

#recipientNameEmailModel

The recipient data

Returns:



62
63
64
# File 'lib/raas/models/order_model.rb', line 62

def recipient
  @recipient
end

#reference_order_idString

The reference order id

Returns:



10
11
12
# File 'lib/raas/models/order_model.rb', line 10

def reference_order_id
  @reference_order_id
end

#rewardRewardModel

Contains the reward credentials

Returns:



54
55
56
# File 'lib/raas/models/order_model.rb', line 54

def reward
  @reward
end

#reward_nameString

The reward name

Returns:



38
39
40
# File 'lib/raas/models/order_model.rb', line 38

def reward_name
  @reward_name
end

#send_emailBoolean

Indicates if an email was sent to the recipient

Returns:

  • (Boolean)


42
43
44
# File 'lib/raas/models/order_model.rb', line 42

def send_email
  @send_email
end

#senderNameEmailModel

The sender data

Returns:



58
59
60
# File 'lib/raas/models/order_model.rb', line 58

def sender
  @sender
end

#statusString

The order’s status

Returns:



46
47
48
# File 'lib/raas/models/order_model.rb', line 46

def status
  @status
end

#utidString

The UTID

Returns:



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']
   = hash['accountIdentifier']
   = 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']
  message = 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,
                 ,
                 ,
                 amount_charged,
                 denomination,
                 utid,
                 reward_name,
                 send_email,
                 status,
                 created_at,
                 reward,
                 sender,
                 recipient,
                 etid,
                 campaign,
                 email_subject,
                 external_ref_id,
                 message,
                 notes,
                 margin_share)
end

.namesObject

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