Class: Raas::CreateOrderRequestModel

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/raas/models/create_order_request_model.rb

Overview

Represents the request to place an order

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(account_identifier = nil, amount = nil, customer_identifier = nil, send_email = nil, utid = nil, campaign = nil, email_subject = nil, external_ref_id = nil, message = nil, recipient = nil, sender = nil, notes = nil, etid = nil) ⇒ CreateOrderRequestModel

Returns a new instance of CreateOrderRequestModel.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/raas/models/create_order_request_model.rb', line 78

def initialize( = nil,
               amount = nil,
               customer_identifier = nil,
               send_email = nil,
               utid = nil,
               campaign = nil,
               email_subject = nil,
               external_ref_id = nil,
               message = nil,
               recipient = nil,
               sender = nil,
               notes = nil,
               etid = nil)
  @account_identifier = 
  @amount = amount
  @customer_identifier = customer_identifier
  @send_email = send_email
  @utid = utid
  @campaign = campaign
  @email_subject = email_subject
  @external_ref_id = external_ref_id
  @message = message
  @recipient = recipient
  @sender = sender
  @notes = notes
  @etid = etid
end

Instance Attribute Details

#account_identifierString

The account identifier

Returns:



9
10
11
# File 'lib/raas/models/create_order_request_model.rb', line 9

def 
  @account_identifier
end

#amountFloat

The order amount

Returns:

  • (Float)


13
14
15
# File 'lib/raas/models/create_order_request_model.rb', line 13

def amount
  @amount
end

#campaignString

An optional campaign identifier

Returns:



29
30
31
# File 'lib/raas/models/create_order_request_model.rb', line 29

def campaign
  @campaign
end

#customer_identifierString

The customer identifier

Returns:



17
18
19
# File 'lib/raas/models/create_order_request_model.rb', line 17

def customer_identifier
  @customer_identifier
end

#email_subjectString

The subject of the gift email

Returns:



33
34
35
# File 'lib/raas/models/create_order_request_model.rb', line 33

def email_subject
  @email_subject
end

#etidString

The email template identifier

Returns:



57
58
59
# File 'lib/raas/models/create_order_request_model.rb', line 57

def etid
  @etid
end

#external_ref_idString

An optional external reference id

Returns:



37
38
39
# File 'lib/raas/models/create_order_request_model.rb', line 37

def external_ref_id
  @external_ref_id
end

#messageString

The gift message in the email

Returns:



41
42
43
# File 'lib/raas/models/create_order_request_model.rb', line 41

def message
  @message
end

#notesString

Optional notes (not displayed to customer)

Returns:



53
54
55
# File 'lib/raas/models/create_order_request_model.rb', line 53

def notes
  @notes
end

#recipientNameEmailModel

The recipient’s information

Returns:



45
46
47
# File 'lib/raas/models/create_order_request_model.rb', line 45

def recipient
  @recipient
end

#send_emailBoolean

Indicates whether we should deliver this reward via email

Returns:

  • (Boolean)


21
22
23
# File 'lib/raas/models/create_order_request_model.rb', line 21

def send_email
  @send_email
end

#senderNameEmailModel

Optional sender information

Returns:



49
50
51
# File 'lib/raas/models/create_order_request_model.rb', line 49

def sender
  @sender
end

#utidString

The UTID

Returns:



25
26
27
# File 'lib/raas/models/create_order_request_model.rb', line 25

def utid
  @utid
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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/create_order_request_model.rb', line 107

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash['accountIdentifier']
  amount = hash['amount']
  customer_identifier = hash['customerIdentifier']
  send_email = hash['sendEmail']
  utid = hash['utid']
  campaign = hash['campaign']
  email_subject = hash['emailSubject']
  external_ref_id = hash['externalRefID']
  message = hash['message']
  recipient = NameEmailModel.from_hash(hash['recipient']) if
    hash['recipient']
  sender = NameEmailModel.from_hash(hash['sender']) if hash['sender']
  notes = hash['notes']
  etid = hash['etid']

  # Create object from extracted values.
  CreateOrderRequestModel.new(,
                              amount,
                              customer_identifier,
                              send_email,
                              utid,
                              campaign,
                              email_subject,
                              external_ref_id,
                              message,
                              recipient,
                              sender,
                              notes,
                              etid)
end

.namesObject

A mapping from model property names to API property names.



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/raas/models/create_order_request_model.rb', line 60

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_identifier'] = 'accountIdentifier'
  @_hash['amount'] = 'amount'
  @_hash['customer_identifier'] = 'customerIdentifier'
  @_hash['send_email'] = 'sendEmail'
  @_hash['utid'] = 'utid'
  @_hash['campaign'] = 'campaign'
  @_hash['email_subject'] = 'emailSubject'
  @_hash['external_ref_id'] = 'externalRefID'
  @_hash['message'] = 'message'
  @_hash['recipient'] = 'recipient'
  @_hash['sender'] = 'sender'
  @_hash['notes'] = 'notes'
  @_hash['etid'] = 'etid'
  @_hash
end