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.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +28 -175
  3. data/README.md +38 -525
  4. data/lib/raas.rb +32 -19
  5. data/lib/raas/api_helper.rb +146 -54
  6. data/lib/raas/configuration.rb +22 -30
  7. data/lib/raas/controllers/accounts_controller.rb +146 -92
  8. data/lib/raas/controllers/base_controller.rb +32 -29
  9. data/lib/raas/controllers/catalog_controller.rb +31 -14
  10. data/lib/raas/controllers/customers_controller.rb +113 -72
  11. data/lib/raas/controllers/exchange_rates_controller.rb +40 -12
  12. data/lib/raas/controllers/fund_controller.rb +345 -0
  13. data/lib/raas/controllers/orders_controller.rb +166 -105
  14. data/lib/raas/controllers/status_controller.rb +31 -14
  15. data/lib/raas/exceptions/api_exception.rb +4 -2
  16. data/lib/raas/exceptions/raas_client_exception.rb +14 -12
  17. data/lib/raas/exceptions/raas_generic_exception.rb +9 -9
  18. data/lib/raas/exceptions/raas_server_exception.rb +14 -12
  19. data/lib/raas/http/auth/basic_auth.rb +7 -4
  20. data/lib/raas/http/faraday_client.rb +19 -7
  21. data/lib/raas/http/http_call_back.rb +11 -6
  22. data/lib/raas/http/http_client.rb +50 -32
  23. data/lib/raas/http/http_context.rb +5 -2
  24. data/lib/raas/http/http_method_enum.rb +6 -2
  25. data/lib/raas/http/http_request.rb +7 -3
  26. data/lib/raas/http/http_response.rb +3 -1
  27. data/lib/raas/models/account_model.rb +32 -23
  28. data/lib/raas/models/account_summary_model.rb +26 -17
  29. data/lib/raas/models/base_model.rb +11 -9
  30. data/lib/raas/models/billing_address_model.rb +105 -0
  31. data/lib/raas/models/brand_model.rb +39 -35
  32. data/lib/raas/models/catalog_model.rb +15 -13
  33. data/lib/raas/models/create_account_request_model.rb +14 -14
  34. data/lib/raas/models/create_credit_card_request_model.rb +96 -0
  35. data/lib/raas/models/create_customer_request_model.rb +12 -12
  36. data/lib/raas/models/create_order_request_model.rb +45 -35
  37. data/lib/raas/models/credit_card_model.rb +124 -0
  38. data/lib/raas/models/currency_breakdown_model.rb +18 -18
  39. data/lib/raas/models/customer_model.rb +24 -22
  40. data/lib/raas/models/deposit_request_model.rb +60 -0
  41. data/lib/raas/models/deposit_response_model.rb +80 -0
  42. data/lib/raas/models/exchange_rate_model.rb +18 -17
  43. data/lib/raas/models/exchange_rate_response_model.rb +17 -15
  44. data/lib/raas/models/full_name_email_model.rb +42 -0
  45. data/lib/raas/models/get_deposit_response_model.rb +80 -0
  46. data/lib/raas/models/get_orders_response_model.rb +16 -14
  47. data/lib/raas/models/item_model.rb +36 -34
  48. data/lib/raas/models/name_email_model.rb +14 -14
  49. data/lib/raas/models/new_credit_card_model.rb +51 -0
  50. data/lib/raas/models/order_model.rb +124 -92
  51. data/lib/raas/models/order_summary_model.rb +155 -0
  52. data/lib/raas/models/page_model.rb +16 -16
  53. data/lib/raas/models/raas_client_error_model.rb +16 -16
  54. data/lib/raas/models/raas_server_error_model.rb +12 -12
  55. data/lib/raas/models/resend_order_response_model.rb +11 -11
  56. data/lib/raas/models/reward_credential_model.rb +14 -14
  57. data/lib/raas/models/reward_model.rb +16 -14
  58. data/lib/raas/models/system_status_response_model.rb +10 -10
  59. data/lib/raas/models/unregister_credit_card_request_model.rb +51 -0
  60. data/lib/raas/models/unregister_credit_card_response_model.rb +53 -0
  61. data/lib/raas/raas_client.rb +36 -25
  62. data/test/controllers/controller_test_base.rb +31 -0
  63. data/test/controllers/test_accounts_controller.rb +79 -0
  64. data/test/controllers/test_catalog_controller.rb +65 -0
  65. data/test/controllers/test_customers_controller.rb +61 -0
  66. data/test/controllers/test_exchange_rates_controller.rb +35 -0
  67. data/test/controllers/test_fund_controller.rb +108 -0
  68. data/test/controllers/test_orders_controller.rb +86 -0
  69. data/test/controllers/test_status_controller.rb +27 -0
  70. data/test/http_response_catcher.rb +16 -0
  71. data/test/test_helper.rb +91 -0
  72. metadata +32 -10
@@ -0,0 +1,96 @@
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 register a credit card
6
+ class CreateCreditCardRequestModel < 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's label/nickname
16
+ # @return [String]
17
+ attr_accessor :label
18
+
19
+ # The IP address of the user registering the card
20
+ # @return [String]
21
+ attr_accessor :ip_address
22
+
23
+ # A NewCreditCard object
24
+ # @return [NewCreditCardModel]
25
+ attr_accessor :credit_card
26
+
27
+ # A BillingAddress object
28
+ # @return [BillingAddressModel]
29
+ attr_accessor :billing_address
30
+
31
+ # An optional array of FullNameEmail objects
32
+ # @return [List of FullNameEmailModel]
33
+ attr_accessor :contact_information
34
+
35
+ # A mapping from model property names to API property names.
36
+ def self.names
37
+ @_hash = {} if @_hash.nil?
38
+ @_hash['customer_identifier'] = 'customerIdentifier'
39
+ @_hash['account_identifier'] = 'accountIdentifier'
40
+ @_hash['label'] = 'label'
41
+ @_hash['ip_address'] = 'ipAddress'
42
+ @_hash['credit_card'] = 'creditCard'
43
+ @_hash['billing_address'] = 'billingAddress'
44
+ @_hash['contact_information'] = 'contactInformation'
45
+ @_hash
46
+ end
47
+
48
+ def initialize(customer_identifier = nil,
49
+ account_identifier = nil,
50
+ label = nil,
51
+ ip_address = nil,
52
+ credit_card = nil,
53
+ billing_address = nil,
54
+ contact_information = nil)
55
+ @customer_identifier = customer_identifier
56
+ @account_identifier = account_identifier
57
+ @label = label
58
+ @ip_address = ip_address
59
+ @credit_card = credit_card
60
+ @billing_address = billing_address
61
+ @contact_information = contact_information
62
+ end
63
+
64
+ # Creates an instance of the object from a hash.
65
+ def self.from_hash(hash)
66
+ return nil unless hash
67
+
68
+ # Extract variables from the hash.
69
+ customer_identifier = hash['customerIdentifier']
70
+ account_identifier = hash['accountIdentifier']
71
+ label = hash['label']
72
+ ip_address = hash['ipAddress']
73
+ credit_card = NewCreditCardModel.from_hash(hash['creditCard']) if
74
+ hash['creditCard']
75
+ billing_address = BillingAddressModel.from_hash(hash['billingAddress']) if
76
+ hash['billingAddress']
77
+ # Parameter is an array, so we need to iterate through it
78
+ contact_information = nil
79
+ unless hash['contactInformation'].nil?
80
+ contact_information = []
81
+ hash['contactInformation'].each do |structure|
82
+ contact_information << (FullNameEmailModel.from_hash(structure) if structure)
83
+ end
84
+ end
85
+
86
+ # Create object from extracted values.
87
+ CreateCreditCardRequestModel.new(customer_identifier,
88
+ account_identifier,
89
+ label,
90
+ ip_address,
91
+ credit_card,
92
+ billing_address,
93
+ contact_information)
94
+ end
95
+ end
96
+ end
@@ -1,22 +1,22 @@
1
- # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
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 a customer
4
6
  class CreateCustomerRequestModel < BaseModel
5
- # Customer Identifier
7
+ # The customer identifier
6
8
  # @return [String]
7
9
  attr_accessor :customer_identifier
8
10
 
9
- # Display Name
11
+ # The display name
10
12
  # @return [String]
11
13
  attr_accessor :display_name
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
- @_hash = {}
17
- @_hash["customer_identifier"] = "customerIdentifier"
18
- @_hash["display_name"] = "displayName"
19
- end
17
+ @_hash = {} if @_hash.nil?
18
+ @_hash['customer_identifier'] = 'customerIdentifier'
19
+ @_hash['display_name'] = 'displayName'
20
20
  @_hash
21
21
  end
22
22
 
@@ -26,15 +26,15 @@ module Raas
26
26
  @display_name = display_name
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
  customer_identifier = hash['customerIdentifier']
35
35
  display_name = hash['displayName']
36
36
 
37
- # Create object from extracted values
37
+ # Create object from extracted values.
38
38
  CreateCustomerRequestModel.new(customer_identifier,
39
39
  display_name)
40
40
  end
@@ -1,72 +1,77 @@
1
- # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
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 place an order
4
6
  class CreateOrderRequestModel < BaseModel
5
- # Account Identifier
7
+ # The account identifier
6
8
  # @return [String]
7
9
  attr_accessor :account_identifier
8
10
 
9
- # Amount
11
+ # The order amount
10
12
  # @return [Float]
11
13
  attr_accessor :amount
12
14
 
13
- # Customer Identifier
15
+ # The customer identifier
14
16
  # @return [String]
15
17
  attr_accessor :customer_identifier
16
18
 
17
- # Send Email
19
+ # Indicates whether we should deliver this reward via email
18
20
  # @return [Boolean]
19
21
  attr_accessor :send_email
20
22
 
21
- # UTID
23
+ # The UTID
22
24
  # @return [String]
23
25
  attr_accessor :utid
24
26
 
25
- # Campaign
27
+ # An optional campaign identifier
26
28
  # @return [String]
27
29
  attr_accessor :campaign
28
30
 
29
- # Email Subject
31
+ # The subject of the gift email
30
32
  # @return [String]
31
33
  attr_accessor :email_subject
32
34
 
33
- # External Reference ID
35
+ # An optional external reference id
34
36
  # @return [String]
35
37
  attr_accessor :external_ref_id
36
38
 
37
- # Email Message
39
+ # The gift message in the email
38
40
  # @return [String]
39
41
  attr_accessor :message
40
42
 
41
- # Recipient
43
+ # The recipient's information
42
44
  # @return [NameEmailModel]
43
45
  attr_accessor :recipient
44
46
 
45
- # Sender
47
+ # Optional sender information
46
48
  # @return [NameEmailModel]
47
49
  attr_accessor :sender
48
50
 
49
- # Notes
51
+ # Optional notes (not displayed to customer)
50
52
  # @return [String]
51
53
  attr_accessor :notes
52
54
 
53
- # A mapping from model property names to API property names
55
+ # The email template identifier
56
+ # @return [String]
57
+ attr_accessor :etid
58
+
59
+ # A mapping from model property names to API property names.
54
60
  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
61
+ @_hash = {} if @_hash.nil?
62
+ @_hash['account_identifier'] = 'accountIdentifier'
63
+ @_hash['amount'] = 'amount'
64
+ @_hash['customer_identifier'] = 'customerIdentifier'
65
+ @_hash['send_email'] = 'sendEmail'
66
+ @_hash['utid'] = 'utid'
67
+ @_hash['campaign'] = 'campaign'
68
+ @_hash['email_subject'] = 'emailSubject'
69
+ @_hash['external_ref_id'] = 'externalRefID'
70
+ @_hash['message'] = 'message'
71
+ @_hash['recipient'] = 'recipient'
72
+ @_hash['sender'] = 'sender'
73
+ @_hash['notes'] = 'notes'
74
+ @_hash['etid'] = 'etid'
70
75
  @_hash
71
76
  end
72
77
 
@@ -81,7 +86,8 @@ module Raas
81
86
  message = nil,
82
87
  recipient = nil,
83
88
  sender = nil,
84
- notes = nil)
89
+ notes = nil,
90
+ etid = nil)
85
91
  @account_identifier = account_identifier
86
92
  @amount = amount
87
93
  @customer_identifier = customer_identifier
@@ -94,13 +100,14 @@ module Raas
94
100
  @recipient = recipient
95
101
  @sender = sender
96
102
  @notes = notes
103
+ @etid = etid
97
104
  end
98
105
 
99
- # Creates an instance of the object from a hash
106
+ # Creates an instance of the object from a hash.
100
107
  def self.from_hash(hash)
101
108
  return nil unless hash
102
109
 
103
- # Extract variables from the hash
110
+ # Extract variables from the hash.
104
111
  account_identifier = hash['accountIdentifier']
105
112
  amount = hash['amount']
106
113
  customer_identifier = hash['customerIdentifier']
@@ -110,11 +117,13 @@ module Raas
110
117
  email_subject = hash['emailSubject']
111
118
  external_ref_id = hash['externalRefID']
112
119
  message = hash['message']
113
- recipient = NameEmailModel.from_hash(hash['recipient']) if hash['recipient']
120
+ recipient = NameEmailModel.from_hash(hash['recipient']) if
121
+ hash['recipient']
114
122
  sender = NameEmailModel.from_hash(hash['sender']) if hash['sender']
115
123
  notes = hash['notes']
124
+ etid = hash['etid']
116
125
 
117
- # Create object from extracted values
126
+ # Create object from extracted values.
118
127
  CreateOrderRequestModel.new(account_identifier,
119
128
  amount,
120
129
  customer_identifier,
@@ -126,7 +135,8 @@ module Raas
126
135
  message,
127
136
  recipient,
128
137
  sender,
129
- notes)
138
+ notes,
139
+ etid)
130
140
  end
131
141
  end
132
142
  end
@@ -0,0 +1,124 @@
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 a Credit Card
7
+ class CreditCardModel < BaseModel
8
+ # The customer identifier
9
+ # @return [String]
10
+ attr_accessor :customer_identifier
11
+
12
+ # The account identifier
13
+ # @return [String]
14
+ attr_accessor :account_identifier
15
+
16
+ # The credit card token
17
+ # @return [String]
18
+ attr_accessor :token
19
+
20
+ # The label/nickname for the credit card
21
+ # @return [String]
22
+ attr_accessor :label
23
+
24
+ # The last four digits of the credit card number
25
+ # @return [String]
26
+ attr_accessor :last_four_digits
27
+
28
+ # The credit card's expiration date
29
+ # @return [String]
30
+ attr_accessor :expiration_date
31
+
32
+ # The status of the credit card
33
+ # @return [String]
34
+ attr_accessor :status
35
+
36
+ # The date the card was added
37
+ # @return [DateTime]
38
+ attr_accessor :created_date
39
+
40
+ # The date the card will be available for use
41
+ # @return [DateTime]
42
+ attr_accessor :activation_date
43
+
44
+ # An optional array of FullNameEmail objects
45
+ # @return [List of FullNameEmailModel]
46
+ attr_accessor :contact_information
47
+
48
+ # A mapping from model property names to API property names.
49
+ def self.names
50
+ @_hash = {} if @_hash.nil?
51
+ @_hash['customer_identifier'] = 'customerIdentifier'
52
+ @_hash['account_identifier'] = 'accountIdentifier'
53
+ @_hash['token'] = 'token'
54
+ @_hash['label'] = 'label'
55
+ @_hash['last_four_digits'] = 'lastFourDigits'
56
+ @_hash['expiration_date'] = 'expirationDate'
57
+ @_hash['status'] = 'status'
58
+ @_hash['created_date'] = 'createdDate'
59
+ @_hash['activation_date'] = 'activationDate'
60
+ @_hash['contact_information'] = 'contactInformation'
61
+ @_hash
62
+ end
63
+
64
+ def initialize(customer_identifier = nil,
65
+ account_identifier = nil,
66
+ token = nil,
67
+ label = nil,
68
+ last_four_digits = nil,
69
+ expiration_date = nil,
70
+ status = nil,
71
+ created_date = nil,
72
+ activation_date = nil,
73
+ contact_information = nil)
74
+ @customer_identifier = customer_identifier
75
+ @account_identifier = account_identifier
76
+ @token = token
77
+ @label = label
78
+ @last_four_digits = last_four_digits
79
+ @expiration_date = expiration_date
80
+ @status = status
81
+ @created_date = created_date
82
+ @activation_date = activation_date
83
+ @contact_information = contact_information
84
+ end
85
+
86
+ # Creates an instance of the object from a hash.
87
+ def self.from_hash(hash)
88
+ return nil unless hash
89
+
90
+ # Extract variables from the hash.
91
+ customer_identifier = hash['customerIdentifier']
92
+ account_identifier = hash['accountIdentifier']
93
+ token = hash['token']
94
+ label = hash['label']
95
+ last_four_digits = hash['lastFourDigits']
96
+ expiration_date = hash['expirationDate']
97
+ status = hash['status']
98
+ created_date = APIHelper.rfc3339(hash['createdDate']) if
99
+ hash['createdDate']
100
+ activation_date = APIHelper.rfc3339(hash['activationDate']) if
101
+ hash['activationDate']
102
+ # Parameter is an array, so we need to iterate through it
103
+ contact_information = nil
104
+ unless hash['contactInformation'].nil?
105
+ contact_information = []
106
+ hash['contactInformation'].each do |structure|
107
+ contact_information << (FullNameEmailModel.from_hash(structure) if structure)
108
+ end
109
+ end
110
+
111
+ # Create object from extracted values.
112
+ CreditCardModel.new(customer_identifier,
113
+ account_identifier,
114
+ token,
115
+ label,
116
+ last_four_digits,
117
+ expiration_date,
118
+ status,
119
+ created_date,
120
+ activation_date,
121
+ contact_information)
122
+ end
123
+ end
124
+ end
@@ -1,37 +1,37 @@
1
- # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
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 breakdown of an amount and currency information
4
6
  class CurrencyBreakdownModel < BaseModel
5
- # Currency Code
7
+ # A 3 digit currency code
6
8
  # @return [String]
7
9
  attr_accessor :currency_code
8
10
 
9
- # Exchange Rate
11
+ # The exchange rate
10
12
  # @return [Float]
11
13
  attr_accessor :exchange_rate
12
14
 
13
- # Fee
15
+ # The amount of the fee applied
14
16
  # @return [Float]
15
17
  attr_accessor :fee
16
18
 
17
- # Total
19
+ # The order total
18
20
  # @return [Float]
19
21
  attr_accessor :total
20
22
 
21
- # Value
23
+ # The value of the order
22
24
  # @return [Float]
23
25
  attr_accessor :value
24
26
 
25
- # A mapping from model property names to API property names
27
+ # A mapping from model property names to API property names.
26
28
  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
29
+ @_hash = {} if @_hash.nil?
30
+ @_hash['currency_code'] = 'currencyCode'
31
+ @_hash['exchange_rate'] = 'exchangeRate'
32
+ @_hash['fee'] = 'fee'
33
+ @_hash['total'] = 'total'
34
+ @_hash['value'] = 'value'
35
35
  @_hash
36
36
  end
37
37
 
@@ -47,18 +47,18 @@ module Raas
47
47
  @value = value
48
48
  end
49
49
 
50
- # Creates an instance of the object from a hash
50
+ # Creates an instance of the object from a hash.
51
51
  def self.from_hash(hash)
52
52
  return nil unless hash
53
53
 
54
- # Extract variables from the hash
54
+ # Extract variables from the hash.
55
55
  currency_code = hash['currencyCode']
56
56
  exchange_rate = hash['exchangeRate']
57
57
  fee = hash['fee']
58
58
  total = hash['total']
59
59
  value = hash['value']
60
60
 
61
- # Create object from extracted values
61
+ # Create object from extracted values.
62
62
  CurrencyBreakdownModel.new(currency_code,
63
63
  exchange_rate,
64
64
  fee,