swagger_test 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,202 @@
1
+ =begin
2
+ #A title for your API
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.6-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'uri'
14
+
15
+ module Kount
16
+ class Configuration
17
+ # Defines url scheme
18
+ attr_accessor :scheme
19
+
20
+ # Defines url host
21
+ attr_accessor :host
22
+
23
+ # Defines url base path
24
+ attr_accessor :base_path
25
+
26
+ # Defines API keys used with API Key authentications.
27
+ #
28
+ # @return [Hash] key: parameter name, value: parameter value (API key)
29
+ #
30
+ # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
31
+ # config.api_key['api_key'] = 'xxx'
32
+ attr_accessor :api_key
33
+
34
+ # Defines API key prefixes used with API Key authentications.
35
+ #
36
+ # @return [Hash] key: parameter name, value: API key prefix
37
+ #
38
+ # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
39
+ # config.api_key_prefix['api_key'] = 'Token'
40
+ attr_accessor :api_key_prefix
41
+
42
+ # Defines the username used with HTTP basic authentication.
43
+ #
44
+ # @return [String]
45
+ attr_accessor :username
46
+
47
+ # Defines the password used with HTTP basic authentication.
48
+ #
49
+ # @return [String]
50
+ attr_accessor :password
51
+
52
+ # Defines the access token (Bearer) used with OAuth2.
53
+ attr_accessor :access_token
54
+
55
+ # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
56
+ # details will be logged with `logger.debug` (see the `logger` attribute).
57
+ # Default to false.
58
+ #
59
+ # @return [true, false]
60
+ attr_accessor :debugging
61
+
62
+ # Defines the logger used for debugging.
63
+ # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
64
+ #
65
+ # @return [#debug]
66
+ attr_accessor :logger
67
+
68
+ # Defines the temporary folder to store downloaded files
69
+ # (for API endpoints that have file response).
70
+ # Default to use `Tempfile`.
71
+ #
72
+ # @return [String]
73
+ attr_accessor :temp_folder_path
74
+
75
+ # The time limit for HTTP request in seconds.
76
+ # Default to 0 (never times out).
77
+ attr_accessor :timeout
78
+
79
+ # Set this to false to skip client side validation in the operation.
80
+ # Default to true.
81
+ # @return [true, false]
82
+ attr_accessor :client_side_validation
83
+
84
+ ### TLS/SSL setting
85
+ # Set this to false to skip verifying SSL certificate when calling API from https server.
86
+ # Default to true.
87
+ #
88
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
89
+ #
90
+ # @return [true, false]
91
+ attr_accessor :verify_ssl
92
+
93
+ ### TLS/SSL setting
94
+ # Set this to false to skip verifying SSL host name
95
+ # Default to true.
96
+ #
97
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
98
+ #
99
+ # @return [true, false]
100
+ attr_accessor :verify_ssl_host
101
+
102
+ ### TLS/SSL setting
103
+ # Set this to customize the certificate file to verify the peer.
104
+ #
105
+ # @return [String] the path to the certificate file
106
+ #
107
+ # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
108
+ # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
109
+ attr_accessor :ssl_ca_cert
110
+
111
+ ### TLS/SSL setting
112
+ # Client certificate file (for client certificate)
113
+ attr_accessor :cert_file
114
+
115
+ ### TLS/SSL setting
116
+ # Client private key file (for client certificate)
117
+ attr_accessor :key_file
118
+
119
+ # Set this to customize parameters encoding of array parameter with multi collectionFormat.
120
+ # Default to nil.
121
+ #
122
+ # @see The params_encoding option of Ethon. Related source code:
123
+ # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
124
+ attr_accessor :params_encoding
125
+
126
+ attr_accessor :inject_format
127
+
128
+ attr_accessor :force_ending_format
129
+
130
+ def initialize
131
+ @scheme = 'http'
132
+ @host = 'localhost:51122'
133
+ @base_path = ''
134
+ @api_key = {}
135
+ @api_key_prefix = {}
136
+ @timeout = 0
137
+ @client_side_validation = true
138
+ @verify_ssl = true
139
+ @verify_ssl_host = true
140
+ @params_encoding = nil
141
+ @cert_file = nil
142
+ @key_file = nil
143
+ @debugging = false
144
+ @inject_format = false
145
+ @force_ending_format = false
146
+ @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
147
+
148
+ yield(self) if block_given?
149
+ end
150
+
151
+ # The default Configuration object.
152
+ def self.default
153
+ @@default ||= Configuration.new
154
+ end
155
+
156
+ def configure
157
+ yield(self) if block_given?
158
+ end
159
+
160
+ def scheme=(scheme)
161
+ # remove :// from scheme
162
+ @scheme = scheme.sub(/:\/\//, '')
163
+ end
164
+
165
+ def host=(host)
166
+ # remove http(s):// and anything after a slash
167
+ @host = host.sub(/https?:\/\//, '').split('/').first
168
+ end
169
+
170
+ def base_path=(base_path)
171
+ # Add leading and trailing slashes to base_path
172
+ @base_path = "/#{base_path}".gsub(/\/+/, '/')
173
+ @base_path = '' if @base_path == '/'
174
+ end
175
+
176
+ def base_url
177
+ url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
178
+ URI.encode(url)
179
+ end
180
+
181
+ # Gets API key (with prefix if set).
182
+ # @param [String] param_name the parameter name of API key auth
183
+ def api_key_with_prefix(param_name)
184
+ if @api_key_prefix[param_name]
185
+ "#{@api_key_prefix[param_name]} #{@api_key[param_name]}"
186
+ else
187
+ @api_key[param_name]
188
+ end
189
+ end
190
+
191
+ # Gets Basic Auth token string
192
+ def basic_auth_token
193
+ 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
194
+ end
195
+
196
+ # Returns Auth Settings hash for api client.
197
+ def auth_settings
198
+ {
199
+ }
200
+ end
201
+ end
202
+ end
@@ -0,0 +1,309 @@
1
+ =begin
2
+ #A title for your API
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.6-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Kount
16
+ class ProductDetails
17
+ attr_accessor :merchant_id
18
+
19
+ attr_accessor :api_key
20
+
21
+ attr_accessor :url
22
+
23
+ attr_accessor :version
24
+
25
+ attr_accessor :card_no
26
+
27
+ attr_accessor :total
28
+
29
+ attr_accessor :ip_address
30
+
31
+ attr_accessor :email
32
+
33
+ attr_accessor :session_id
34
+
35
+ attr_accessor :mack
36
+
37
+ attr_accessor :product_type
38
+
39
+ attr_accessor :product_item
40
+
41
+ attr_accessor :product_description
42
+
43
+ attr_accessor :product_quantity
44
+
45
+ attr_accessor :product_price
46
+
47
+ # Attribute mapping from ruby-style variable name to JSON key.
48
+ def self.attribute_map
49
+ {
50
+ :'merchant_id' => :'merchantId',
51
+ :'api_key' => :'apiKey',
52
+ :'url' => :'url',
53
+ :'version' => :'version',
54
+ :'card_no' => :'cardNo',
55
+ :'total' => :'total',
56
+ :'ip_address' => :'ipAddress',
57
+ :'email' => :'email',
58
+ :'session_id' => :'sessionId',
59
+ :'mack' => :'mack',
60
+ :'product_type' => :'productType',
61
+ :'product_item' => :'productItem',
62
+ :'product_description' => :'productDescription',
63
+ :'product_quantity' => :'productQuantity',
64
+ :'product_price' => :'productPrice'
65
+ }
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.swagger_types
70
+ {
71
+ :'merchant_id' => :'Integer',
72
+ :'api_key' => :'String',
73
+ :'url' => :'String',
74
+ :'version' => :'String',
75
+ :'card_no' => :'String',
76
+ :'total' => :'Integer',
77
+ :'ip_address' => :'String',
78
+ :'email' => :'String',
79
+ :'session_id' => :'String',
80
+ :'mack' => :'String',
81
+ :'product_type' => :'String',
82
+ :'product_item' => :'String',
83
+ :'product_description' => :'String',
84
+ :'product_quantity' => :'Integer',
85
+ :'product_price' => :'Integer'
86
+ }
87
+ end
88
+
89
+ # Initializes the object
90
+ # @param [Hash] attributes Model attributes in the form of hash
91
+ def initialize(attributes = {})
92
+ return unless attributes.is_a?(Hash)
93
+
94
+ # convert string to symbol for hash key
95
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
96
+
97
+ if attributes.has_key?(:'merchantId')
98
+ self.merchant_id = attributes[:'merchantId']
99
+ end
100
+
101
+ if attributes.has_key?(:'apiKey')
102
+ self.api_key = attributes[:'apiKey']
103
+ end
104
+
105
+ if attributes.has_key?(:'url')
106
+ self.url = attributes[:'url']
107
+ end
108
+
109
+ if attributes.has_key?(:'version')
110
+ self.version = attributes[:'version']
111
+ end
112
+
113
+ if attributes.has_key?(:'cardNo')
114
+ self.card_no = attributes[:'cardNo']
115
+ end
116
+
117
+ if attributes.has_key?(:'total')
118
+ self.total = attributes[:'total']
119
+ end
120
+
121
+ if attributes.has_key?(:'ipAddress')
122
+ self.ip_address = attributes[:'ipAddress']
123
+ end
124
+
125
+ if attributes.has_key?(:'email')
126
+ self.email = attributes[:'email']
127
+ end
128
+
129
+ if attributes.has_key?(:'sessionId')
130
+ self.session_id = attributes[:'sessionId']
131
+ end
132
+
133
+ if attributes.has_key?(:'mack')
134
+ self.mack = attributes[:'mack']
135
+ end
136
+
137
+ if attributes.has_key?(:'productType')
138
+ self.product_type = attributes[:'productType']
139
+ end
140
+
141
+ if attributes.has_key?(:'productItem')
142
+ self.product_item = attributes[:'productItem']
143
+ end
144
+
145
+ if attributes.has_key?(:'productDescription')
146
+ self.product_description = attributes[:'productDescription']
147
+ end
148
+
149
+ if attributes.has_key?(:'productQuantity')
150
+ self.product_quantity = attributes[:'productQuantity']
151
+ end
152
+
153
+ if attributes.has_key?(:'productPrice')
154
+ self.product_price = attributes[:'productPrice']
155
+ end
156
+ end
157
+
158
+ # Show invalid properties with the reasons. Usually used together with valid?
159
+ # @return Array for valid properties with the reasons
160
+ def list_invalid_properties
161
+ invalid_properties = Array.new
162
+ invalid_properties
163
+ end
164
+
165
+ # Check to see if the all the properties in the model are valid
166
+ # @return true if the model is valid
167
+ def valid?
168
+ true
169
+ end
170
+
171
+ # Checks equality by comparing each attribute.
172
+ # @param [Object] Object to be compared
173
+ def ==(o)
174
+ return true if self.equal?(o)
175
+ self.class == o.class &&
176
+ merchant_id == o.merchant_id &&
177
+ api_key == o.api_key &&
178
+ url == o.url &&
179
+ version == o.version &&
180
+ card_no == o.card_no &&
181
+ total == o.total &&
182
+ ip_address == o.ip_address &&
183
+ email == o.email &&
184
+ session_id == o.session_id &&
185
+ mack == o.mack &&
186
+ product_type == o.product_type &&
187
+ product_item == o.product_item &&
188
+ product_description == o.product_description &&
189
+ product_quantity == o.product_quantity &&
190
+ product_price == o.product_price
191
+ end
192
+
193
+ # @see the `==` method
194
+ # @param [Object] Object to be compared
195
+ def eql?(o)
196
+ self == o
197
+ end
198
+
199
+ # Calculates hash code according to all attributes.
200
+ # @return [Fixnum] Hash code
201
+ def hash
202
+ [merchant_id, api_key, url, version, card_no, total, ip_address, email, session_id, mack, product_type, product_item, product_description, product_quantity, product_price].hash
203
+ end
204
+
205
+ # Builds the object from hash
206
+ # @param [Hash] attributes Model attributes in the form of hash
207
+ # @return [Object] Returns the model itself
208
+ def build_from_hash(attributes)
209
+ return nil unless attributes.is_a?(Hash)
210
+ self.class.swagger_types.each_pair do |key, type|
211
+ if type =~ /\AArray<(.*)>/i
212
+ # check to ensure the input is an array given that the the attribute
213
+ # is documented as an array but the input is not
214
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
215
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
216
+ end
217
+ elsif !attributes[self.class.attribute_map[key]].nil?
218
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
219
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
220
+ end
221
+
222
+ self
223
+ end
224
+
225
+ # Deserializes the data based on type
226
+ # @param string type Data type
227
+ # @param string value Value to be deserialized
228
+ # @return [Object] Deserialized data
229
+ def _deserialize(type, value)
230
+ case type.to_sym
231
+ when :DateTime
232
+ DateTime.parse(value)
233
+ when :Date
234
+ Date.parse(value)
235
+ when :String
236
+ value.to_s
237
+ when :Integer
238
+ value.to_i
239
+ when :Float
240
+ value.to_f
241
+ when :BOOLEAN
242
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
243
+ true
244
+ else
245
+ false
246
+ end
247
+ when :Object
248
+ # generic object (usually a Hash), return directly
249
+ value
250
+ when /\AArray<(?<inner_type>.+)>\z/
251
+ inner_type = Regexp.last_match[:inner_type]
252
+ value.map { |v| _deserialize(inner_type, v) }
253
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
254
+ k_type = Regexp.last_match[:k_type]
255
+ v_type = Regexp.last_match[:v_type]
256
+ {}.tap do |hash|
257
+ value.each do |k, v|
258
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
259
+ end
260
+ end
261
+ else # model
262
+ temp_model = Kount.const_get(type).new
263
+ temp_model.build_from_hash(value)
264
+ end
265
+ end
266
+
267
+ # Returns the string representation of the object
268
+ # @return [String] String presentation of the object
269
+ def to_s
270
+ to_hash.to_s
271
+ end
272
+
273
+ # to_body is an alias to to_hash (backward compatibility)
274
+ # @return [Hash] Returns the object in the form of hash
275
+ def to_body
276
+ to_hash
277
+ end
278
+
279
+ # Returns the object in the form of hash
280
+ # @return [Hash] Returns the object in the form of hash
281
+ def to_hash
282
+ hash = {}
283
+ self.class.attribute_map.each_pair do |attr, param|
284
+ value = self.send(attr)
285
+ next if value.nil?
286
+ hash[param] = _to_hash(value)
287
+ end
288
+ hash
289
+ end
290
+
291
+ # Outputs non-array value in the form of hash
292
+ # For object, use to_hash. Otherwise, just return the value
293
+ # @param [Object] value Any valid value
294
+ # @return [Hash] Returns the value in the form of hash
295
+ def _to_hash(value)
296
+ if value.is_a?(Array)
297
+ value.compact.map { |v| _to_hash(v) }
298
+ elsif value.is_a?(Hash)
299
+ {}.tap do |hash|
300
+ value.each { |k, v| hash[k] = _to_hash(v) }
301
+ end
302
+ elsif value.respond_to? :to_hash
303
+ value.to_hash
304
+ else
305
+ value
306
+ end
307
+ end
308
+ end
309
+ end
@@ -0,0 +1,15 @@
1
+ =begin
2
+ #A title for your API
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.6-SNAPSHOT
10
+
11
+ =end
12
+
13
+ module Kount
14
+ VERSION = '1.0.0'
15
+ end
data/lib/kount.rb ADDED
@@ -0,0 +1,41 @@
1
+ =begin
2
+ #A title for your API
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.6-SNAPSHOT
10
+
11
+ =end
12
+
13
+ # Common files
14
+ require 'kount/api_client'
15
+ require 'kount/api_error'
16
+ require 'kount/version'
17
+ require 'kount/configuration'
18
+
19
+ # Models
20
+ require 'kount/models/product_details'
21
+
22
+ # APIs
23
+ require 'kount/api/kount_ris_app_api'
24
+
25
+ module Kount
26
+ class << self
27
+ # Customize default settings for the SDK using block.
28
+ # Kount.configure do |config|
29
+ # config.username = "xxx"
30
+ # config.password = "xxx"
31
+ # end
32
+ # If no block given, return the default Configuration object.
33
+ def configure
34
+ if block_given?
35
+ yield(Configuration.default)
36
+ else
37
+ Configuration.default
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,85 @@
1
+ =begin
2
+ #A title for your API
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.6-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for Kount::KountRisAppApi
17
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
+ # Please update as you see appropriate
19
+ describe 'KountRisAppApi' do
20
+ before do
21
+ # run before each test
22
+ @instance = Kount::KountRisAppApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of KountRisAppApi' do
30
+ it 'should create an instance of KountRisAppApi' do
31
+ expect(@instance).to be_instance_of(Kount::KountRisAppApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for kount_ris_app_delete
36
+ # @param id
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [nil]
39
+ describe 'kount_ris_app_delete test' do
40
+ it 'should work' do
41
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
42
+ end
43
+ end
44
+
45
+ # unit tests for kount_ris_app_get
46
+ # @param [Hash] opts the optional parameters
47
+ # @return [String]
48
+ describe 'kount_ris_app_get test' do
49
+ it 'should work' do
50
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
51
+ end
52
+ end
53
+
54
+ # unit tests for kount_ris_app_get_0
55
+ # @param id
56
+ # @param [Hash] opts the optional parameters
57
+ # @return [String]
58
+ describe 'kount_ris_app_get_0 test' do
59
+ it 'should work' do
60
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
61
+ end
62
+ end
63
+
64
+ # unit tests for kount_ris_app_post
65
+ # @param _product_details
66
+ # @param [Hash] opts the optional parameters
67
+ # @return [String]
68
+ describe 'kount_ris_app_post test' do
69
+ it 'should work' do
70
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
71
+ end
72
+ end
73
+
74
+ # unit tests for kount_ris_app_put
75
+ # @param id
76
+ # @param value
77
+ # @param [Hash] opts the optional parameters
78
+ # @return [nil]
79
+ describe 'kount_ris_app_put test' do
80
+ it 'should work' do
81
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
82
+ end
83
+ end
84
+
85
+ end