Class: Raas::OrderSummaryModel

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

Overview

Represents an Order Summary

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, margin_share = nil, utid = nil, reward_name = nil, sender = nil, recipient = nil, send_email = nil, status = nil, created_at = nil, etid = nil) ⇒ OrderSummaryModel

Returns a new instance of OrderSummaryModel.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/raas/models/order_summary_model.rb', line 84

def initialize(reference_order_id = nil,
               customer_identifier = nil,
                = nil,
                = nil,
               amount_charged = nil,
               margin_share = nil,
               utid = nil,
               reward_name = nil,
               sender = nil,
               recipient = nil,
               send_email = nil,
               status = nil,
               created_at = nil,
               etid = nil)
  @reference_order_id = reference_order_id
  @customer_identifier = customer_identifier
  @account_identifier = 
  @account_number = 
  @amount_charged = amount_charged
  @margin_share = margin_share
  @utid = utid
  @reward_name = reward_name
  @sender = sender
  @recipient = recipient
  @send_email = send_email
  @status = status
  @created_at = created_at
  @etid = etid
end

Instance Attribute Details

#account_identifierString

The account identifier

Returns:



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

def 
  @account_identifier
end

#account_numberString

The account number

Returns:



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

def 
  @account_number
end

#amount_chargedCurrencyBreakdownModel

The order amount information



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

def amount_charged
  @amount_charged
end

#created_atDateTime

The date the order was placed

Returns:

  • (DateTime)


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

def created_at
  @created_at
end

#customer_identifierString

The customer identifier

Returns:



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

def customer_identifier
  @customer_identifier
end

#etidString

The order’s email template id

Returns:



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

def etid
  @etid
end

#margin_shareCurrencyBreakdownModel

The margin share information



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

def margin_share
  @margin_share
end

#recipientNameEmailModel

The recipient’s information

Returns:



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

def recipient
  @recipient
end

#reference_order_idString

The reference order id

Returns:



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

def reference_order_id
  @reference_order_id
end

#reward_nameString

The reward’s name

Returns:



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

def reward_name
  @reward_name
end

#send_emailBoolean

Indicates if an an email was sent to the recipient

Returns:

  • (Boolean)


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

def send_email
  @send_email
end

#senderNameEmailModel

The sender’s information

Returns:



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

def sender
  @sender
end

#statusString

The order’s status

Returns:



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

def status
  @status
end

#utidString

The UTID

Returns:



34
35
36
# File 'lib/raas/models/order_summary_model.rb', line 34

def utid
  @utid
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/raas/models/order_summary_model.rb', line 115

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
  margin_share = CurrencyBreakdownModel.from_hash(hash['marginShare']) if
    hash['marginShare']
  utid = hash['utid']
  reward_name = hash['rewardName']
  sender = NameEmailModel.from_hash(hash['sender']) if hash['sender']
  recipient = NameEmailModel.from_hash(hash['recipient']) if
    hash['recipient']
  send_email = hash['sendEmail']
  status = hash['status']
  created_at = APIHelper.rfc3339(hash['createdAt']) if hash['createdAt']
  etid = hash['etid']

  # Create object from extracted values.
  OrderSummaryModel.new(reference_order_id,
                        customer_identifier,
                        ,
                        ,
                        amount_charged,
                        margin_share,
                        utid,
                        reward_name,
                        sender,
                        recipient,
                        send_email,
                        status,
                        created_at,
                        etid)
end

.namesObject

A mapping from model property names to API property names.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/raas/models/order_summary_model.rb', line 65

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['margin_share'] = 'marginShare'
  @_hash['utid'] = 'utid'
  @_hash['reward_name'] = 'rewardName'
  @_hash['sender'] = 'sender'
  @_hash['recipient'] = 'recipient'
  @_hash['send_email'] = 'sendEmail'
  @_hash['status'] = 'status'
  @_hash['created_at'] = 'createdAt'
  @_hash['etid'] = 'etid'
  @_hash
end