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.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +175 -0
  3. data/README.md +542 -0
  4. data/lib/raas.rb +61 -0
  5. data/lib/raas/api_helper.rb +181 -0
  6. data/lib/raas/configuration.rb +72 -0
  7. data/lib/raas/controllers/accounts_controller.rb +189 -0
  8. data/lib/raas/controllers/base_controller.rb +68 -0
  9. data/lib/raas/controllers/catalog_controller.rb +47 -0
  10. data/lib/raas/controllers/customers_controller.rb +137 -0
  11. data/lib/raas/controllers/exchange_rates_controller.rb +36 -0
  12. data/lib/raas/controllers/orders_controller.rb +199 -0
  13. data/lib/raas/controllers/status_controller.rb +46 -0
  14. data/lib/raas/exceptions/api_exception.rb +16 -0
  15. data/lib/raas/exceptions/raas_client_exception.rb +58 -0
  16. data/lib/raas/exceptions/raas_generic_exception.rb +53 -0
  17. data/lib/raas/exceptions/raas_server_exception.rb +58 -0
  18. data/lib/raas/http/auth/basic_auth.rb +17 -0
  19. data/lib/raas/http/faraday_client.rb +43 -0
  20. data/lib/raas/http/http_call_back.rb +17 -0
  21. data/lib/raas/http/http_client.rb +84 -0
  22. data/lib/raas/http/http_context.rb +15 -0
  23. data/lib/raas/http/http_method_enum.rb +7 -0
  24. data/lib/raas/http/http_request.rb +44 -0
  25. data/lib/raas/http/http_response.rb +19 -0
  26. data/lib/raas/models/account_model.rb +88 -0
  27. data/lib/raas/models/account_summary_model.rb +61 -0
  28. data/lib/raas/models/base_model.rb +32 -0
  29. data/lib/raas/models/brand_model.rb +129 -0
  30. data/lib/raas/models/catalog_model.rb +47 -0
  31. data/lib/raas/models/create_account_request_model.rb +51 -0
  32. data/lib/raas/models/create_customer_request_model.rb +42 -0
  33. data/lib/raas/models/create_order_request_model.rb +132 -0
  34. data/lib/raas/models/currency_breakdown_model.rb +69 -0
  35. data/lib/raas/models/customer_model.rb +75 -0
  36. data/lib/raas/models/exchange_rate_model.rb +61 -0
  37. data/lib/raas/models/exchange_rate_response_model.rb +47 -0
  38. data/lib/raas/models/get_orders_response_model.rb +47 -0
  39. data/lib/raas/models/item_model.rb +133 -0
  40. data/lib/raas/models/name_email_model.rb +51 -0
  41. data/lib/raas/models/order_model.rb +187 -0
  42. data/lib/raas/models/page_model.rb +60 -0
  43. data/lib/raas/models/raas_client_error_model.rb +60 -0
  44. data/lib/raas/models/raas_server_error_model.rb +42 -0
  45. data/lib/raas/models/resend_order_response_model.rb +43 -0
  46. data/lib/raas/models/reward_credential_model.rb +51 -0
  47. data/lib/raas/models/reward_model.rb +56 -0
  48. data/lib/raas/models/system_status_response_model.rb +33 -0
  49. data/lib/raas/raas_client.rb +53 -0
  50. metadata +175 -0
@@ -0,0 +1,19 @@
1
+ # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module Raas
4
+ class HttpResponse
5
+ attr_accessor :status_code, :headers, :raw_body
6
+
7
+ # The constructor
8
+ # @param [Integer] The status code returned by the server.
9
+ # @param [Hash] The headers sent by the server in the response.
10
+ # @param [String] The raw body of the response.
11
+ def initialize(status_code,
12
+ headers,
13
+ raw_body)
14
+ @status_code = status_code
15
+ @headers = headers
16
+ @raw_body = raw_body
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,88 @@
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 AccountModel < BaseModel
6
+ # Account Identifier
7
+ # @return [String]
8
+ attr_accessor :account_identifier
9
+
10
+ # Display Name
11
+ # @return [String]
12
+ attr_accessor :display_name
13
+
14
+ # Currency Code
15
+ # @return [String]
16
+ attr_accessor :currency_code
17
+
18
+ # Current Balance
19
+ # @return [Float]
20
+ attr_accessor :current_balance
21
+
22
+ # Date Created
23
+ # @return [DateTime]
24
+ attr_accessor :created_at
25
+
26
+ # Status
27
+ # @return [String]
28
+ attr_accessor :status
29
+
30
+ # Contact Email
31
+ # @return [String]
32
+ attr_accessor :contact_email
33
+
34
+ # A mapping from model property names to API property names
35
+ def self.names
36
+ if @_hash.nil?
37
+ @_hash = {}
38
+ @_hash["account_identifier"] = "accountIdentifier"
39
+ @_hash["display_name"] = "displayName"
40
+ @_hash["currency_code"] = "currencyCode"
41
+ @_hash["current_balance"] = "currentBalance"
42
+ @_hash["created_at"] = "createdAt"
43
+ @_hash["status"] = "status"
44
+ @_hash["contact_email"] = "contactEmail"
45
+ end
46
+ @_hash
47
+ end
48
+
49
+ def initialize(account_identifier = nil,
50
+ display_name = nil,
51
+ currency_code = 'USD',
52
+ current_balance = nil,
53
+ created_at = nil,
54
+ status = nil,
55
+ contact_email = nil)
56
+ @account_identifier = account_identifier
57
+ @display_name = display_name
58
+ @currency_code = currency_code
59
+ @current_balance = current_balance
60
+ @created_at = created_at
61
+ @status = status
62
+ @contact_email = contact_email
63
+ end
64
+
65
+ # Creates an instance of the object from a hash
66
+ def self.from_hash(hash)
67
+ return nil unless hash
68
+
69
+ # Extract variables from the hash
70
+ account_identifier = hash['accountIdentifier']
71
+ display_name = hash['displayName']
72
+ currency_code = hash['currencyCode'] ||= 'USD'
73
+ current_balance = hash['currentBalance']
74
+ created_at = DateTime.rfc3339(hash['createdAt']) if hash['createdAt']
75
+ status = hash['status']
76
+ contact_email = hash['contactEmail']
77
+
78
+ # Create object from extracted values
79
+ AccountModel.new(account_identifier,
80
+ display_name,
81
+ currency_code,
82
+ current_balance,
83
+ created_at,
84
+ status,
85
+ contact_email)
86
+ end
87
+ end
88
+ 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 AccountSummaryModel < BaseModel
6
+ # Account Identifier
7
+ # @return [String]
8
+ attr_accessor :account_identifier
9
+
10
+ # Display Name
11
+ # @return [String]
12
+ attr_accessor :display_name
13
+
14
+ # Date Created
15
+ # @return [DateTime]
16
+ attr_accessor :created_at
17
+
18
+ # Status
19
+ # @return [String]
20
+ attr_accessor :status
21
+
22
+ # A mapping from model property names to API property names
23
+ def self.names
24
+ if @_hash.nil?
25
+ @_hash = {}
26
+ @_hash["account_identifier"] = "accountIdentifier"
27
+ @_hash["display_name"] = "displayName"
28
+ @_hash["created_at"] = "createdAt"
29
+ @_hash["status"] = "status"
30
+ end
31
+ @_hash
32
+ end
33
+
34
+ def initialize(account_identifier = nil,
35
+ display_name = nil,
36
+ created_at = nil,
37
+ status = nil)
38
+ @account_identifier = account_identifier
39
+ @display_name = display_name
40
+ @created_at = created_at
41
+ @status = status
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
+ account_identifier = hash['accountIdentifier']
50
+ display_name = hash['displayName']
51
+ created_at = DateTime.rfc3339(hash['createdAt']) if hash['createdAt']
52
+ status = hash['status']
53
+
54
+ # Create object from extracted values
55
+ AccountSummaryModel.new(account_identifier,
56
+ display_name,
57
+ created_at,
58
+ status)
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,32 @@
1
+ # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module Raas
4
+ class BaseModel
5
+ # Returns a Hash representation of the current object
6
+ def to_hash
7
+ hash = {}
8
+ self.instance_variables.each do |name|
9
+ value = self.instance_variable_get(name)
10
+ name = name[1..-1]
11
+ key = self.class.names.key?(name) ? self.class.names[name] : name
12
+ if value.instance_of? Array
13
+ hash[key] = value.map{|v| v.kind_of?(BaseModel) ? v.to_hash : v}
14
+ elsif value.instance_of? Hash
15
+ hash[key] = {}
16
+ value.each do |k, v|
17
+ hash[key][k] = v.kind_of?(BaseModel) ? v.to_hash : v
18
+ end
19
+ else
20
+ hash[key] = value.kind_of?(BaseModel) ? value.to_hash : value
21
+ end
22
+ end
23
+ hash
24
+ end
25
+
26
+ # Returns a JSON representation of the curent object
27
+ def to_json(options = {})
28
+ hash = to_hash
29
+ hash.to_json(options)
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,129 @@
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 BrandModel < BaseModel
6
+ # Brand Key
7
+ # @return [String]
8
+ attr_accessor :brand_key
9
+
10
+ # Brand Name
11
+ # @return [String]
12
+ attr_accessor :brand_name
13
+
14
+ # Disclaimer
15
+ # @return [String]
16
+ attr_accessor :disclaimer
17
+
18
+ # Description
19
+ # @return [String]
20
+ attr_accessor :description
21
+
22
+ # Short Description
23
+ # @return [String]
24
+ attr_accessor :short_description
25
+
26
+ # Terms
27
+ # @return [String]
28
+ attr_accessor :terms
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
+ # Image URLs
39
+ # @return [Array<String, String>]
40
+ attr_accessor :image_urls
41
+
42
+ # Status
43
+ # @return [String]
44
+ attr_accessor :status
45
+
46
+ # Items
47
+ # @return [List of ItemModel]
48
+ attr_accessor :items
49
+
50
+ # A mapping from model property names to API property names
51
+ def self.names
52
+ if @_hash.nil?
53
+ @_hash = {}
54
+ @_hash["brand_key"] = "brandKey"
55
+ @_hash["brand_name"] = "brandName"
56
+ @_hash["disclaimer"] = "disclaimer"
57
+ @_hash["description"] = "description"
58
+ @_hash["short_description"] = "shortDescription"
59
+ @_hash["terms"] = "terms"
60
+ @_hash["created_date"] = "createdDate"
61
+ @_hash["last_update_date"] = "lastUpdateDate"
62
+ @_hash["image_urls"] = "imageUrls"
63
+ @_hash["status"] = "status"
64
+ @_hash["items"] = "items"
65
+ end
66
+ @_hash
67
+ end
68
+
69
+ def initialize(brand_key = nil,
70
+ brand_name = nil,
71
+ disclaimer = nil,
72
+ description = nil,
73
+ short_description = nil,
74
+ terms = nil,
75
+ created_date = nil,
76
+ last_update_date = nil,
77
+ image_urls = nil,
78
+ status = nil,
79
+ items = nil)
80
+ @brand_key = brand_key
81
+ @brand_name = brand_name
82
+ @disclaimer = disclaimer
83
+ @description = description
84
+ @short_description = short_description
85
+ @terms = terms
86
+ @created_date = created_date
87
+ @last_update_date = last_update_date
88
+ @image_urls = image_urls
89
+ @status = status
90
+ @items = items
91
+ end
92
+
93
+ # Creates an instance of the object from a hash
94
+ def self.from_hash(hash)
95
+ return nil unless hash
96
+
97
+ # Extract variables from the hash
98
+ brand_key = hash['brandKey']
99
+ brand_name = hash['brandName']
100
+ disclaimer = hash['disclaimer']
101
+ description = hash['description']
102
+ short_description = hash['shortDescription']
103
+ terms = hash['terms']
104
+ created_date = DateTime.rfc3339(hash['createdDate']) if hash['createdDate']
105
+ last_update_date = DateTime.rfc3339(hash['lastUpdateDate']) if hash['lastUpdateDate']
106
+ image_urls = hash['imageUrls']
107
+ status = hash['status']
108
+ # Parameter is an array, so we need to iterate through it
109
+ items = nil
110
+ if hash['items'] != nil
111
+ items = Array.new
112
+ hash['items'].each{|structure| items << (ItemModel.from_hash(structure) if structure)}
113
+ end
114
+
115
+ # Create object from extracted values
116
+ BrandModel.new(brand_key,
117
+ brand_name,
118
+ disclaimer,
119
+ description,
120
+ short_description,
121
+ terms,
122
+ created_date,
123
+ last_update_date,
124
+ image_urls,
125
+ status,
126
+ items)
127
+ end
128
+ end
129
+ 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 CatalogModel < BaseModel
5
+ # The name of your catalog
6
+ # @return [String]
7
+ attr_accessor :catalog_name
8
+
9
+ # The brands in your catalog
10
+ # @return [List of BrandModel]
11
+ attr_accessor :brands
12
+
13
+ # A mapping from model property names to API property names
14
+ def self.names
15
+ if @_hash.nil?
16
+ @_hash = {}
17
+ @_hash["catalog_name"] = "catalogName"
18
+ @_hash["brands"] = "brands"
19
+ end
20
+ @_hash
21
+ end
22
+
23
+ def initialize(catalog_name = nil,
24
+ brands = nil)
25
+ @catalog_name = catalog_name
26
+ @brands = brands
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
+ catalog_name = hash['catalogName']
35
+ # Parameter is an array, so we need to iterate through it
36
+ brands = nil
37
+ if hash['brands'] != nil
38
+ brands = Array.new
39
+ hash['brands'].each{|structure| brands << (BrandModel.from_hash(structure) if structure)}
40
+ end
41
+
42
+ # Create object from extracted values
43
+ CatalogModel.new(catalog_name,
44
+ brands)
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,51 @@
1
+ # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module Raas
4
+ class CreateAccountRequestModel < BaseModel
5
+ # Account Identifier
6
+ # @return [String]
7
+ attr_accessor :account_identifier
8
+
9
+ # Display Name
10
+ # @return [String]
11
+ attr_accessor :display_name
12
+
13
+ # Contact Email
14
+ # @return [String]
15
+ attr_accessor :contact_email
16
+
17
+ # A mapping from model property names to API property names
18
+ def self.names
19
+ if @_hash.nil?
20
+ @_hash = {}
21
+ @_hash["account_identifier"] = "accountIdentifier"
22
+ @_hash["display_name"] = "displayName"
23
+ @_hash["contact_email"] = "contactEmail"
24
+ end
25
+ @_hash
26
+ end
27
+
28
+ def initialize(account_identifier = nil,
29
+ display_name = nil,
30
+ contact_email = nil)
31
+ @account_identifier = account_identifier
32
+ @display_name = display_name
33
+ @contact_email = contact_email
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
+ account_identifier = hash['accountIdentifier']
42
+ display_name = hash['displayName']
43
+ contact_email = hash['contactEmail']
44
+
45
+ # Create object from extracted values
46
+ CreateAccountRequestModel.new(account_identifier,
47
+ display_name,
48
+ contact_email)
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,42 @@
1
+ # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module Raas
4
+ class CreateCustomerRequestModel < BaseModel
5
+ # Customer Identifier
6
+ # @return [String]
7
+ attr_accessor :customer_identifier
8
+
9
+ # Display Name
10
+ # @return [String]
11
+ attr_accessor :display_name
12
+
13
+ # A mapping from model property names to API property names
14
+ def self.names
15
+ if @_hash.nil?
16
+ @_hash = {}
17
+ @_hash["customer_identifier"] = "customerIdentifier"
18
+ @_hash["display_name"] = "displayName"
19
+ end
20
+ @_hash
21
+ end
22
+
23
+ def initialize(customer_identifier = nil,
24
+ display_name = nil)
25
+ @customer_identifier = customer_identifier
26
+ @display_name = display_name
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
+ customer_identifier = hash['customerIdentifier']
35
+ display_name = hash['displayName']
36
+
37
+ # Create object from extracted values
38
+ CreateCustomerRequestModel.new(customer_identifier,
39
+ display_name)
40
+ end
41
+ end
42
+ end