tangocard-raas 1.1.2 → 2.2.1
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 +4 -4
- data/LICENSE +28 -175
- data/README.md +38 -525
- data/lib/raas.rb +32 -19
- data/lib/raas/api_helper.rb +146 -54
- data/lib/raas/configuration.rb +22 -30
- data/lib/raas/controllers/accounts_controller.rb +146 -92
- data/lib/raas/controllers/base_controller.rb +32 -29
- data/lib/raas/controllers/catalog_controller.rb +31 -14
- data/lib/raas/controllers/customers_controller.rb +113 -72
- data/lib/raas/controllers/exchange_rates_controller.rb +40 -12
- data/lib/raas/controllers/fund_controller.rb +345 -0
- data/lib/raas/controllers/orders_controller.rb +166 -105
- data/lib/raas/controllers/status_controller.rb +31 -14
- data/lib/raas/exceptions/api_exception.rb +4 -2
- data/lib/raas/exceptions/raas_client_exception.rb +14 -12
- data/lib/raas/exceptions/raas_generic_exception.rb +9 -9
- data/lib/raas/exceptions/raas_server_exception.rb +14 -12
- data/lib/raas/http/auth/basic_auth.rb +7 -4
- data/lib/raas/http/faraday_client.rb +19 -7
- data/lib/raas/http/http_call_back.rb +11 -6
- data/lib/raas/http/http_client.rb +50 -32
- data/lib/raas/http/http_context.rb +5 -2
- data/lib/raas/http/http_method_enum.rb +6 -2
- data/lib/raas/http/http_request.rb +7 -3
- data/lib/raas/http/http_response.rb +3 -1
- data/lib/raas/models/account_model.rb +32 -23
- data/lib/raas/models/account_summary_model.rb +26 -17
- data/lib/raas/models/base_model.rb +11 -9
- data/lib/raas/models/billing_address_model.rb +105 -0
- data/lib/raas/models/brand_model.rb +39 -35
- data/lib/raas/models/catalog_model.rb +15 -13
- data/lib/raas/models/create_account_request_model.rb +14 -14
- data/lib/raas/models/create_credit_card_request_model.rb +96 -0
- data/lib/raas/models/create_customer_request_model.rb +12 -12
- data/lib/raas/models/create_order_request_model.rb +45 -35
- data/lib/raas/models/credit_card_model.rb +124 -0
- data/lib/raas/models/currency_breakdown_model.rb +18 -18
- data/lib/raas/models/customer_model.rb +24 -22
- data/lib/raas/models/deposit_request_model.rb +60 -0
- data/lib/raas/models/deposit_response_model.rb +80 -0
- data/lib/raas/models/exchange_rate_model.rb +18 -17
- data/lib/raas/models/exchange_rate_response_model.rb +17 -15
- data/lib/raas/models/full_name_email_model.rb +42 -0
- data/lib/raas/models/get_deposit_response_model.rb +80 -0
- data/lib/raas/models/get_orders_response_model.rb +16 -14
- data/lib/raas/models/item_model.rb +36 -34
- data/lib/raas/models/name_email_model.rb +14 -14
- data/lib/raas/models/new_credit_card_model.rb +51 -0
- data/lib/raas/models/order_model.rb +124 -92
- data/lib/raas/models/order_summary_model.rb +155 -0
- data/lib/raas/models/page_model.rb +16 -16
- data/lib/raas/models/raas_client_error_model.rb +16 -16
- data/lib/raas/models/raas_server_error_model.rb +12 -12
- data/lib/raas/models/resend_order_response_model.rb +11 -11
- data/lib/raas/models/reward_credential_model.rb +14 -14
- data/lib/raas/models/reward_model.rb +16 -14
- data/lib/raas/models/system_status_response_model.rb +10 -10
- data/lib/raas/models/unregister_credit_card_request_model.rb +51 -0
- data/lib/raas/models/unregister_credit_card_response_model.rb +53 -0
- data/lib/raas/raas_client.rb +36 -25
- data/test/controllers/controller_test_base.rb +31 -0
- data/test/controllers/test_accounts_controller.rb +79 -0
- data/test/controllers/test_catalog_controller.rb +65 -0
- data/test/controllers/test_customers_controller.rb +61 -0
- data/test/controllers/test_exchange_rates_controller.rb +35 -0
- data/test/controllers/test_fund_controller.rb +108 -0
- data/test/controllers/test_orders_controller.rb +86 -0
- data/test/controllers/test_status_controller.rb +27 -0
- data/test/http_response_catcher.rb +16 -0
- data/test/test_helper.rb +91 -0
- metadata +32 -10
@@ -1,58 +1,67 @@
|
|
1
|
-
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
|
1
|
+
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
2
3
|
|
3
4
|
require 'date'
|
4
5
|
module Raas
|
6
|
+
# Represents an Account Summary
|
5
7
|
class AccountSummaryModel < BaseModel
|
6
|
-
#
|
8
|
+
# The account identifier
|
7
9
|
# @return [String]
|
8
10
|
attr_accessor :account_identifier
|
9
11
|
|
10
|
-
#
|
12
|
+
# The account number
|
13
|
+
# @return [String]
|
14
|
+
attr_accessor :account_number
|
15
|
+
|
16
|
+
# The display name
|
11
17
|
# @return [String]
|
12
18
|
attr_accessor :display_name
|
13
19
|
|
14
|
-
#
|
20
|
+
# The date the account was created
|
15
21
|
# @return [DateTime]
|
16
22
|
attr_accessor :created_at
|
17
23
|
|
18
|
-
#
|
24
|
+
# The status of the account
|
19
25
|
# @return [String]
|
20
26
|
attr_accessor :status
|
21
27
|
|
22
|
-
# A mapping from model property names to API property names
|
28
|
+
# A mapping from model property names to API property names.
|
23
29
|
def self.names
|
24
|
-
if @_hash.nil?
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
end
|
30
|
+
@_hash = {} if @_hash.nil?
|
31
|
+
@_hash['account_identifier'] = 'accountIdentifier'
|
32
|
+
@_hash['account_number'] = 'accountNumber'
|
33
|
+
@_hash['display_name'] = 'displayName'
|
34
|
+
@_hash['created_at'] = 'createdAt'
|
35
|
+
@_hash['status'] = 'status'
|
31
36
|
@_hash
|
32
37
|
end
|
33
38
|
|
34
39
|
def initialize(account_identifier = nil,
|
40
|
+
account_number = nil,
|
35
41
|
display_name = nil,
|
36
42
|
created_at = nil,
|
37
43
|
status = nil)
|
38
44
|
@account_identifier = account_identifier
|
45
|
+
@account_number = account_number
|
39
46
|
@display_name = display_name
|
40
47
|
@created_at = created_at
|
41
48
|
@status = status
|
42
49
|
end
|
43
50
|
|
44
|
-
# Creates an instance of the object from a hash
|
51
|
+
# Creates an instance of the object from a hash.
|
45
52
|
def self.from_hash(hash)
|
46
53
|
return nil unless hash
|
47
54
|
|
48
|
-
# Extract variables from the hash
|
55
|
+
# Extract variables from the hash.
|
49
56
|
account_identifier = hash['accountIdentifier']
|
57
|
+
account_number = hash['accountNumber']
|
50
58
|
display_name = hash['displayName']
|
51
|
-
created_at =
|
59
|
+
created_at = APIHelper.rfc3339(hash['createdAt']) if hash['createdAt']
|
52
60
|
status = hash['status']
|
53
61
|
|
54
|
-
# Create object from extracted values
|
62
|
+
# Create object from extracted values.
|
55
63
|
AccountSummaryModel.new(account_identifier,
|
64
|
+
account_number,
|
56
65
|
display_name,
|
57
66
|
created_at,
|
58
67
|
status)
|
@@ -1,32 +1,34 @@
|
|
1
|
-
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
|
1
|
+
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
2
3
|
|
3
4
|
module Raas
|
5
|
+
# Base model.
|
4
6
|
class BaseModel
|
5
|
-
# Returns a Hash representation of the current object
|
7
|
+
# Returns a Hash representation of the current object.
|
6
8
|
def to_hash
|
7
9
|
hash = {}
|
8
|
-
|
9
|
-
value =
|
10
|
+
instance_variables.each do |name|
|
11
|
+
value = instance_variable_get(name)
|
10
12
|
name = name[1..-1]
|
11
13
|
key = self.class.names.key?(name) ? self.class.names[name] : name
|
12
14
|
if value.instance_of? Array
|
13
|
-
hash[key] = value.map{|v| v.
|
15
|
+
hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
|
14
16
|
elsif value.instance_of? Hash
|
15
17
|
hash[key] = {}
|
16
18
|
value.each do |k, v|
|
17
|
-
hash[key][k] = v.
|
19
|
+
hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
|
18
20
|
end
|
19
21
|
else
|
20
|
-
hash[key] = value.
|
22
|
+
hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
|
21
23
|
end
|
22
24
|
end
|
23
25
|
hash
|
24
26
|
end
|
25
27
|
|
26
|
-
# Returns a JSON representation of the curent object
|
28
|
+
# Returns a JSON representation of the curent object.
|
27
29
|
def to_json(options = {})
|
28
30
|
hash = to_hash
|
29
31
|
hash.to_json(options)
|
30
32
|
end
|
31
33
|
end
|
32
|
-
end
|
34
|
+
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module Raas
|
5
|
+
# Represents a Billing Address
|
6
|
+
class BillingAddressModel < BaseModel
|
7
|
+
# The first name
|
8
|
+
# @return [String]
|
9
|
+
attr_accessor :first_name
|
10
|
+
|
11
|
+
# The last name
|
12
|
+
# @return [String]
|
13
|
+
attr_accessor :last_name
|
14
|
+
|
15
|
+
# The address
|
16
|
+
# @return [String]
|
17
|
+
attr_accessor :address_line1
|
18
|
+
|
19
|
+
# The city
|
20
|
+
# @return [String]
|
21
|
+
attr_accessor :city
|
22
|
+
|
23
|
+
# The state/province
|
24
|
+
# @return [String]
|
25
|
+
attr_accessor :state
|
26
|
+
|
27
|
+
# The postal code
|
28
|
+
# @return [String]
|
29
|
+
attr_accessor :postal_code
|
30
|
+
|
31
|
+
# The 2-letter country code
|
32
|
+
# @return [String]
|
33
|
+
attr_accessor :country
|
34
|
+
|
35
|
+
# The billing contact's email address
|
36
|
+
# @return [String]
|
37
|
+
attr_accessor :email_address
|
38
|
+
|
39
|
+
# An optional second address line
|
40
|
+
# @return [String]
|
41
|
+
attr_accessor :address_line2
|
42
|
+
|
43
|
+
# A mapping from model property names to API property names.
|
44
|
+
def self.names
|
45
|
+
@_hash = {} if @_hash.nil?
|
46
|
+
@_hash['first_name'] = 'firstName'
|
47
|
+
@_hash['last_name'] = 'lastName'
|
48
|
+
@_hash['address_line1'] = 'addressLine1'
|
49
|
+
@_hash['city'] = 'city'
|
50
|
+
@_hash['state'] = 'state'
|
51
|
+
@_hash['postal_code'] = 'postalCode'
|
52
|
+
@_hash['country'] = 'country'
|
53
|
+
@_hash['email_address'] = 'emailAddress'
|
54
|
+
@_hash['address_line2'] = 'addressLine2'
|
55
|
+
@_hash
|
56
|
+
end
|
57
|
+
|
58
|
+
def initialize(first_name = nil,
|
59
|
+
last_name = nil,
|
60
|
+
address_line1 = nil,
|
61
|
+
city = nil,
|
62
|
+
state = nil,
|
63
|
+
postal_code = nil,
|
64
|
+
country = nil,
|
65
|
+
email_address = nil,
|
66
|
+
address_line2 = nil)
|
67
|
+
@first_name = first_name
|
68
|
+
@last_name = last_name
|
69
|
+
@address_line1 = address_line1
|
70
|
+
@city = city
|
71
|
+
@state = state
|
72
|
+
@postal_code = postal_code
|
73
|
+
@country = country
|
74
|
+
@email_address = email_address
|
75
|
+
@address_line2 = address_line2
|
76
|
+
end
|
77
|
+
|
78
|
+
# Creates an instance of the object from a hash.
|
79
|
+
def self.from_hash(hash)
|
80
|
+
return nil unless hash
|
81
|
+
|
82
|
+
# Extract variables from the hash.
|
83
|
+
first_name = hash['firstName']
|
84
|
+
last_name = hash['lastName']
|
85
|
+
address_line1 = hash['addressLine1']
|
86
|
+
city = hash['city']
|
87
|
+
state = hash['state']
|
88
|
+
postal_code = hash['postalCode']
|
89
|
+
country = hash['country']
|
90
|
+
email_address = hash['emailAddress']
|
91
|
+
address_line2 = hash['addressLine2']
|
92
|
+
|
93
|
+
# Create object from extracted values.
|
94
|
+
BillingAddressModel.new(first_name,
|
95
|
+
last_name,
|
96
|
+
address_line1,
|
97
|
+
city,
|
98
|
+
state,
|
99
|
+
postal_code,
|
100
|
+
country,
|
101
|
+
email_address,
|
102
|
+
address_line2)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -1,68 +1,68 @@
|
|
1
|
-
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
|
1
|
+
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
2
3
|
|
3
4
|
require 'date'
|
4
5
|
module Raas
|
6
|
+
# Represents a Brand
|
5
7
|
class BrandModel < BaseModel
|
6
|
-
#
|
8
|
+
# The brand key
|
7
9
|
# @return [String]
|
8
10
|
attr_accessor :brand_key
|
9
11
|
|
10
|
-
#
|
12
|
+
# The brand name
|
11
13
|
# @return [String]
|
12
14
|
attr_accessor :brand_name
|
13
15
|
|
14
|
-
#
|
16
|
+
# The brand's disclaimer
|
15
17
|
# @return [String]
|
16
18
|
attr_accessor :disclaimer
|
17
19
|
|
18
|
-
#
|
20
|
+
# The brand's description
|
19
21
|
# @return [String]
|
20
22
|
attr_accessor :description
|
21
23
|
|
22
|
-
#
|
24
|
+
# The brand's short description
|
23
25
|
# @return [String]
|
24
26
|
attr_accessor :short_description
|
25
27
|
|
26
|
-
#
|
28
|
+
# The brand's terms
|
27
29
|
# @return [String]
|
28
30
|
attr_accessor :terms
|
29
31
|
|
30
|
-
#
|
32
|
+
# The date the brand was created
|
31
33
|
# @return [DateTime]
|
32
34
|
attr_accessor :created_date
|
33
35
|
|
34
|
-
#
|
36
|
+
# The date the brand was last updated
|
35
37
|
# @return [DateTime]
|
36
38
|
attr_accessor :last_update_date
|
37
39
|
|
38
|
-
# Image URLs
|
40
|
+
# A map of Image URLs
|
39
41
|
# @return [Array<String, String>]
|
40
42
|
attr_accessor :image_urls
|
41
43
|
|
42
|
-
#
|
44
|
+
# The brand's status
|
43
45
|
# @return [String]
|
44
46
|
attr_accessor :status
|
45
47
|
|
46
|
-
#
|
48
|
+
# An array of Item objects
|
47
49
|
# @return [List of ItemModel]
|
48
50
|
attr_accessor :items
|
49
51
|
|
50
|
-
# A mapping from model property names to API property names
|
52
|
+
# A mapping from model property names to API property names.
|
51
53
|
def self.names
|
52
|
-
if @_hash.nil?
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
@_hash["items"] = "items"
|
65
|
-
end
|
54
|
+
@_hash = {} if @_hash.nil?
|
55
|
+
@_hash['brand_key'] = 'brandKey'
|
56
|
+
@_hash['brand_name'] = 'brandName'
|
57
|
+
@_hash['disclaimer'] = 'disclaimer'
|
58
|
+
@_hash['description'] = 'description'
|
59
|
+
@_hash['short_description'] = 'shortDescription'
|
60
|
+
@_hash['terms'] = 'terms'
|
61
|
+
@_hash['created_date'] = 'createdDate'
|
62
|
+
@_hash['last_update_date'] = 'lastUpdateDate'
|
63
|
+
@_hash['image_urls'] = 'imageUrls'
|
64
|
+
@_hash['status'] = 'status'
|
65
|
+
@_hash['items'] = 'items'
|
66
66
|
@_hash
|
67
67
|
end
|
68
68
|
|
@@ -90,29 +90,33 @@ module Raas
|
|
90
90
|
@items = items
|
91
91
|
end
|
92
92
|
|
93
|
-
# Creates an instance of the object from a hash
|
93
|
+
# Creates an instance of the object from a hash.
|
94
94
|
def self.from_hash(hash)
|
95
95
|
return nil unless hash
|
96
96
|
|
97
|
-
# Extract variables from the hash
|
97
|
+
# Extract variables from the hash.
|
98
98
|
brand_key = hash['brandKey']
|
99
99
|
brand_name = hash['brandName']
|
100
100
|
disclaimer = hash['disclaimer']
|
101
101
|
description = hash['description']
|
102
102
|
short_description = hash['shortDescription']
|
103
103
|
terms = hash['terms']
|
104
|
-
created_date =
|
105
|
-
|
104
|
+
created_date = APIHelper.rfc3339(hash['createdDate']) if
|
105
|
+
hash['createdDate']
|
106
|
+
last_update_date = APIHelper.rfc3339(hash['lastUpdateDate']) if
|
107
|
+
hash['lastUpdateDate']
|
106
108
|
image_urls = hash['imageUrls']
|
107
109
|
status = hash['status']
|
108
110
|
# Parameter is an array, so we need to iterate through it
|
109
111
|
items = nil
|
110
|
-
|
111
|
-
items =
|
112
|
-
hash['items'].each
|
112
|
+
unless hash['items'].nil?
|
113
|
+
items = []
|
114
|
+
hash['items'].each do |structure|
|
115
|
+
items << (ItemModel.from_hash(structure) if structure)
|
116
|
+
end
|
113
117
|
end
|
114
118
|
|
115
|
-
# Create object from extracted values
|
119
|
+
# Create object from extracted values.
|
116
120
|
BrandModel.new(brand_key,
|
117
121
|
brand_name,
|
118
122
|
disclaimer,
|
@@ -1,6 +1,8 @@
|
|
1
|
-
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
|
1
|
+
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
2
3
|
|
3
4
|
module Raas
|
5
|
+
# Represents a Catalog
|
4
6
|
class CatalogModel < BaseModel
|
5
7
|
# The name of your catalog
|
6
8
|
# @return [String]
|
@@ -10,13 +12,11 @@ module Raas
|
|
10
12
|
# @return [List of BrandModel]
|
11
13
|
attr_accessor :brands
|
12
14
|
|
13
|
-
# A mapping from model property names to API property names
|
15
|
+
# A mapping from model property names to API property names.
|
14
16
|
def self.names
|
15
|
-
if @_hash.nil?
|
16
|
-
|
17
|
-
|
18
|
-
@_hash["brands"] = "brands"
|
19
|
-
end
|
17
|
+
@_hash = {} if @_hash.nil?
|
18
|
+
@_hash['catalog_name'] = 'catalogName'
|
19
|
+
@_hash['brands'] = 'brands'
|
20
20
|
@_hash
|
21
21
|
end
|
22
22
|
|
@@ -26,20 +26,22 @@ module Raas
|
|
26
26
|
@brands = brands
|
27
27
|
end
|
28
28
|
|
29
|
-
# Creates an instance of the object from a hash
|
29
|
+
# Creates an instance of the object from a hash.
|
30
30
|
def self.from_hash(hash)
|
31
31
|
return nil unless hash
|
32
32
|
|
33
|
-
# Extract variables from the hash
|
33
|
+
# Extract variables from the hash.
|
34
34
|
catalog_name = hash['catalogName']
|
35
35
|
# Parameter is an array, so we need to iterate through it
|
36
36
|
brands = nil
|
37
|
-
|
38
|
-
brands =
|
39
|
-
hash['brands'].each
|
37
|
+
unless hash['brands'].nil?
|
38
|
+
brands = []
|
39
|
+
hash['brands'].each do |structure|
|
40
|
+
brands << (BrandModel.from_hash(structure) if structure)
|
41
|
+
end
|
40
42
|
end
|
41
43
|
|
42
|
-
# Create object from extracted values
|
44
|
+
# Create object from extracted values.
|
43
45
|
CatalogModel.new(catalog_name,
|
44
46
|
brands)
|
45
47
|
end
|
@@ -1,27 +1,27 @@
|
|
1
|
-
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
|
1
|
+
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
2
3
|
|
3
4
|
module Raas
|
5
|
+
# Represents the request to create an account
|
4
6
|
class CreateAccountRequestModel < BaseModel
|
5
|
-
#
|
7
|
+
# The account identifier
|
6
8
|
# @return [String]
|
7
9
|
attr_accessor :account_identifier
|
8
10
|
|
9
|
-
#
|
11
|
+
# The display name
|
10
12
|
# @return [String]
|
11
13
|
attr_accessor :display_name
|
12
14
|
|
13
|
-
#
|
15
|
+
# The contact email
|
14
16
|
# @return [String]
|
15
17
|
attr_accessor :contact_email
|
16
18
|
|
17
|
-
# A mapping from model property names to API property names
|
19
|
+
# A mapping from model property names to API property names.
|
18
20
|
def self.names
|
19
|
-
if @_hash.nil?
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
@_hash["contact_email"] = "contactEmail"
|
24
|
-
end
|
21
|
+
@_hash = {} if @_hash.nil?
|
22
|
+
@_hash['account_identifier'] = 'accountIdentifier'
|
23
|
+
@_hash['display_name'] = 'displayName'
|
24
|
+
@_hash['contact_email'] = 'contactEmail'
|
25
25
|
@_hash
|
26
26
|
end
|
27
27
|
|
@@ -33,16 +33,16 @@ module Raas
|
|
33
33
|
@contact_email = contact_email
|
34
34
|
end
|
35
35
|
|
36
|
-
# Creates an instance of the object from a hash
|
36
|
+
# Creates an instance of the object from a hash.
|
37
37
|
def self.from_hash(hash)
|
38
38
|
return nil unless hash
|
39
39
|
|
40
|
-
# Extract variables from the hash
|
40
|
+
# Extract variables from the hash.
|
41
41
|
account_identifier = hash['accountIdentifier']
|
42
42
|
display_name = hash['displayName']
|
43
43
|
contact_email = hash['contactEmail']
|
44
44
|
|
45
|
-
# Create object from extracted values
|
45
|
+
# Create object from extracted values.
|
46
46
|
CreateAccountRequestModel.new(account_identifier,
|
47
47
|
display_name,
|
48
48
|
contact_email)
|