tangocard-raas 1.1.2 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- 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,17 +1,17 @@
|
|
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 response returned from the status endpoint
|
4
6
|
class SystemStatusResponseModel < BaseModel
|
5
|
-
#
|
7
|
+
# The status of the system
|
6
8
|
# @return [String]
|
7
9
|
attr_accessor :status
|
8
10
|
|
9
|
-
# A mapping from model property names to API property names
|
11
|
+
# A mapping from model property names to API property names.
|
10
12
|
def self.names
|
11
|
-
if @_hash.nil?
|
12
|
-
|
13
|
-
@_hash["status"] = "status"
|
14
|
-
end
|
13
|
+
@_hash = {} if @_hash.nil?
|
14
|
+
@_hash['status'] = 'status'
|
15
15
|
@_hash
|
16
16
|
end
|
17
17
|
|
@@ -19,14 +19,14 @@ module Raas
|
|
19
19
|
@status = status
|
20
20
|
end
|
21
21
|
|
22
|
-
# Creates an instance of the object from a hash
|
22
|
+
# Creates an instance of the object from a hash.
|
23
23
|
def self.from_hash(hash)
|
24
24
|
return nil unless hash
|
25
25
|
|
26
|
-
# Extract variables from the hash
|
26
|
+
# Extract variables from the hash.
|
27
27
|
status = hash['status']
|
28
28
|
|
29
|
-
# Create object from extracted values
|
29
|
+
# Create object from extracted values.
|
30
30
|
SystemStatusResponseModel.new(status)
|
31
31
|
end
|
32
32
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module Raas
|
5
|
+
# Represents the request to remove a credit card
|
6
|
+
class UnregisterCreditCardRequestModel < BaseModel
|
7
|
+
# The customer identifier
|
8
|
+
# @return [String]
|
9
|
+
attr_accessor :customer_identifier
|
10
|
+
|
11
|
+
# The account identifier
|
12
|
+
# @return [String]
|
13
|
+
attr_accessor :account_identifier
|
14
|
+
|
15
|
+
# The credit card token
|
16
|
+
# @return [String]
|
17
|
+
attr_accessor :credit_card_token
|
18
|
+
|
19
|
+
# A mapping from model property names to API property names.
|
20
|
+
def self.names
|
21
|
+
@_hash = {} if @_hash.nil?
|
22
|
+
@_hash['customer_identifier'] = 'customerIdentifier'
|
23
|
+
@_hash['account_identifier'] = 'accountIdentifier'
|
24
|
+
@_hash['credit_card_token'] = 'creditCardToken'
|
25
|
+
@_hash
|
26
|
+
end
|
27
|
+
|
28
|
+
def initialize(customer_identifier = nil,
|
29
|
+
account_identifier = nil,
|
30
|
+
credit_card_token = nil)
|
31
|
+
@customer_identifier = customer_identifier
|
32
|
+
@account_identifier = account_identifier
|
33
|
+
@credit_card_token = credit_card_token
|
34
|
+
end
|
35
|
+
|
36
|
+
# Creates an instance of the object from a hash.
|
37
|
+
def self.from_hash(hash)
|
38
|
+
return nil unless hash
|
39
|
+
|
40
|
+
# Extract variables from the hash.
|
41
|
+
customer_identifier = hash['customerIdentifier']
|
42
|
+
account_identifier = hash['accountIdentifier']
|
43
|
+
credit_card_token = hash['creditCardToken']
|
44
|
+
|
45
|
+
# Create object from extracted values.
|
46
|
+
UnregisterCreditCardRequestModel.new(customer_identifier,
|
47
|
+
account_identifier,
|
48
|
+
credit_card_token)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
require 'date'
|
5
|
+
module Raas
|
6
|
+
# Represents the response from the unregister credit card call
|
7
|
+
class UnregisterCreditCardResponseModel < BaseModel
|
8
|
+
# The date the card was removed
|
9
|
+
# @return [DateTime]
|
10
|
+
attr_accessor :created_date
|
11
|
+
|
12
|
+
# A message describing the status of the card
|
13
|
+
# @return [String]
|
14
|
+
attr_accessor :message
|
15
|
+
|
16
|
+
# The credit card token
|
17
|
+
# @return [String]
|
18
|
+
attr_accessor :token
|
19
|
+
|
20
|
+
# A mapping from model property names to API property names.
|
21
|
+
def self.names
|
22
|
+
@_hash = {} if @_hash.nil?
|
23
|
+
@_hash['created_date'] = 'createdDate'
|
24
|
+
@_hash['message'] = 'message'
|
25
|
+
@_hash['token'] = 'token'
|
26
|
+
@_hash
|
27
|
+
end
|
28
|
+
|
29
|
+
def initialize(created_date = nil,
|
30
|
+
message = nil,
|
31
|
+
token = nil)
|
32
|
+
@created_date = created_date
|
33
|
+
@message = message
|
34
|
+
@token = token
|
35
|
+
end
|
36
|
+
|
37
|
+
# Creates an instance of the object from a hash.
|
38
|
+
def self.from_hash(hash)
|
39
|
+
return nil unless hash
|
40
|
+
|
41
|
+
# Extract variables from the hash.
|
42
|
+
created_date = APIHelper.rfc3339(hash['createdDate']) if
|
43
|
+
hash['createdDate']
|
44
|
+
message = hash['message']
|
45
|
+
token = hash['token']
|
46
|
+
|
47
|
+
# Create object from extracted values.
|
48
|
+
UnregisterCreditCardResponseModel.new(created_date,
|
49
|
+
message,
|
50
|
+
token)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/lib/raas/raas_client.rb
CHANGED
@@ -1,53 +1,64 @@
|
|
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
|
+
# raas client class.
|
4
6
|
class RaasClient
|
5
|
-
# Singleton access to
|
6
|
-
# @return [
|
7
|
+
# Singleton access to status controller.
|
8
|
+
# @return [StatusController] Returns the controller instance.
|
9
|
+
def status
|
10
|
+
StatusController.instance
|
11
|
+
end
|
12
|
+
|
13
|
+
# Singleton access to accounts controller.
|
14
|
+
# @return [AccountsController] Returns the controller instance.
|
7
15
|
def accounts
|
8
16
|
AccountsController.instance
|
9
17
|
end
|
10
18
|
|
11
|
-
# Singleton access to orders controller
|
12
|
-
# @return [OrdersController] Returns the controller instance
|
19
|
+
# Singleton access to orders controller.
|
20
|
+
# @return [OrdersController] Returns the controller instance.
|
13
21
|
def orders
|
14
22
|
OrdersController.instance
|
15
23
|
end
|
16
24
|
|
17
|
-
# Singleton access to
|
18
|
-
# @return [
|
19
|
-
def
|
20
|
-
|
25
|
+
# Singleton access to fund controller.
|
26
|
+
# @return [FundController] Returns the controller instance.
|
27
|
+
def fund
|
28
|
+
FundController.instance
|
21
29
|
end
|
22
30
|
|
23
|
-
# Singleton access to exchange_rates controller
|
24
|
-
# @return [ExchangeRatesController] Returns the controller instance
|
31
|
+
# Singleton access to exchange_rates controller.
|
32
|
+
# @return [ExchangeRatesController] Returns the controller instance.
|
25
33
|
def exchange_rates
|
26
34
|
ExchangeRatesController.instance
|
27
35
|
end
|
28
36
|
|
29
|
-
# Singleton access to
|
30
|
-
# @return [
|
31
|
-
def status
|
32
|
-
StatusController.instance
|
33
|
-
end
|
34
|
-
|
35
|
-
# Singleton access to customers controller
|
36
|
-
# @return [CustomersController] Returns the controller instance
|
37
|
+
# Singleton access to customers controller.
|
38
|
+
# @return [CustomersController] Returns the controller instance.
|
37
39
|
def customers
|
38
40
|
CustomersController.instance
|
39
41
|
end
|
40
42
|
|
41
|
-
#
|
42
|
-
# @return [
|
43
|
+
# Singleton access to catalog controller.
|
44
|
+
# @return [CatalogController] Returns the controller instance.
|
45
|
+
def catalog
|
46
|
+
CatalogController.instance
|
47
|
+
end
|
48
|
+
|
49
|
+
# Returns the configuration class for easy access.
|
50
|
+
# @return [Configuration] Returns the actual configuration class.
|
43
51
|
def config
|
44
52
|
Configuration
|
45
53
|
end
|
46
54
|
|
47
|
-
# Initializer with authentication and configuration parameters
|
48
|
-
def initialize(platform_name: 'QAPlatform2',
|
49
|
-
|
50
|
-
Configuration.
|
55
|
+
# Initializer with authentication and configuration parameters.
|
56
|
+
def initialize(platform_name: 'QAPlatform2',
|
57
|
+
platform_key: 'apYPfT6HNONpDRUj3CLGWYt7gvIHONpDRUYPfT6Hj')
|
58
|
+
Configuration.platform_name = platform_name if
|
59
|
+
platform_name
|
60
|
+
Configuration.platform_key = platform_key if
|
61
|
+
platform_key
|
51
62
|
end
|
52
63
|
end
|
53
64
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
require 'test/unit'
|
5
|
+
require 'raas.rb'
|
6
|
+
require_relative '../test_helper.rb'
|
7
|
+
require_relative '../http_response_catcher.rb'
|
8
|
+
|
9
|
+
class ControllerTestBase < Test::Unit::TestCase
|
10
|
+
include Raas
|
11
|
+
|
12
|
+
class << self
|
13
|
+
attr_accessor :controller
|
14
|
+
end
|
15
|
+
|
16
|
+
# Called only once for a test class before any test has executed.
|
17
|
+
def self.startup
|
18
|
+
@@api_client = RaasClient.new
|
19
|
+
@@request_timeout = 30
|
20
|
+
@@assert_precision = 0.01
|
21
|
+
|
22
|
+
# Set Configuration parameters for test execution
|
23
|
+
Configuration.environment = Configuration::Environment::SANDBOX
|
24
|
+
end
|
25
|
+
|
26
|
+
# Called once before every test case.
|
27
|
+
def setup
|
28
|
+
@response_catcher = HttpResponseCatcher.new
|
29
|
+
self.class.controller.http_call_back = @response_catcher
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
|
2
|
+
|
3
|
+
require_relative 'controller_test_base'
|
4
|
+
|
5
|
+
class AccountsControllerTests < ControllerTestBase
|
6
|
+
# Called only once for the class before any test has executed
|
7
|
+
def self.startup
|
8
|
+
self.controller = @@api_client.accounts
|
9
|
+
end
|
10
|
+
|
11
|
+
# Tests retrieving all accounts under a specific customer
|
12
|
+
def test_test_get_all_customer_accounts()
|
13
|
+
# Parameters for the API call
|
14
|
+
customer_identifier = 'sdkautotest1'
|
15
|
+
|
16
|
+
# Perform the API call through the SDK function
|
17
|
+
result = self.class.controller.get_accounts_by_customer(customer_identifier)
|
18
|
+
|
19
|
+
# Test response code
|
20
|
+
assert_equal(@response_catcher.response.status_code, 200)
|
21
|
+
|
22
|
+
# Test whether the captured response is as we expected
|
23
|
+
assert_not_nil(result)
|
24
|
+
expected_body = JSON.parse(
|
25
|
+
'[{"accountIdentifier":"sdkautotest3","accountNumber":"A01335766","displayN'\
|
26
|
+
'ame":"SDK Auto Testing 3","createdAt":"2018-04-26T18:16:51.652Z","status":"'\
|
27
|
+
'ACTIVE"},{"accountIdentifier":"sdkautotest2","accountNumber":"A11720237","d'\
|
28
|
+
'isplayName":"SDK Auto Testing 2","createdAt":"2018-04-26T18:13:45.196Z","st'\
|
29
|
+
'atus":"ACTIVE"}]'
|
30
|
+
)
|
31
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
32
|
+
assert(TestHelper.match_body(expected_body, received_body, check_values: true))
|
33
|
+
end
|
34
|
+
|
35
|
+
# Tests retrieving all accounts
|
36
|
+
def test_test_get_all_accounts()
|
37
|
+
|
38
|
+
# Perform the API call through the SDK function
|
39
|
+
result = self.class.controller.get_all_accounts()
|
40
|
+
|
41
|
+
# Test response code
|
42
|
+
assert_equal(@response_catcher.response.status_code, 200)
|
43
|
+
|
44
|
+
# Test whether the captured response is as we expected
|
45
|
+
assert_not_nil(result)
|
46
|
+
expected_body = JSON.parse(
|
47
|
+
'[{"accountIdentifier":"sdkautotest2","accountNumber":"A11720237","displayN'\
|
48
|
+
'ame":"SDK Auto Testing 2","currencyCode":"USD","currentBalance":0,"createdA'\
|
49
|
+
't":"2018-04-26T18:13:45.196Z","status":"ACTIVE","contactEmail":"test@exampl'\
|
50
|
+
'e.com"}]'
|
51
|
+
)
|
52
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
53
|
+
assert(TestHelper.match_body(expected_body, received_body, check_values: true))
|
54
|
+
end
|
55
|
+
|
56
|
+
# Tests retrieving a single account
|
57
|
+
def test_test_get_single_account()
|
58
|
+
# Parameters for the API call
|
59
|
+
account_identifier = 'sdkautotest2'
|
60
|
+
|
61
|
+
# Perform the API call through the SDK function
|
62
|
+
result = self.class.controller.get_account(account_identifier)
|
63
|
+
|
64
|
+
# Test response code
|
65
|
+
assert_equal(@response_catcher.response.status_code, 200)
|
66
|
+
|
67
|
+
# Test whether the captured response is as we expected
|
68
|
+
assert_not_nil(result)
|
69
|
+
expected_body = JSON.parse(
|
70
|
+
'{"accountIdentifier":"sdkautotest2","accountNumber":"A11720237","displayNa'\
|
71
|
+
'me":"SDK Auto Testing 2","currencyCode":"USD","currentBalance":0,"createdAt'\
|
72
|
+
'":"2018-04-26T18:13:45.196Z","status":"ACTIVE","contactEmail":"test@example'\
|
73
|
+
'.com"}'
|
74
|
+
)
|
75
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
76
|
+
assert(TestHelper.match_body(expected_body, received_body, check_values: true))
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
|
2
|
+
|
3
|
+
require_relative 'controller_test_base'
|
4
|
+
|
5
|
+
class CatalogControllerTests < ControllerTestBase
|
6
|
+
# Called only once for the class before any test has executed
|
7
|
+
def self.startup
|
8
|
+
self.controller = @@api_client.catalog
|
9
|
+
end
|
10
|
+
|
11
|
+
# Tests if we can successfully retrieve a platform's catalog
|
12
|
+
def test_test_retrieve_catalog()
|
13
|
+
|
14
|
+
# Perform the API call through the SDK function
|
15
|
+
result = self.class.controller.get_catalog()
|
16
|
+
|
17
|
+
# Test response code
|
18
|
+
assert_equal(@response_catcher.response.status_code, 200)
|
19
|
+
|
20
|
+
# Test whether the captured response is as we expected
|
21
|
+
assert_not_nil(result)
|
22
|
+
expected_body = JSON.parse(
|
23
|
+
'{"catalogName":"TestCatalog","brands":[{"brandKey":"B916708","brandName":"'\
|
24
|
+
'Amazon.com","disclaimer":"disclaimer","description":"desc","shortDescriptio'\
|
25
|
+
'n":"short desc","terms":"terms","createdDate":"2016-06-17T16:52:24Z","lastU'\
|
26
|
+
'pdateDate":"2017-10-23T22:18:51Z","imageUrls":{"80w-326ppi":"https://d30s7y'\
|
27
|
+
'zk2az89n.cloudfront.net/images/brands/b916708-80w-326ppi.png","130w-326ppi"'\
|
28
|
+
':"https://d30s7yzk2az89n.cloudfront.net/images/brands/b916708-130w-326ppi.p'\
|
29
|
+
'ng","200w-326ppi":"https://d30s7yzk2az89n.cloudfront.net/images/brands/b916'\
|
30
|
+
'708-200w-326ppi.png","278w-326ppi":"https://d30s7yzk2az89n.cloudfront.net/i'\
|
31
|
+
'mages/brands/b916708-278w-326ppi.png","300w-326ppi":"https://d30s7yzk2az89n'\
|
32
|
+
'.cloudfront.net/images/brands/b916708-300w-326ppi.png","1200w-326ppi":"http'\
|
33
|
+
's://d30s7yzk2az89n.cloudfront.net/images/brands/b916708-1200w-326ppi.png"},'\
|
34
|
+
'"status":"active","items":[{"utid":"U666425","rewardName":"Amazon.com Gift '\
|
35
|
+
'Card","currencyCode":"USD","status":"active","valueType":"VARIABLE_VALUE","'\
|
36
|
+
'rewardType":"gift card","minValue":0.01,"maxValue":2000,"createdDate":"2016'\
|
37
|
+
'-06-17T17:38:45.294Z","lastUpdateDate":"2017-12-15T01:27:49.607Z","countrie'\
|
38
|
+
's":["US"]}]},{"brandKey":"B725361","brandName":"AMC Theatres®","disclaimer"'\
|
39
|
+
':"discl","description":"desc","shortDescription":"short desc","terms":"term'\
|
40
|
+
's","createdDate":"2016-06-23T21:53:45Z","lastUpdateDate":"2016-07-25T22:41:'\
|
41
|
+
'11Z","imageUrls":{"80w-326ppi":"https://d30s7yzk2az89n.cloudfront.net/image'\
|
42
|
+
's/brands/b725361-80w-326ppi.png","130w-326ppi":"https://d30s7yzk2az89n.clou'\
|
43
|
+
'dfront.net/images/brands/b725361-130w-326ppi.png","200w-326ppi":"https://d3'\
|
44
|
+
'0s7yzk2az89n.cloudfront.net/images/brands/b725361-200w-326ppi.png","278w-32'\
|
45
|
+
'6ppi":"https://d30s7yzk2az89n.cloudfront.net/images/brands/b725361-278w-326'\
|
46
|
+
'ppi.png","300w-326ppi":"https://d30s7yzk2az89n.cloudfront.net/images/brands'\
|
47
|
+
'/b725361-300w-326ppi.png","1200w-326ppi":"https://d30s7yzk2az89n.cloudfront'\
|
48
|
+
'.net/images/brands/b725361-1200w-326ppi.png"},"status":"active","items":[{"'\
|
49
|
+
'utid":"U154092","rewardName":"AMC® Gift Card $10.00","currencyCode":"USD","'\
|
50
|
+
'status":"active","valueType":"FIXED_VALUE","rewardType":"gift card","faceVa'\
|
51
|
+
'lue":10,"createdDate":"2016-07-27T02:54:30.142Z","lastUpdateDate":"2016-09-'\
|
52
|
+
'21T20:59:01.874Z","countries":["US"]},{"utid":"U913336","rewardName":"AMC® '\
|
53
|
+
'Gift Card $25.00","currencyCode":"USD","status":"active","valueType":"FIXED'\
|
54
|
+
'_VALUE","rewardType":"gift card","faceValue":25,"createdDate":"2016-07-27T0'\
|
55
|
+
'2:55:37.899Z","lastUpdateDate":"2016-10-17T20:55:00.386Z","countries":["US"'\
|
56
|
+
']},{"utid":"U652361","rewardName":"AMC® Gift Card $50.00","currencyCode":"U'\
|
57
|
+
'SD","status":"active","valueType":"FIXED_VALUE","rewardType":"gift card","f'\
|
58
|
+
'aceValue":50,"createdDate":"2016-07-27T02:56:53.391Z","lastUpdateDate":"201'\
|
59
|
+
'6-09-21T20:59:16.283Z","countries":["US"]}]}]}'
|
60
|
+
)
|
61
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
62
|
+
assert(TestHelper.match_body(expected_body, received_body))
|
63
|
+
end
|
64
|
+
|
65
|
+
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_relative 'controller_test_base'
|
4
|
+
|
5
|
+
class CustomersControllerTests < ControllerTestBase
|
6
|
+
# Called only once for the class before any test has executed
|
7
|
+
def self.startup
|
8
|
+
self.controller = @@api_client.customers
|
9
|
+
end
|
10
|
+
|
11
|
+
# Tests retrieving all customers
|
12
|
+
def test_test_get_all_customers()
|
13
|
+
|
14
|
+
# Perform the API call through the SDK function
|
15
|
+
result = self.class.controller.get_all_customers()
|
16
|
+
|
17
|
+
# Test response code
|
18
|
+
assert_equal(@response_catcher.response.status_code, 200)
|
19
|
+
|
20
|
+
# Test whether the captured response is as we expected
|
21
|
+
assert_not_nil(result)
|
22
|
+
expected_body = JSON.parse(
|
23
|
+
'[{"customerIdentifier":"sdkautotest1","displayName":"SDK Auto Testing 1","'\
|
24
|
+
'status":"active","createdAt":"2018-04-26T18:13:12.874Z","accounts":[{"accou'\
|
25
|
+
'ntIdentifier":"sdkautotest3","accountNumber":"A01335766","displayName":"SDK'\
|
26
|
+
' Auto Testing 3","createdAt":"2018-04-26T18:16:51.652Z","status":"ACTIVE"},'\
|
27
|
+
'{"accountIdentifier":"sdkautotest2","accountNumber":"A11720237","displayNam'\
|
28
|
+
'e":"SDK Auto Testing 2","createdAt":"2018-04-26T18:13:45.196Z","status":"AC'\
|
29
|
+
'TIVE"}]}]'
|
30
|
+
)
|
31
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
32
|
+
assert(TestHelper.match_body(expected_body, received_body, check_values: true))
|
33
|
+
end
|
34
|
+
|
35
|
+
# Tests retrieving a single customer
|
36
|
+
def test_test_get_customer()
|
37
|
+
# Parameters for the API call
|
38
|
+
customer_identifier = 'sdkautotest1'
|
39
|
+
|
40
|
+
# Perform the API call through the SDK function
|
41
|
+
result = self.class.controller.get_customer(customer_identifier)
|
42
|
+
|
43
|
+
# Test response code
|
44
|
+
assert_equal(@response_catcher.response.status_code, 200)
|
45
|
+
|
46
|
+
# Test whether the captured response is as we expected
|
47
|
+
assert_not_nil(result)
|
48
|
+
expected_body = JSON.parse(
|
49
|
+
'{"customerIdentifier":"sdkautotest1","displayName":"SDK Auto Testing 1","s'\
|
50
|
+
'tatus":"active","createdAt":"2018-04-26T18:13:12.874Z","accounts":[{"accoun'\
|
51
|
+
'tIdentifier":"sdkautotest3","accountNumber":"A01335766","displayName":"SDK '\
|
52
|
+
'Auto Testing 3","createdAt":"2018-04-26T18:16:51.652Z","status":"ACTIVE"},{'\
|
53
|
+
'"accountIdentifier":"sdkautotest2","accountNumber":"A11720237","displayName'\
|
54
|
+
'":"SDK Auto Testing 2","createdAt":"2018-04-26T18:13:45.196Z","status":"ACT'\
|
55
|
+
'IVE"}]}'
|
56
|
+
)
|
57
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
58
|
+
assert(TestHelper.match_body(expected_body, received_body, check_values: true))
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|