tangocard-raas 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +175 -0
- data/README.md +542 -0
- data/lib/raas.rb +61 -0
- data/lib/raas/api_helper.rb +181 -0
- data/lib/raas/configuration.rb +72 -0
- data/lib/raas/controllers/accounts_controller.rb +189 -0
- data/lib/raas/controllers/base_controller.rb +68 -0
- data/lib/raas/controllers/catalog_controller.rb +47 -0
- data/lib/raas/controllers/customers_controller.rb +137 -0
- data/lib/raas/controllers/exchange_rates_controller.rb +36 -0
- data/lib/raas/controllers/orders_controller.rb +199 -0
- data/lib/raas/controllers/status_controller.rb +46 -0
- data/lib/raas/exceptions/api_exception.rb +16 -0
- data/lib/raas/exceptions/raas_client_exception.rb +58 -0
- data/lib/raas/exceptions/raas_generic_exception.rb +53 -0
- data/lib/raas/exceptions/raas_server_exception.rb +58 -0
- data/lib/raas/http/auth/basic_auth.rb +17 -0
- data/lib/raas/http/faraday_client.rb +43 -0
- data/lib/raas/http/http_call_back.rb +17 -0
- data/lib/raas/http/http_client.rb +84 -0
- data/lib/raas/http/http_context.rb +15 -0
- data/lib/raas/http/http_method_enum.rb +7 -0
- data/lib/raas/http/http_request.rb +44 -0
- data/lib/raas/http/http_response.rb +19 -0
- data/lib/raas/models/account_model.rb +88 -0
- data/lib/raas/models/account_summary_model.rb +61 -0
- data/lib/raas/models/base_model.rb +32 -0
- data/lib/raas/models/brand_model.rb +129 -0
- data/lib/raas/models/catalog_model.rb +47 -0
- data/lib/raas/models/create_account_request_model.rb +51 -0
- data/lib/raas/models/create_customer_request_model.rb +42 -0
- data/lib/raas/models/create_order_request_model.rb +132 -0
- data/lib/raas/models/currency_breakdown_model.rb +69 -0
- data/lib/raas/models/customer_model.rb +75 -0
- data/lib/raas/models/exchange_rate_model.rb +61 -0
- data/lib/raas/models/exchange_rate_response_model.rb +47 -0
- data/lib/raas/models/get_orders_response_model.rb +47 -0
- data/lib/raas/models/item_model.rb +133 -0
- data/lib/raas/models/name_email_model.rb +51 -0
- data/lib/raas/models/order_model.rb +187 -0
- data/lib/raas/models/page_model.rb +60 -0
- data/lib/raas/models/raas_client_error_model.rb +60 -0
- data/lib/raas/models/raas_server_error_model.rb +42 -0
- data/lib/raas/models/resend_order_response_model.rb +43 -0
- data/lib/raas/models/reward_credential_model.rb +51 -0
- data/lib/raas/models/reward_model.rb +56 -0
- data/lib/raas/models/system_status_response_model.rb +33 -0
- data/lib/raas/raas_client.rb +53 -0
- metadata +175 -0
@@ -0,0 +1,132 @@
|
|
1
|
+
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
|
2
|
+
|
3
|
+
module Raas
|
4
|
+
class CreateOrderRequestModel < BaseModel
|
5
|
+
# Account Identifier
|
6
|
+
# @return [String]
|
7
|
+
attr_accessor :account_identifier
|
8
|
+
|
9
|
+
# Amount
|
10
|
+
# @return [Float]
|
11
|
+
attr_accessor :amount
|
12
|
+
|
13
|
+
# Customer Identifier
|
14
|
+
# @return [String]
|
15
|
+
attr_accessor :customer_identifier
|
16
|
+
|
17
|
+
# Send Email
|
18
|
+
# @return [Boolean]
|
19
|
+
attr_accessor :send_email
|
20
|
+
|
21
|
+
# UTID
|
22
|
+
# @return [String]
|
23
|
+
attr_accessor :utid
|
24
|
+
|
25
|
+
# Campaign
|
26
|
+
# @return [String]
|
27
|
+
attr_accessor :campaign
|
28
|
+
|
29
|
+
# Email Subject
|
30
|
+
# @return [String]
|
31
|
+
attr_accessor :email_subject
|
32
|
+
|
33
|
+
# External Reference ID
|
34
|
+
# @return [String]
|
35
|
+
attr_accessor :external_ref_id
|
36
|
+
|
37
|
+
# Email Message
|
38
|
+
# @return [String]
|
39
|
+
attr_accessor :message
|
40
|
+
|
41
|
+
# Recipient
|
42
|
+
# @return [NameEmailModel]
|
43
|
+
attr_accessor :recipient
|
44
|
+
|
45
|
+
# Sender
|
46
|
+
# @return [NameEmailModel]
|
47
|
+
attr_accessor :sender
|
48
|
+
|
49
|
+
# Notes
|
50
|
+
# @return [String]
|
51
|
+
attr_accessor :notes
|
52
|
+
|
53
|
+
# A mapping from model property names to API property names
|
54
|
+
def self.names
|
55
|
+
if @_hash.nil?
|
56
|
+
@_hash = {}
|
57
|
+
@_hash["account_identifier"] = "accountIdentifier"
|
58
|
+
@_hash["amount"] = "amount"
|
59
|
+
@_hash["customer_identifier"] = "customerIdentifier"
|
60
|
+
@_hash["send_email"] = "sendEmail"
|
61
|
+
@_hash["utid"] = "utid"
|
62
|
+
@_hash["campaign"] = "campaign"
|
63
|
+
@_hash["email_subject"] = "emailSubject"
|
64
|
+
@_hash["external_ref_id"] = "externalRefID"
|
65
|
+
@_hash["message"] = "message"
|
66
|
+
@_hash["recipient"] = "recipient"
|
67
|
+
@_hash["sender"] = "sender"
|
68
|
+
@_hash["notes"] = "notes"
|
69
|
+
end
|
70
|
+
@_hash
|
71
|
+
end
|
72
|
+
|
73
|
+
def initialize(account_identifier = nil,
|
74
|
+
amount = nil,
|
75
|
+
customer_identifier = nil,
|
76
|
+
send_email = nil,
|
77
|
+
utid = nil,
|
78
|
+
campaign = nil,
|
79
|
+
email_subject = nil,
|
80
|
+
external_ref_id = nil,
|
81
|
+
message = nil,
|
82
|
+
recipient = nil,
|
83
|
+
sender = nil,
|
84
|
+
notes = nil)
|
85
|
+
@account_identifier = account_identifier
|
86
|
+
@amount = amount
|
87
|
+
@customer_identifier = customer_identifier
|
88
|
+
@send_email = send_email
|
89
|
+
@utid = utid
|
90
|
+
@campaign = campaign
|
91
|
+
@email_subject = email_subject
|
92
|
+
@external_ref_id = external_ref_id
|
93
|
+
@message = message
|
94
|
+
@recipient = recipient
|
95
|
+
@sender = sender
|
96
|
+
@notes = notes
|
97
|
+
end
|
98
|
+
|
99
|
+
# Creates an instance of the object from a hash
|
100
|
+
def self.from_hash(hash)
|
101
|
+
return nil unless hash
|
102
|
+
|
103
|
+
# Extract variables from the hash
|
104
|
+
account_identifier = hash['accountIdentifier']
|
105
|
+
amount = hash['amount']
|
106
|
+
customer_identifier = hash['customerIdentifier']
|
107
|
+
send_email = hash['sendEmail']
|
108
|
+
utid = hash['utid']
|
109
|
+
campaign = hash['campaign']
|
110
|
+
email_subject = hash['emailSubject']
|
111
|
+
external_ref_id = hash['externalRefID']
|
112
|
+
message = hash['message']
|
113
|
+
recipient = NameEmailModel.from_hash(hash['recipient']) if hash['recipient']
|
114
|
+
sender = NameEmailModel.from_hash(hash['sender']) if hash['sender']
|
115
|
+
notes = hash['notes']
|
116
|
+
|
117
|
+
# Create object from extracted values
|
118
|
+
CreateOrderRequestModel.new(account_identifier,
|
119
|
+
amount,
|
120
|
+
customer_identifier,
|
121
|
+
send_email,
|
122
|
+
utid,
|
123
|
+
campaign,
|
124
|
+
email_subject,
|
125
|
+
external_ref_id,
|
126
|
+
message,
|
127
|
+
recipient,
|
128
|
+
sender,
|
129
|
+
notes)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
|
2
|
+
|
3
|
+
module Raas
|
4
|
+
class CurrencyBreakdownModel < BaseModel
|
5
|
+
# Currency Code
|
6
|
+
# @return [String]
|
7
|
+
attr_accessor :currency_code
|
8
|
+
|
9
|
+
# Exchange Rate
|
10
|
+
# @return [Float]
|
11
|
+
attr_accessor :exchange_rate
|
12
|
+
|
13
|
+
# Fee
|
14
|
+
# @return [Float]
|
15
|
+
attr_accessor :fee
|
16
|
+
|
17
|
+
# Total
|
18
|
+
# @return [Float]
|
19
|
+
attr_accessor :total
|
20
|
+
|
21
|
+
# Value
|
22
|
+
# @return [Float]
|
23
|
+
attr_accessor :value
|
24
|
+
|
25
|
+
# A mapping from model property names to API property names
|
26
|
+
def self.names
|
27
|
+
if @_hash.nil?
|
28
|
+
@_hash = {}
|
29
|
+
@_hash["currency_code"] = "currencyCode"
|
30
|
+
@_hash["exchange_rate"] = "exchangeRate"
|
31
|
+
@_hash["fee"] = "fee"
|
32
|
+
@_hash["total"] = "total"
|
33
|
+
@_hash["value"] = "value"
|
34
|
+
end
|
35
|
+
@_hash
|
36
|
+
end
|
37
|
+
|
38
|
+
def initialize(currency_code = nil,
|
39
|
+
exchange_rate = nil,
|
40
|
+
fee = nil,
|
41
|
+
total = nil,
|
42
|
+
value = nil)
|
43
|
+
@currency_code = currency_code
|
44
|
+
@exchange_rate = exchange_rate
|
45
|
+
@fee = fee
|
46
|
+
@total = total
|
47
|
+
@value = value
|
48
|
+
end
|
49
|
+
|
50
|
+
# Creates an instance of the object from a hash
|
51
|
+
def self.from_hash(hash)
|
52
|
+
return nil unless hash
|
53
|
+
|
54
|
+
# Extract variables from the hash
|
55
|
+
currency_code = hash['currencyCode']
|
56
|
+
exchange_rate = hash['exchangeRate']
|
57
|
+
fee = hash['fee']
|
58
|
+
total = hash['total']
|
59
|
+
value = hash['value']
|
60
|
+
|
61
|
+
# Create object from extracted values
|
62
|
+
CurrencyBreakdownModel.new(currency_code,
|
63
|
+
exchange_rate,
|
64
|
+
fee,
|
65
|
+
total,
|
66
|
+
value)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
module Raas
|
5
|
+
class CustomerModel < BaseModel
|
6
|
+
# Customer Identifier
|
7
|
+
# @return [String]
|
8
|
+
attr_accessor :customer_identifier
|
9
|
+
|
10
|
+
# Display Name
|
11
|
+
# @return [String]
|
12
|
+
attr_accessor :display_name
|
13
|
+
|
14
|
+
# Status
|
15
|
+
# @return [String]
|
16
|
+
attr_accessor :status
|
17
|
+
|
18
|
+
# Date Created
|
19
|
+
# @return [DateTime]
|
20
|
+
attr_accessor :created_at
|
21
|
+
|
22
|
+
# Accounts
|
23
|
+
# @return [List of AccountSummaryModel]
|
24
|
+
attr_accessor :accounts
|
25
|
+
|
26
|
+
# A mapping from model property names to API property names
|
27
|
+
def self.names
|
28
|
+
if @_hash.nil?
|
29
|
+
@_hash = {}
|
30
|
+
@_hash["customer_identifier"] = "customerIdentifier"
|
31
|
+
@_hash["display_name"] = "displayName"
|
32
|
+
@_hash["status"] = "status"
|
33
|
+
@_hash["created_at"] = "createdAt"
|
34
|
+
@_hash["accounts"] = "accounts"
|
35
|
+
end
|
36
|
+
@_hash
|
37
|
+
end
|
38
|
+
|
39
|
+
def initialize(customer_identifier = nil,
|
40
|
+
display_name = nil,
|
41
|
+
status = nil,
|
42
|
+
created_at = nil,
|
43
|
+
accounts = nil)
|
44
|
+
@customer_identifier = customer_identifier
|
45
|
+
@display_name = display_name
|
46
|
+
@status = status
|
47
|
+
@created_at = created_at
|
48
|
+
@accounts = accounts
|
49
|
+
end
|
50
|
+
|
51
|
+
# Creates an instance of the object from a hash
|
52
|
+
def self.from_hash(hash)
|
53
|
+
return nil unless hash
|
54
|
+
|
55
|
+
# Extract variables from the hash
|
56
|
+
customer_identifier = hash['customerIdentifier']
|
57
|
+
display_name = hash['displayName']
|
58
|
+
status = hash['status']
|
59
|
+
created_at = DateTime.rfc3339(hash['createdAt']) if hash['createdAt']
|
60
|
+
# Parameter is an array, so we need to iterate through it
|
61
|
+
accounts = nil
|
62
|
+
if hash['accounts'] != nil
|
63
|
+
accounts = Array.new
|
64
|
+
hash['accounts'].each{|structure| accounts << (AccountSummaryModel.from_hash(structure) if structure)}
|
65
|
+
end
|
66
|
+
|
67
|
+
# Create object from extracted values
|
68
|
+
CustomerModel.new(customer_identifier,
|
69
|
+
display_name,
|
70
|
+
status,
|
71
|
+
created_at,
|
72
|
+
accounts)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
module Raas
|
5
|
+
class ExchangeRateModel < BaseModel
|
6
|
+
# Last Modified
|
7
|
+
# @return [DateTime]
|
8
|
+
attr_accessor :last_modified_date
|
9
|
+
|
10
|
+
# Reward Currency
|
11
|
+
# @return [String]
|
12
|
+
attr_accessor :reward_currency
|
13
|
+
|
14
|
+
# Base Currency
|
15
|
+
# @return [String]
|
16
|
+
attr_accessor :base_currency
|
17
|
+
|
18
|
+
# Exchange Rate
|
19
|
+
# @return [Float]
|
20
|
+
attr_accessor :base_fx
|
21
|
+
|
22
|
+
# A mapping from model property names to API property names
|
23
|
+
def self.names
|
24
|
+
if @_hash.nil?
|
25
|
+
@_hash = {}
|
26
|
+
@_hash["last_modified_date"] = "lastModifiedDate"
|
27
|
+
@_hash["reward_currency"] = "rewardCurrency"
|
28
|
+
@_hash["base_currency"] = "baseCurrency"
|
29
|
+
@_hash["base_fx"] = "baseFx"
|
30
|
+
end
|
31
|
+
@_hash
|
32
|
+
end
|
33
|
+
|
34
|
+
def initialize(last_modified_date = nil,
|
35
|
+
reward_currency = nil,
|
36
|
+
base_currency = nil,
|
37
|
+
base_fx = nil)
|
38
|
+
@last_modified_date = last_modified_date
|
39
|
+
@reward_currency = reward_currency
|
40
|
+
@base_currency = base_currency
|
41
|
+
@base_fx = base_fx
|
42
|
+
end
|
43
|
+
|
44
|
+
# Creates an instance of the object from a hash
|
45
|
+
def self.from_hash(hash)
|
46
|
+
return nil unless hash
|
47
|
+
|
48
|
+
# Extract variables from the hash
|
49
|
+
last_modified_date = DateTime.rfc3339(hash['lastModifiedDate']) if hash['lastModifiedDate']
|
50
|
+
reward_currency = hash['rewardCurrency']
|
51
|
+
base_currency = hash['baseCurrency']
|
52
|
+
base_fx = hash['baseFx']
|
53
|
+
|
54
|
+
# Create object from extracted values
|
55
|
+
ExchangeRateModel.new(last_modified_date,
|
56
|
+
reward_currency,
|
57
|
+
base_currency,
|
58
|
+
base_fx)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
|
2
|
+
|
3
|
+
module Raas
|
4
|
+
class ExchangeRateResponseModel < BaseModel
|
5
|
+
# Disclaimer
|
6
|
+
# @return [String]
|
7
|
+
attr_accessor :disclaimer
|
8
|
+
|
9
|
+
# Exchange Rates
|
10
|
+
# @return [List of ExchangeRateModel]
|
11
|
+
attr_accessor :exchange_rates
|
12
|
+
|
13
|
+
# A mapping from model property names to API property names
|
14
|
+
def self.names
|
15
|
+
if @_hash.nil?
|
16
|
+
@_hash = {}
|
17
|
+
@_hash["disclaimer"] = "disclaimer"
|
18
|
+
@_hash["exchange_rates"] = "exchangeRates"
|
19
|
+
end
|
20
|
+
@_hash
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(disclaimer = nil,
|
24
|
+
exchange_rates = nil)
|
25
|
+
@disclaimer = disclaimer
|
26
|
+
@exchange_rates = exchange_rates
|
27
|
+
end
|
28
|
+
|
29
|
+
# Creates an instance of the object from a hash
|
30
|
+
def self.from_hash(hash)
|
31
|
+
return nil unless hash
|
32
|
+
|
33
|
+
# Extract variables from the hash
|
34
|
+
disclaimer = hash['disclaimer']
|
35
|
+
# Parameter is an array, so we need to iterate through it
|
36
|
+
exchange_rates = nil
|
37
|
+
if hash['exchangeRates'] != nil
|
38
|
+
exchange_rates = Array.new
|
39
|
+
hash['exchangeRates'].each{|structure| exchange_rates << (ExchangeRateModel.from_hash(structure) if structure)}
|
40
|
+
end
|
41
|
+
|
42
|
+
# Create object from extracted values
|
43
|
+
ExchangeRateResponseModel.new(disclaimer,
|
44
|
+
exchange_rates)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
|
2
|
+
|
3
|
+
module Raas
|
4
|
+
class GetOrdersResponseModel < BaseModel
|
5
|
+
# Pagination information
|
6
|
+
# @return [PageModel]
|
7
|
+
attr_accessor :page
|
8
|
+
|
9
|
+
# An array of orders
|
10
|
+
# @return [List of OrderModel]
|
11
|
+
attr_accessor :orders
|
12
|
+
|
13
|
+
# A mapping from model property names to API property names
|
14
|
+
def self.names
|
15
|
+
if @_hash.nil?
|
16
|
+
@_hash = {}
|
17
|
+
@_hash["page"] = "page"
|
18
|
+
@_hash["orders"] = "orders"
|
19
|
+
end
|
20
|
+
@_hash
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(page = nil,
|
24
|
+
orders = nil)
|
25
|
+
@page = page
|
26
|
+
@orders = orders
|
27
|
+
end
|
28
|
+
|
29
|
+
# Creates an instance of the object from a hash
|
30
|
+
def self.from_hash(hash)
|
31
|
+
return nil unless hash
|
32
|
+
|
33
|
+
# Extract variables from the hash
|
34
|
+
page = PageModel.from_hash(hash['page']) if hash['page']
|
35
|
+
# Parameter is an array, so we need to iterate through it
|
36
|
+
orders = nil
|
37
|
+
if hash['orders'] != nil
|
38
|
+
orders = Array.new
|
39
|
+
hash['orders'].each{|structure| orders << (OrderModel.from_hash(structure) if structure)}
|
40
|
+
end
|
41
|
+
|
42
|
+
# Create object from extracted values
|
43
|
+
GetOrdersResponseModel.new(page,
|
44
|
+
orders)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,133 @@
|
|
1
|
+
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
module Raas
|
5
|
+
class ItemModel < BaseModel
|
6
|
+
# UTID
|
7
|
+
# @return [String]
|
8
|
+
attr_accessor :utid
|
9
|
+
|
10
|
+
# Reward Name
|
11
|
+
# @return [String]
|
12
|
+
attr_accessor :reward_name
|
13
|
+
|
14
|
+
# Currency Code
|
15
|
+
# @return [String]
|
16
|
+
attr_accessor :currency_code
|
17
|
+
|
18
|
+
# Status
|
19
|
+
# @return [String]
|
20
|
+
attr_accessor :status
|
21
|
+
|
22
|
+
# Value Type (fixed/variable)
|
23
|
+
# @return [String]
|
24
|
+
attr_accessor :value_type
|
25
|
+
|
26
|
+
# Reward Type
|
27
|
+
# @return [String]
|
28
|
+
attr_accessor :reward_type
|
29
|
+
|
30
|
+
# Date Created
|
31
|
+
# @return [DateTime]
|
32
|
+
attr_accessor :created_date
|
33
|
+
|
34
|
+
# Last Updated
|
35
|
+
# @return [DateTime]
|
36
|
+
attr_accessor :last_update_date
|
37
|
+
|
38
|
+
# Countries
|
39
|
+
# @return [List of String]
|
40
|
+
attr_accessor :countries
|
41
|
+
|
42
|
+
# Minimum Value (for variable value items)
|
43
|
+
# @return [Float]
|
44
|
+
attr_accessor :min_value
|
45
|
+
|
46
|
+
# Maximum Value (for variable value items)
|
47
|
+
# @return [Float]
|
48
|
+
attr_accessor :max_value
|
49
|
+
|
50
|
+
# Face Value
|
51
|
+
# @return [Float]
|
52
|
+
attr_accessor :face_value
|
53
|
+
|
54
|
+
# A mapping from model property names to API property names
|
55
|
+
def self.names
|
56
|
+
if @_hash.nil?
|
57
|
+
@_hash = {}
|
58
|
+
@_hash["utid"] = "utid"
|
59
|
+
@_hash["reward_name"] = "rewardName"
|
60
|
+
@_hash["currency_code"] = "currencyCode"
|
61
|
+
@_hash["status"] = "status"
|
62
|
+
@_hash["value_type"] = "valueType"
|
63
|
+
@_hash["reward_type"] = "rewardType"
|
64
|
+
@_hash["created_date"] = "createdDate"
|
65
|
+
@_hash["last_update_date"] = "lastUpdateDate"
|
66
|
+
@_hash["countries"] = "countries"
|
67
|
+
@_hash["min_value"] = "minValue"
|
68
|
+
@_hash["max_value"] = "maxValue"
|
69
|
+
@_hash["face_value"] = "faceValue"
|
70
|
+
end
|
71
|
+
@_hash
|
72
|
+
end
|
73
|
+
|
74
|
+
def initialize(utid = nil,
|
75
|
+
reward_name = nil,
|
76
|
+
currency_code = nil,
|
77
|
+
status = nil,
|
78
|
+
value_type = nil,
|
79
|
+
reward_type = nil,
|
80
|
+
created_date = nil,
|
81
|
+
last_update_date = nil,
|
82
|
+
countries = nil,
|
83
|
+
min_value = nil,
|
84
|
+
max_value = nil,
|
85
|
+
face_value = nil)
|
86
|
+
@utid = utid
|
87
|
+
@reward_name = reward_name
|
88
|
+
@currency_code = currency_code
|
89
|
+
@status = status
|
90
|
+
@value_type = value_type
|
91
|
+
@reward_type = reward_type
|
92
|
+
@created_date = created_date
|
93
|
+
@last_update_date = last_update_date
|
94
|
+
@countries = countries
|
95
|
+
@min_value = min_value
|
96
|
+
@max_value = max_value
|
97
|
+
@face_value = face_value
|
98
|
+
end
|
99
|
+
|
100
|
+
# Creates an instance of the object from a hash
|
101
|
+
def self.from_hash(hash)
|
102
|
+
return nil unless hash
|
103
|
+
|
104
|
+
# Extract variables from the hash
|
105
|
+
utid = hash['utid']
|
106
|
+
reward_name = hash['rewardName']
|
107
|
+
currency_code = hash['currencyCode']
|
108
|
+
status = hash['status']
|
109
|
+
value_type = hash['valueType']
|
110
|
+
reward_type = hash['rewardType']
|
111
|
+
created_date = DateTime.rfc3339(hash['createdDate']) if hash['createdDate']
|
112
|
+
last_update_date = DateTime.rfc3339(hash['lastUpdateDate']) if hash['lastUpdateDate']
|
113
|
+
countries = hash['countries']
|
114
|
+
min_value = hash['minValue']
|
115
|
+
max_value = hash['maxValue']
|
116
|
+
face_value = hash['faceValue']
|
117
|
+
|
118
|
+
# Create object from extracted values
|
119
|
+
ItemModel.new(utid,
|
120
|
+
reward_name,
|
121
|
+
currency_code,
|
122
|
+
status,
|
123
|
+
value_type,
|
124
|
+
reward_type,
|
125
|
+
created_date,
|
126
|
+
last_update_date,
|
127
|
+
countries,
|
128
|
+
min_value,
|
129
|
+
max_value,
|
130
|
+
face_value)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|