mx-platform-ruby 0.9.2 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +15 -15
  3. data/README.md +7 -7
  4. data/docs/MxPlatformApi.md +309 -90
  5. data/docs/PaymentAccountResponse.md +30 -0
  6. data/docs/PaymentAccountResponseBody.md +18 -0
  7. data/docs/PaymentProcessorAuthorizationCodeRequest.md +22 -0
  8. data/docs/PaymentProcessorAuthorizationCodeRequestBody.md +18 -0
  9. data/docs/PaymentProcessorAuthorizationCodeResponse.md +18 -0
  10. data/docs/PaymentProcessorAuthorizationCodeResponseBody.md +18 -0
  11. data/docs/PaymentProcessorTokenResponseBody.md +22 -0
  12. data/lib/mx-platform-ruby/api/mx_platform_api.rb +347 -131
  13. data/lib/mx-platform-ruby/configuration.rb +7 -0
  14. data/lib/mx-platform-ruby/models/payment_account_response.rb +279 -0
  15. data/lib/mx-platform-ruby/models/payment_account_response_body.rb +218 -0
  16. data/lib/mx-platform-ruby/models/payment_processor_authorization_code_request.rb +236 -0
  17. data/lib/mx-platform-ruby/models/payment_processor_authorization_code_request_body.rb +218 -0
  18. data/lib/mx-platform-ruby/models/payment_processor_authorization_code_response.rb +219 -0
  19. data/lib/mx-platform-ruby/models/payment_processor_authorization_code_response_body.rb +218 -0
  20. data/lib/mx-platform-ruby/models/payment_processor_token_response_body.rb +239 -0
  21. data/lib/mx-platform-ruby/version.rb +1 -1
  22. data/lib/mx-platform-ruby.rb +7 -0
  23. data/openapi/config.yml +1 -1
  24. data/openapi/templates/README.mustache +7 -7
  25. data/spec/api/mx_platform_api_spec.rb +55 -15
  26. data/spec/models/payment_account_response_body_spec.rb +34 -0
  27. data/spec/models/payment_account_response_spec.rb +70 -0
  28. data/spec/models/payment_processor_authorization_code_request_body_spec.rb +34 -0
  29. data/spec/models/payment_processor_authorization_code_request_spec.rb +46 -0
  30. data/spec/models/payment_processor_authorization_code_response_body_spec.rb +34 -0
  31. data/spec/models/payment_processor_authorization_code_response_spec.rb +34 -0
  32. data/spec/models/payment_processor_token_response_body_spec.rb +46 -0
  33. metadata +30 -2
@@ -0,0 +1,218 @@
1
+ =begin
2
+ #MX Platform API
3
+
4
+ #The MX Platform API is a powerful, fully-featured API designed to make aggregating and enhancing financial data easy and reliable. It can seamlessly connect your app or website to tens of thousands of financial institutions.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MxPlatformRuby
17
+ class PaymentProcessorAuthorizationCodeResponseBody
18
+ attr_accessor :payment_processor_authorization_code
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'payment_processor_authorization_code' => :'payment_processor_authorization_code'
24
+ }
25
+ end
26
+
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'payment_processor_authorization_code' => :'PaymentProcessorAuthorizationCodeResponse'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
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 `MxPlatformRuby::PaymentProcessorAuthorizationCodeResponseBody` 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 `MxPlatformRuby::PaymentProcessorAuthorizationCodeResponseBody`. 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?(:'payment_processor_authorization_code')
61
+ self.payment_processor_authorization_code = attributes[:'payment_processor_authorization_code']
62
+ end
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properties with the reasons
67
+ def list_invalid_properties
68
+ invalid_properties = Array.new
69
+ invalid_properties
70
+ end
71
+
72
+ # Check to see if the all the properties in the model are valid
73
+ # @return true if the model is valid
74
+ def valid?
75
+ true
76
+ end
77
+
78
+ # Checks equality by comparing each attribute.
79
+ # @param [Object] Object to be compared
80
+ def ==(o)
81
+ return true if self.equal?(o)
82
+ self.class == o.class &&
83
+ payment_processor_authorization_code == o.payment_processor_authorization_code
84
+ end
85
+
86
+ # @see the `==` method
87
+ # @param [Object] Object to be compared
88
+ def eql?(o)
89
+ self == o
90
+ end
91
+
92
+ # Calculates hash code according to all attributes.
93
+ # @return [Integer] Hash code
94
+ def hash
95
+ [payment_processor_authorization_code].hash
96
+ end
97
+
98
+ # Builds the object from hash
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ # @return [Object] Returns the model itself
101
+ def self.build_from_hash(attributes)
102
+ new.build_from_hash(attributes)
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def build_from_hash(attributes)
109
+ return nil unless attributes.is_a?(Hash)
110
+ self.class.openapi_types.each_pair do |key, type|
111
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
112
+ self.send("#{key}=", nil)
113
+ elsif type =~ /\AArray<(.*)>/i
114
+ # check to ensure the input is an array given that the attribute
115
+ # is documented as an array but the input is not
116
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
117
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
118
+ end
119
+ elsif !attributes[self.class.attribute_map[key]].nil?
120
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
121
+ end
122
+ end
123
+
124
+ self
125
+ end
126
+
127
+ # Deserializes the data based on type
128
+ # @param string type Data type
129
+ # @param string value Value to be deserialized
130
+ # @return [Object] Deserialized data
131
+ def _deserialize(type, value)
132
+ case type.to_sym
133
+ when :Time
134
+ Time.parse(value)
135
+ when :Date
136
+ Date.parse(value)
137
+ when :String
138
+ value.to_s
139
+ when :Integer
140
+ value.to_i
141
+ when :Float
142
+ value.to_f
143
+ when :Boolean
144
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
145
+ true
146
+ else
147
+ false
148
+ end
149
+ when :Object
150
+ # generic object (usually a Hash), return directly
151
+ value
152
+ when /\AArray<(?<inner_type>.+)>\z/
153
+ inner_type = Regexp.last_match[:inner_type]
154
+ value.map { |v| _deserialize(inner_type, v) }
155
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
156
+ k_type = Regexp.last_match[:k_type]
157
+ v_type = Regexp.last_match[:v_type]
158
+ {}.tap do |hash|
159
+ value.each do |k, v|
160
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
161
+ end
162
+ end
163
+ else # model
164
+ # models (e.g. Pet) or oneOf
165
+ klass = MxPlatformRuby.const_get(type)
166
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
167
+ end
168
+ end
169
+
170
+ # Returns the string representation of the object
171
+ # @return [String] String presentation of the object
172
+ def to_s
173
+ to_hash.to_s
174
+ end
175
+
176
+ # to_body is an alias to to_hash (backward compatibility)
177
+ # @return [Hash] Returns the object in the form of hash
178
+ def to_body
179
+ to_hash
180
+ end
181
+
182
+ # Returns the object in the form of hash
183
+ # @return [Hash] Returns the object in the form of hash
184
+ def to_hash
185
+ hash = {}
186
+ self.class.attribute_map.each_pair do |attr, param|
187
+ value = self.send(attr)
188
+ if value.nil?
189
+ is_nullable = self.class.openapi_nullable.include?(attr)
190
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
191
+ end
192
+
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
+
216
+ end
217
+
218
+ end
@@ -0,0 +1,239 @@
1
+ =begin
2
+ #MX Platform API
3
+
4
+ #The MX Platform API is a powerful, fully-featured API designed to make aggregating and enhancing financial data easy and reliable. It can seamlessly connect your app or website to tens of thousands of financial institutions.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MxPlatformRuby
17
+ class PaymentProcessorTokenResponseBody
18
+ attr_accessor :access_token
19
+
20
+ attr_accessor :scope
21
+
22
+ attr_accessor :token_type
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'access_token' => :'access_token',
28
+ :'scope' => :'scope',
29
+ :'token_type' => :'token_type'
30
+ }
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'access_token' => :'String',
42
+ :'scope' => :'String',
43
+ :'token_type' => :'String'
44
+ }
45
+ end
46
+
47
+ # List of attributes with nullable: true
48
+ def self.openapi_nullable
49
+ Set.new([
50
+ :'access_token',
51
+ :'scope',
52
+ :'token_type'
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MxPlatformRuby::PaymentProcessorTokenResponseBody` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!self.class.attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MxPlatformRuby::PaymentProcessorTokenResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'access_token')
72
+ self.access_token = attributes[:'access_token']
73
+ end
74
+
75
+ if attributes.key?(:'scope')
76
+ self.scope = attributes[:'scope']
77
+ end
78
+
79
+ if attributes.key?(:'token_type')
80
+ self.token_type = attributes[:'token_type']
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ invalid_properties = Array.new
88
+ invalid_properties
89
+ end
90
+
91
+ # Check to see if the all the properties in the model are valid
92
+ # @return true if the model is valid
93
+ def valid?
94
+ true
95
+ end
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] Object to be compared
99
+ def ==(o)
100
+ return true if self.equal?(o)
101
+ self.class == o.class &&
102
+ access_token == o.access_token &&
103
+ scope == o.scope &&
104
+ token_type == o.token_type
105
+ end
106
+
107
+ # @see the `==` method
108
+ # @param [Object] Object to be compared
109
+ def eql?(o)
110
+ self == o
111
+ end
112
+
113
+ # Calculates hash code according to all attributes.
114
+ # @return [Integer] Hash code
115
+ def hash
116
+ [access_token, scope, token_type].hash
117
+ end
118
+
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def self.build_from_hash(attributes)
123
+ new.build_from_hash(attributes)
124
+ end
125
+
126
+ # Builds the object from hash
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ # @return [Object] Returns the model itself
129
+ def build_from_hash(attributes)
130
+ return nil unless attributes.is_a?(Hash)
131
+ self.class.openapi_types.each_pair do |key, type|
132
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
133
+ self.send("#{key}=", nil)
134
+ elsif type =~ /\AArray<(.*)>/i
135
+ # check to ensure the input is an array given that the attribute
136
+ # is documented as an array but the input is not
137
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
138
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
139
+ end
140
+ elsif !attributes[self.class.attribute_map[key]].nil?
141
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
142
+ end
143
+ end
144
+
145
+ self
146
+ end
147
+
148
+ # Deserializes the data based on type
149
+ # @param string type Data type
150
+ # @param string value Value to be deserialized
151
+ # @return [Object] Deserialized data
152
+ def _deserialize(type, value)
153
+ case type.to_sym
154
+ when :Time
155
+ Time.parse(value)
156
+ when :Date
157
+ Date.parse(value)
158
+ when :String
159
+ value.to_s
160
+ when :Integer
161
+ value.to_i
162
+ when :Float
163
+ value.to_f
164
+ when :Boolean
165
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
166
+ true
167
+ else
168
+ false
169
+ end
170
+ when :Object
171
+ # generic object (usually a Hash), return directly
172
+ value
173
+ when /\AArray<(?<inner_type>.+)>\z/
174
+ inner_type = Regexp.last_match[:inner_type]
175
+ value.map { |v| _deserialize(inner_type, v) }
176
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
177
+ k_type = Regexp.last_match[:k_type]
178
+ v_type = Regexp.last_match[:v_type]
179
+ {}.tap do |hash|
180
+ value.each do |k, v|
181
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
182
+ end
183
+ end
184
+ else # model
185
+ # models (e.g. Pet) or oneOf
186
+ klass = MxPlatformRuby.const_get(type)
187
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ if value.nil?
210
+ is_nullable = self.class.openapi_nullable.include?(attr)
211
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
+ end
213
+
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.compact.map { |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to? :to_hash
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end
236
+
237
+ end
238
+
239
+ end
@@ -11,5 +11,5 @@ OpenAPI Generator version: 5.4.0
11
11
  =end
12
12
 
13
13
  module MxPlatformRuby
14
- VERSION = '0.9.2'
14
+ VERSION = '0.11.0'
15
15
  end
@@ -85,6 +85,13 @@ require 'mx-platform-ruby/models/o_auth_window_response'
85
85
  require 'mx-platform-ruby/models/o_auth_window_response_body'
86
86
  require 'mx-platform-ruby/models/option_response'
87
87
  require 'mx-platform-ruby/models/pagination_response'
88
+ require 'mx-platform-ruby/models/payment_account_response'
89
+ require 'mx-platform-ruby/models/payment_account_response_body'
90
+ require 'mx-platform-ruby/models/payment_processor_authorization_code_request'
91
+ require 'mx-platform-ruby/models/payment_processor_authorization_code_request_body'
92
+ require 'mx-platform-ruby/models/payment_processor_authorization_code_response'
93
+ require 'mx-platform-ruby/models/payment_processor_authorization_code_response_body'
94
+ require 'mx-platform-ruby/models/payment_processor_token_response_body'
88
95
  require 'mx-platform-ruby/models/statement_response'
89
96
  require 'mx-platform-ruby/models/statement_response_body'
90
97
  require 'mx-platform-ruby/models/statements_response_body'
data/openapi/config.yml CHANGED
@@ -6,6 +6,6 @@ gemHomepage: https://github.com/mxenabled/mx-platform-ruby
6
6
  gemLicense: MIT
7
7
  gemName: mx-platform-ruby
8
8
  gemRequiredRubyVersion: ">= 2.6"
9
- gemVersion: 0.9.2
9
+ gemVersion: 0.11.0
10
10
  library: faraday
11
11
  moduleName: MxPlatformRuby
@@ -38,7 +38,7 @@ Please follow the [installation](#installation) procedure and then run the follo
38
38
  ```ruby
39
39
  require 'mx-platform-ruby'
40
40
 
41
- MxPlatformRuby.configure do |config|
41
+ ::MxPlatformRuby.configure do |config|
42
42
  # Configure with your Client ID/API Key from https://dashboard.mx.com
43
43
  config.username = 'Your Client ID'
44
44
  config.password = 'Your API Key'
@@ -51,16 +51,16 @@ api_client = ::MxPlatformRuby::ApiClient.new
51
51
  api_client.default_headers['Accept'] = 'application/vnd.mx.api.v1+json'
52
52
  mx_platform_api = ::MxPlatformRuby::MxPlatformApi.new(api_client)
53
53
 
54
- user_create_request_body = MxPlatformRuby::UserCreateRequestBody.new(
55
- user: MxPlatformRuby::UserCreateRequest.new(
56
- metadata: "Creating a user!"
54
+ request_body = ::MxPlatformRuby::UserCreateRequestBody.new(
55
+ user: ::MxPlatformRuby::UserCreateRequest.new(
56
+ metadata: 'Creating a user!'
57
57
  )
58
58
  )
59
59
 
60
60
  begin
61
- result = mx_platform_api.create_user(user_create_request_body)
62
- p result
63
- rescue MxPlatformRuby::ApiError => e
61
+ response = mx_platform_api.create_user(request_body)
62
+ p response
63
+ rescue ::MxPlatformRuby::ApiError => e
64
64
  puts "Error when calling MxPlatformApi->create_user: #{e}"
65
65
  end
66
66
  ```