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,254 @@
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
+ # Credit/Debit card information, MUST be encrypted both in transit and at rest
17
+ class SubscriptionPaymentCard
18
+ # Credit/Debit card number used for paying for the subscription
19
+ attr_accessor :card_number
20
+
21
+ # Credit/Debit expiry date used for paying for the subscription
22
+ attr_accessor :expiry
23
+
24
+ # Credit/Debit cvc number used for paying for the subscription
25
+ attr_accessor :cvc
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'card_number' => :'cardNumber',
31
+ :'expiry' => :'expiry',
32
+ :'cvc' => :'cvc'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.openapi_types
38
+ {
39
+ :'card_number' => :'Integer',
40
+ :'expiry' => :'String',
41
+ :'cvc' => :'Integer'
42
+ }
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::SubscriptionPaymentCard` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::SubscriptionPaymentCard`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'card_number')
61
+ self.card_number = attributes[:'card_number']
62
+ end
63
+
64
+ if attributes.key?(:'expiry')
65
+ self.expiry = attributes[:'expiry']
66
+ end
67
+
68
+ if attributes.key?(:'cvc')
69
+ self.cvc = attributes[:'cvc']
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ invalid_properties = Array.new
77
+ if @card_number.nil?
78
+ invalid_properties.push('invalid value for "card_number", card_number cannot be nil.')
79
+ end
80
+
81
+ if @expiry.nil?
82
+ invalid_properties.push('invalid value for "expiry", expiry cannot be nil.')
83
+ end
84
+
85
+ pattern = Regexp.new(/^\d{2}\/\d{2}$/)
86
+ if @expiry !~ pattern
87
+ invalid_properties.push("invalid value for \"expiry\", must conform to the pattern #{pattern}.")
88
+ end
89
+
90
+ if @cvc.nil?
91
+ invalid_properties.push('invalid value for "cvc", cvc cannot be nil.')
92
+ end
93
+
94
+ invalid_properties
95
+ end
96
+
97
+ # Check to see if the all the properties in the model are valid
98
+ # @return true if the model is valid
99
+ def valid?
100
+ return false if @card_number.nil?
101
+ return false if @expiry.nil?
102
+ return false if @expiry !~ Regexp.new(/^\d{2}\/\d{2}$/)
103
+ return false if @cvc.nil?
104
+ true
105
+ end
106
+
107
+ # Custom attribute writer method with validation
108
+ # @param [Object] expiry Value to be assigned
109
+ def expiry=(expiry)
110
+ if expiry.nil?
111
+ fail ArgumentError, 'expiry cannot be nil'
112
+ end
113
+
114
+ pattern = Regexp.new(/^\d{2}\/\d{2}$/)
115
+ if expiry !~ pattern
116
+ fail ArgumentError, "invalid value for \"expiry\", must conform to the pattern #{pattern}."
117
+ end
118
+
119
+ @expiry = expiry
120
+ end
121
+
122
+ # Checks equality by comparing each attribute.
123
+ # @param [Object] Object to be compared
124
+ def ==(o)
125
+ return true if self.equal?(o)
126
+ self.class == o.class &&
127
+ card_number == o.card_number &&
128
+ expiry == o.expiry &&
129
+ cvc == o.cvc
130
+ end
131
+
132
+ # @see the `==` method
133
+ # @param [Object] Object to be compared
134
+ def eql?(o)
135
+ self == o
136
+ end
137
+
138
+ # Calculates hash code according to all attributes.
139
+ # @return [Integer] Hash code
140
+ def hash
141
+ [card_number, expiry, cvc].hash
142
+ end
143
+
144
+ # Builds the object from hash
145
+ # @param [Hash] attributes Model attributes in the form of hash
146
+ # @return [Object] Returns the model itself
147
+ def self.build_from_hash(attributes)
148
+ new.build_from_hash(attributes)
149
+ end
150
+
151
+ # Builds the object from hash
152
+ # @param [Hash] attributes Model attributes in the form of hash
153
+ # @return [Object] Returns the model itself
154
+ def build_from_hash(attributes)
155
+ return nil unless attributes.is_a?(Hash)
156
+ self.class.openapi_types.each_pair do |key, type|
157
+ if type =~ /\AArray<(.*)>/i
158
+ # check to ensure the input is an array given that the attribute
159
+ # is documented as an array but the input is not
160
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
161
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
162
+ end
163
+ elsif !attributes[self.class.attribute_map[key]].nil?
164
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
165
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
166
+ end
167
+
168
+ self
169
+ end
170
+
171
+ # Deserializes the data based on type
172
+ # @param string type Data type
173
+ # @param string value Value to be deserialized
174
+ # @return [Object] Deserialized data
175
+ def _deserialize(type, value)
176
+ case type.to_sym
177
+ when :DateTime
178
+ DateTime.parse(value)
179
+ when :Date
180
+ Date.parse(value)
181
+ when :String
182
+ value.to_s
183
+ when :Integer
184
+ value.to_i
185
+ when :Float
186
+ value.to_f
187
+ when :Boolean
188
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
189
+ true
190
+ else
191
+ false
192
+ end
193
+ when :Object
194
+ # generic object (usually a Hash), return directly
195
+ value
196
+ when /\AArray<(?<inner_type>.+)>\z/
197
+ inner_type = Regexp.last_match[:inner_type]
198
+ value.map { |v| _deserialize(inner_type, v) }
199
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
200
+ k_type = Regexp.last_match[:k_type]
201
+ v_type = Regexp.last_match[:v_type]
202
+ {}.tap do |hash|
203
+ value.each do |k, v|
204
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
205
+ end
206
+ end
207
+ else # model
208
+ OpenapiClient.const_get(type).build_from_hash(value)
209
+ end
210
+ end
211
+
212
+ # Returns the string representation of the object
213
+ # @return [String] String presentation of the object
214
+ def to_s
215
+ to_hash.to_s
216
+ end
217
+
218
+ # to_body is an alias to to_hash (backward compatibility)
219
+ # @return [Hash] Returns the object in the form of hash
220
+ def to_body
221
+ to_hash
222
+ end
223
+
224
+ # Returns the object in the form of hash
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_hash
227
+ hash = {}
228
+ self.class.attribute_map.each_pair do |attr, param|
229
+ value = self.send(attr)
230
+ next if value.nil?
231
+ hash[param] = _to_hash(value)
232
+ end
233
+ hash
234
+ end
235
+
236
+ # Outputs non-array value in the form of hash
237
+ # For object, use to_hash. Otherwise, just return the value
238
+ # @param [Object] value Any valid value
239
+ # @return [Hash] Returns the value in the form of hash
240
+ def _to_hash(value)
241
+ if value.is_a?(Array)
242
+ value.compact.map { |v| _to_hash(v) }
243
+ elsif value.is_a?(Hash)
244
+ {}.tap do |hash|
245
+ value.each { |k, v| hash[k] = _to_hash(v) }
246
+ end
247
+ elsif value.respond_to? :to_hash
248
+ value.to_hash
249
+ else
250
+ value
251
+ end
252
+ end
253
+ end
254
+ end
@@ -0,0 +1,206 @@
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
+ # Subscription representation object returned when updating or retrieving a subscription
17
+ class SubscriptionResponse
18
+ attr_accessor :message
19
+
20
+ attr_accessor :subscription
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'message' => :'message',
26
+ :'subscription' => :'subscription'
27
+ }
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.openapi_types
32
+ {
33
+ :'message' => :'String',
34
+ :'subscription' => :'ActiveSubscription'
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::SubscriptionResponse` 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::SubscriptionResponse`. 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?(:'message')
54
+ self.message = attributes[:'message']
55
+ end
56
+
57
+ if attributes.key?(:'subscription')
58
+ self.subscription = attributes[:'subscription']
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
+ invalid_properties
67
+ end
68
+
69
+ # Check to see if the all the properties in the model are valid
70
+ # @return true if the model is valid
71
+ def valid?
72
+ true
73
+ end
74
+
75
+ # Checks equality by comparing each attribute.
76
+ # @param [Object] Object to be compared
77
+ def ==(o)
78
+ return true if self.equal?(o)
79
+ self.class == o.class &&
80
+ message == o.message &&
81
+ subscription == o.subscription
82
+ end
83
+
84
+ # @see the `==` method
85
+ # @param [Object] Object to be compared
86
+ def eql?(o)
87
+ self == o
88
+ end
89
+
90
+ # Calculates hash code according to all attributes.
91
+ # @return [Integer] Hash code
92
+ def hash
93
+ [message, subscription].hash
94
+ end
95
+
96
+ # Builds the object from hash
97
+ # @param [Hash] attributes Model attributes in the form of hash
98
+ # @return [Object] Returns the model itself
99
+ def self.build_from_hash(attributes)
100
+ new.build_from_hash(attributes)
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def build_from_hash(attributes)
107
+ return nil unless attributes.is_a?(Hash)
108
+ self.class.openapi_types.each_pair do |key, type|
109
+ if type =~ /\AArray<(.*)>/i
110
+ # check to ensure the input is an array given that the attribute
111
+ # is documented as an array but the input is not
112
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
113
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
114
+ end
115
+ elsif !attributes[self.class.attribute_map[key]].nil?
116
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
117
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
118
+ end
119
+
120
+ self
121
+ end
122
+
123
+ # Deserializes the data based on type
124
+ # @param string type Data type
125
+ # @param string value Value to be deserialized
126
+ # @return [Object] Deserialized data
127
+ def _deserialize(type, value)
128
+ case type.to_sym
129
+ when :DateTime
130
+ DateTime.parse(value)
131
+ when :Date
132
+ Date.parse(value)
133
+ when :String
134
+ value.to_s
135
+ when :Integer
136
+ value.to_i
137
+ when :Float
138
+ value.to_f
139
+ when :Boolean
140
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
141
+ true
142
+ else
143
+ false
144
+ end
145
+ when :Object
146
+ # generic object (usually a Hash), return directly
147
+ value
148
+ when /\AArray<(?<inner_type>.+)>\z/
149
+ inner_type = Regexp.last_match[:inner_type]
150
+ value.map { |v| _deserialize(inner_type, v) }
151
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
152
+ k_type = Regexp.last_match[:k_type]
153
+ v_type = Regexp.last_match[:v_type]
154
+ {}.tap do |hash|
155
+ value.each do |k, v|
156
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
157
+ end
158
+ end
159
+ else # model
160
+ OpenapiClient.const_get(type).build_from_hash(value)
161
+ end
162
+ end
163
+
164
+ # Returns the string representation of the object
165
+ # @return [String] String presentation of the object
166
+ def to_s
167
+ to_hash.to_s
168
+ end
169
+
170
+ # to_body is an alias to to_hash (backward compatibility)
171
+ # @return [Hash] Returns the object in the form of hash
172
+ def to_body
173
+ to_hash
174
+ end
175
+
176
+ # Returns the object in the form of hash
177
+ # @return [Hash] Returns the object in the form of hash
178
+ def to_hash
179
+ hash = {}
180
+ self.class.attribute_map.each_pair do |attr, param|
181
+ value = self.send(attr)
182
+ next if value.nil?
183
+ hash[param] = _to_hash(value)
184
+ end
185
+ hash
186
+ end
187
+
188
+ # Outputs non-array value in the form of hash
189
+ # For object, use to_hash. Otherwise, just return the value
190
+ # @param [Object] value Any valid value
191
+ # @return [Hash] Returns the value in the form of hash
192
+ def _to_hash(value)
193
+ if value.is_a?(Array)
194
+ value.compact.map { |v| _to_hash(v) }
195
+ elsif value.is_a?(Hash)
196
+ {}.tap do |hash|
197
+ value.each { |k, v| hash[k] = _to_hash(v) }
198
+ end
199
+ elsif value.respond_to? :to_hash
200
+ value.to_hash
201
+ else
202
+ value
203
+ end
204
+ end
205
+ end
206
+ end