reference_service 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +79 -0
  4. data/README.md +126 -0
  5. data/Rakefile +10 -0
  6. data/docs/ActiveSubscription.md +27 -0
  7. data/docs/Error.md +17 -0
  8. data/docs/ErrorErrors.md +17 -0
  9. data/docs/ErrorErrorsError.md +25 -0
  10. data/docs/ReportsApi.md +168 -0
  11. data/docs/Sector.md +19 -0
  12. data/docs/SectorApi.md +100 -0
  13. data/docs/SectorSpending.md +23 -0
  14. data/docs/SpendingReport.md +23 -0
  15. data/docs/SubscribeApi.md +244 -0
  16. data/docs/Subscription.md +17 -0
  17. data/docs/SubscriptionObject.md +27 -0
  18. data/docs/SubscriptionPaymentCard.md +21 -0
  19. data/docs/SubscriptionResponse.md +19 -0
  20. data/docs/TopLocationsReport.md +17 -0
  21. data/docs/UnsubscribedResponse.md +19 -0
  22. data/git_push.sh +55 -0
  23. data/lib/openapi_client.rb +55 -0
  24. data/lib/openapi_client/api/reports_api.rb +252 -0
  25. data/lib/openapi_client/api/sector_api.rb +151 -0
  26. data/lib/openapi_client/api/subscribe_api.rb +334 -0
  27. data/lib/openapi_client/api_client.rb +386 -0
  28. data/lib/openapi_client/api_error.rb +57 -0
  29. data/lib/openapi_client/configuration.rb +244 -0
  30. data/lib/openapi_client/models/active_subscription.rb +262 -0
  31. data/lib/openapi_client/models/error.rb +201 -0
  32. data/lib/openapi_client/models/error_errors.rb +203 -0
  33. data/lib/openapi_client/models/error_errors_error.rb +232 -0
  34. data/lib/openapi_client/models/sector.rb +216 -0
  35. data/lib/openapi_client/models/sector_spending.rb +244 -0
  36. data/lib/openapi_client/models/spending_report.rb +235 -0
  37. data/lib/openapi_client/models/subscription.rb +197 -0
  38. data/lib/openapi_client/models/subscription_object.rb +247 -0
  39. data/lib/openapi_client/models/subscription_payment_card.rb +254 -0
  40. data/lib/openapi_client/models/subscription_response.rb +206 -0
  41. data/lib/openapi_client/models/top_locations_report.rb +200 -0
  42. data/lib/openapi_client/models/unsubscribed_response.rb +207 -0
  43. data/lib/openapi_client/version.rb +15 -0
  44. data/openapi_client.gemspec +38 -0
  45. data/spec/api/reports_api_spec.rb +77 -0
  46. data/spec/api/sector_api_spec.rb +58 -0
  47. data/spec/api/subscribe_api_spec.rb +92 -0
  48. data/spec/api_client_spec.rb +226 -0
  49. data/spec/configuration_spec.rb +42 -0
  50. data/spec/models/active_subscription_spec.rb +71 -0
  51. data/spec/models/error_errors_error_spec.rb +65 -0
  52. data/spec/models/error_errors_spec.rb +41 -0
  53. data/spec/models/error_spec.rb +41 -0
  54. data/spec/models/sector_spec.rb +47 -0
  55. data/spec/models/sector_spending_spec.rb +59 -0
  56. data/spec/models/spending_report_spec.rb +59 -0
  57. data/spec/models/subscription_object_spec.rb +71 -0
  58. data/spec/models/subscription_payment_card_spec.rb +53 -0
  59. data/spec/models/subscription_response_spec.rb +47 -0
  60. data/spec/models/subscription_spec.rb +41 -0
  61. data/spec/models/top_locations_report_spec.rb +41 -0
  62. data/spec/models/unsubscribed_response_spec.rb +47 -0
  63. data/spec/spec_helper.rb +111 -0
  64. metadata +199 -0
@@ -0,0 +1,216 @@
1
+ =begin
2
+ #Golden Service API
3
+
4
+ #An API that conforms to the standards and best practices that should be adhered to in all Mastercard owned APIs. Can be used to create subscriptions to reports that are generated twice daily (6am & 6pm) that deliver e-commerce spending across multiple sectors and locations. <br/> --- * **All requests must be signed using oauth 1.0a. Please refer to: https://developer.mastercard.com/platform/documentation/using-oauth-1a-to-access-mastercard-apis/** --- * **The user must provide their card details when creating a subscription. These details must be encrypted before entering transit. Please refer to [Mastercard security](https://stage.developer.mastercard.com/platform/documentation/securing-sensitive-data-using-payload-encryption/)** ---
5
+
6
+ The version of the OpenAPI document: 1.1.0
7
+ Contact: developers@mastercard.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module OpenapiClient
16
+ # Sector object
17
+ class Sector
18
+ attr_accessor :sector_id
19
+
20
+ attr_accessor :sector_name
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'sector_id' => :'sectorId',
26
+ :'sector_name' => :'sectorName'
27
+ }
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.openapi_types
32
+ {
33
+ :'sector_id' => :'Integer',
34
+ :'sector_name' => :'String'
35
+ }
36
+ end
37
+
38
+ # Initializes the object
39
+ # @param [Hash] attributes Model attributes in the form of hash
40
+ def initialize(attributes = {})
41
+ if (!attributes.is_a?(Hash))
42
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::Sector` initialize method"
43
+ end
44
+
45
+ # check to see if the attribute exists and convert string to symbol for hash key
46
+ attributes = attributes.each_with_object({}) { |(k, v), h|
47
+ if (!self.class.attribute_map.key?(k.to_sym))
48
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Sector`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
49
+ end
50
+ h[k.to_sym] = v
51
+ }
52
+
53
+ if attributes.key?(:'sector_id')
54
+ self.sector_id = attributes[:'sector_id']
55
+ end
56
+
57
+ if attributes.key?(:'sector_name')
58
+ self.sector_name = attributes[:'sector_name']
59
+ end
60
+ end
61
+
62
+ # Show invalid properties with the reasons. Usually used together with valid?
63
+ # @return Array for valid properties with the reasons
64
+ def list_invalid_properties
65
+ invalid_properties = Array.new
66
+ if @sector_id.nil?
67
+ invalid_properties.push('invalid value for "sector_id", sector_id cannot be nil.')
68
+ end
69
+
70
+ if @sector_name.nil?
71
+ invalid_properties.push('invalid value for "sector_name", sector_name cannot be nil.')
72
+ end
73
+
74
+ invalid_properties
75
+ end
76
+
77
+ # Check to see if the all the properties in the model are valid
78
+ # @return true if the model is valid
79
+ def valid?
80
+ return false if @sector_id.nil?
81
+ return false if @sector_name.nil?
82
+ true
83
+ end
84
+
85
+ # Checks equality by comparing each attribute.
86
+ # @param [Object] Object to be compared
87
+ def ==(o)
88
+ return true if self.equal?(o)
89
+ self.class == o.class &&
90
+ sector_id == o.sector_id &&
91
+ sector_name == o.sector_name
92
+ end
93
+
94
+ # @see the `==` method
95
+ # @param [Object] Object to be compared
96
+ def eql?(o)
97
+ self == o
98
+ end
99
+
100
+ # Calculates hash code according to all attributes.
101
+ # @return [Integer] Hash code
102
+ def hash
103
+ [sector_id, sector_name].hash
104
+ end
105
+
106
+ # Builds the object from hash
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ # @return [Object] Returns the model itself
109
+ def self.build_from_hash(attributes)
110
+ new.build_from_hash(attributes)
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def build_from_hash(attributes)
117
+ return nil unless attributes.is_a?(Hash)
118
+ self.class.openapi_types.each_pair do |key, type|
119
+ if type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
123
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
124
+ end
125
+ elsif !attributes[self.class.attribute_map[key]].nil?
126
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
127
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
128
+ end
129
+
130
+ self
131
+ end
132
+
133
+ # Deserializes the data based on type
134
+ # @param string type Data type
135
+ # @param string value Value to be deserialized
136
+ # @return [Object] Deserialized data
137
+ def _deserialize(type, value)
138
+ case type.to_sym
139
+ when :DateTime
140
+ DateTime.parse(value)
141
+ when :Date
142
+ Date.parse(value)
143
+ when :String
144
+ value.to_s
145
+ when :Integer
146
+ value.to_i
147
+ when :Float
148
+ value.to_f
149
+ when :Boolean
150
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
151
+ true
152
+ else
153
+ false
154
+ end
155
+ when :Object
156
+ # generic object (usually a Hash), return directly
157
+ value
158
+ when /\AArray<(?<inner_type>.+)>\z/
159
+ inner_type = Regexp.last_match[:inner_type]
160
+ value.map { |v| _deserialize(inner_type, v) }
161
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
162
+ k_type = Regexp.last_match[:k_type]
163
+ v_type = Regexp.last_match[:v_type]
164
+ {}.tap do |hash|
165
+ value.each do |k, v|
166
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
167
+ end
168
+ end
169
+ else # model
170
+ OpenapiClient.const_get(type).build_from_hash(value)
171
+ end
172
+ end
173
+
174
+ # Returns the string representation of the object
175
+ # @return [String] String presentation of the object
176
+ def to_s
177
+ to_hash.to_s
178
+ end
179
+
180
+ # to_body is an alias to to_hash (backward compatibility)
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_body
183
+ to_hash
184
+ end
185
+
186
+ # Returns the object in the form of hash
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_hash
189
+ hash = {}
190
+ self.class.attribute_map.each_pair do |attr, param|
191
+ value = self.send(attr)
192
+ next if value.nil?
193
+ hash[param] = _to_hash(value)
194
+ end
195
+ hash
196
+ end
197
+
198
+ # Outputs non-array value in the form of hash
199
+ # For object, use to_hash. Otherwise, just return the value
200
+ # @param [Object] value Any valid value
201
+ # @return [Hash] Returns the value in the form of hash
202
+ def _to_hash(value)
203
+ if value.is_a?(Array)
204
+ value.compact.map { |v| _to_hash(v) }
205
+ elsif value.is_a?(Hash)
206
+ {}.tap do |hash|
207
+ value.each { |k, v| hash[k] = _to_hash(v) }
208
+ end
209
+ elsif value.respond_to? :to_hash
210
+ value.to_hash
211
+ else
212
+ value
213
+ end
214
+ end
215
+ end
216
+ end
@@ -0,0 +1,244 @@
1
+ =begin
2
+ #Golden Service API
3
+
4
+ #An API that conforms to the standards and best practices that should be adhered to in all Mastercard owned APIs. Can be used to create subscriptions to reports that are generated twice daily (6am & 6pm) that deliver e-commerce spending across multiple sectors and locations. <br/> --- * **All requests must be signed using oauth 1.0a. Please refer to: https://developer.mastercard.com/platform/documentation/using-oauth-1a-to-access-mastercard-apis/** --- * **The user must provide their card details when creating a subscription. These details must be encrypted before entering transit. Please refer to [Mastercard security](https://stage.developer.mastercard.com/platform/documentation/securing-sensitive-data-using-payload-encryption/)** ---
5
+
6
+ The version of the OpenAPI document: 1.1.0
7
+ Contact: developers@mastercard.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module OpenapiClient
16
+ # Spending report for a single sector
17
+ class SectorSpending
18
+ attr_accessor :sector_id
19
+
20
+ attr_accessor :sector_name
21
+
22
+ attr_accessor :amount_spent
23
+
24
+ attr_accessor :average_per_transaction
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'sector_id' => :'sectorId',
30
+ :'sector_name' => :'sectorName',
31
+ :'amount_spent' => :'amountSpent',
32
+ :'average_per_transaction' => :'averagePerTransaction'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.openapi_types
38
+ {
39
+ :'sector_id' => :'Integer',
40
+ :'sector_name' => :'String',
41
+ :'amount_spent' => :'Float',
42
+ :'average_per_transaction' => :'Float'
43
+ }
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::SectorSpending` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::SectorSpending`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'sector_id')
62
+ self.sector_id = attributes[:'sector_id']
63
+ end
64
+
65
+ if attributes.key?(:'sector_name')
66
+ self.sector_name = attributes[:'sector_name']
67
+ end
68
+
69
+ if attributes.key?(:'amount_spent')
70
+ self.amount_spent = attributes[:'amount_spent']
71
+ end
72
+
73
+ if attributes.key?(:'average_per_transaction')
74
+ self.average_per_transaction = attributes[:'average_per_transaction']
75
+ end
76
+ end
77
+
78
+ # Show invalid properties with the reasons. Usually used together with valid?
79
+ # @return Array for valid properties with the reasons
80
+ def list_invalid_properties
81
+ invalid_properties = Array.new
82
+ if @sector_id.nil?
83
+ invalid_properties.push('invalid value for "sector_id", sector_id cannot be nil.')
84
+ end
85
+
86
+ if @sector_name.nil?
87
+ invalid_properties.push('invalid value for "sector_name", sector_name cannot be nil.')
88
+ end
89
+
90
+ if @amount_spent.nil?
91
+ invalid_properties.push('invalid value for "amount_spent", amount_spent cannot be nil.')
92
+ end
93
+
94
+ if @average_per_transaction.nil?
95
+ invalid_properties.push('invalid value for "average_per_transaction", average_per_transaction cannot be nil.')
96
+ end
97
+
98
+ invalid_properties
99
+ end
100
+
101
+ # Check to see if the all the properties in the model are valid
102
+ # @return true if the model is valid
103
+ def valid?
104
+ return false if @sector_id.nil?
105
+ return false if @sector_name.nil?
106
+ return false if @amount_spent.nil?
107
+ return false if @average_per_transaction.nil?
108
+ true
109
+ end
110
+
111
+ # Checks equality by comparing each attribute.
112
+ # @param [Object] Object to be compared
113
+ def ==(o)
114
+ return true if self.equal?(o)
115
+ self.class == o.class &&
116
+ sector_id == o.sector_id &&
117
+ sector_name == o.sector_name &&
118
+ amount_spent == o.amount_spent &&
119
+ average_per_transaction == o.average_per_transaction
120
+ end
121
+
122
+ # @see the `==` method
123
+ # @param [Object] Object to be compared
124
+ def eql?(o)
125
+ self == o
126
+ end
127
+
128
+ # Calculates hash code according to all attributes.
129
+ # @return [Integer] Hash code
130
+ def hash
131
+ [sector_id, sector_name, amount_spent, average_per_transaction].hash
132
+ end
133
+
134
+ # Builds the object from hash
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ # @return [Object] Returns the model itself
137
+ def self.build_from_hash(attributes)
138
+ new.build_from_hash(attributes)
139
+ end
140
+
141
+ # Builds the object from hash
142
+ # @param [Hash] attributes Model attributes in the form of hash
143
+ # @return [Object] Returns the model itself
144
+ def build_from_hash(attributes)
145
+ return nil unless attributes.is_a?(Hash)
146
+ self.class.openapi_types.each_pair do |key, type|
147
+ if type =~ /\AArray<(.*)>/i
148
+ # check to ensure the input is an array given that the attribute
149
+ # is documented as an array but the input is not
150
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
151
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
152
+ end
153
+ elsif !attributes[self.class.attribute_map[key]].nil?
154
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
155
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
156
+ end
157
+
158
+ self
159
+ end
160
+
161
+ # Deserializes the data based on type
162
+ # @param string type Data type
163
+ # @param string value Value to be deserialized
164
+ # @return [Object] Deserialized data
165
+ def _deserialize(type, value)
166
+ case type.to_sym
167
+ when :DateTime
168
+ DateTime.parse(value)
169
+ when :Date
170
+ Date.parse(value)
171
+ when :String
172
+ value.to_s
173
+ when :Integer
174
+ value.to_i
175
+ when :Float
176
+ value.to_f
177
+ when :Boolean
178
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
179
+ true
180
+ else
181
+ false
182
+ end
183
+ when :Object
184
+ # generic object (usually a Hash), return directly
185
+ value
186
+ when /\AArray<(?<inner_type>.+)>\z/
187
+ inner_type = Regexp.last_match[:inner_type]
188
+ value.map { |v| _deserialize(inner_type, v) }
189
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
190
+ k_type = Regexp.last_match[:k_type]
191
+ v_type = Regexp.last_match[:v_type]
192
+ {}.tap do |hash|
193
+ value.each do |k, v|
194
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
195
+ end
196
+ end
197
+ else # model
198
+ OpenapiClient.const_get(type).build_from_hash(value)
199
+ end
200
+ end
201
+
202
+ # Returns the string representation of the object
203
+ # @return [String] String presentation of the object
204
+ def to_s
205
+ to_hash.to_s
206
+ end
207
+
208
+ # to_body is an alias to to_hash (backward compatibility)
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_body
211
+ to_hash
212
+ end
213
+
214
+ # Returns the object in the form of hash
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_hash
217
+ hash = {}
218
+ self.class.attribute_map.each_pair do |attr, param|
219
+ value = self.send(attr)
220
+ next if value.nil?
221
+ hash[param] = _to_hash(value)
222
+ end
223
+ hash
224
+ end
225
+
226
+ # Outputs non-array value in the form of hash
227
+ # For object, use to_hash. Otherwise, just return the value
228
+ # @param [Object] value Any valid value
229
+ # @return [Hash] Returns the value in the form of hash
230
+ def _to_hash(value)
231
+ if value.is_a?(Array)
232
+ value.compact.map { |v| _to_hash(v) }
233
+ elsif value.is_a?(Hash)
234
+ {}.tap do |hash|
235
+ value.each { |k, v| hash[k] = _to_hash(v) }
236
+ end
237
+ elsif value.respond_to? :to_hash
238
+ value.to_hash
239
+ else
240
+ value
241
+ end
242
+ end
243
+ end
244
+ end