minty 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -16
- data/Gemfile.lock +28 -208
- data/README.md +58 -57
- data/Rakefile +4 -27
- data/docs/DefaultApi.md +217 -0
- data/docs/RedirectUrl.md +18 -0
- data/git_push.sh +57 -0
- data/lib/minty/api/default_api.rb +210 -0
- data/lib/minty/api_client.rb +388 -0
- data/lib/minty/api_error.rb +53 -0
- data/lib/minty/configuration.rb +275 -0
- data/lib/minty/models/redirect_url.rb +216 -0
- data/lib/minty/version.rb +9 -3
- data/lib/minty.rb +33 -7
- data/minty.gemspec +19 -32
- data/pkg/minty-1.1.0.gem +0 -0
- data/publish_rubygem.sh +1 -1
- data/spec/api/default_api_spec.rb +65 -0
- data/spec/api_client_spec.rb +222 -0
- data/spec/configuration_spec.rb +38 -0
- data/spec/models/redirect_url_spec.rb +28 -0
- data/spec/spec_helper.rb +95 -63
- metadata +37 -292
- data/.bundle/config +0 -4
- data/.devcontainer/Dockerfile +0 -19
- data/.devcontainer/devcontainer.json +0 -37
- data/.env.example +0 -2
- data/.gemrelease +0 -2
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -33
- data/.github/dependabot.yml +0 -10
- data/.github/stale.yml +0 -20
- data/.gitignore +0 -18
- data/.rspec +0 -3
- data/.rubocop.yml +0 -9
- data/CODE_OF_CONDUCT.md +0 -3
- data/DEPLOYMENT.md +0 -61
- data/DEVELOPMENT.md +0 -35
- data/EXAMPLES.md +0 -195
- data/Guardfile +0 -39
- data/LICENSE +0 -21
- data/Makefile +0 -5
- data/RUBYGEM.md +0 -9
- data/codecov.yml +0 -22
- data/lib/minty/algorithm.rb +0 -7
- data/lib/minty/api/authentication_endpoints.rb +0 -55
- data/lib/minty/api/v2.rb +0 -8
- data/lib/minty/client.rb +0 -7
- data/lib/minty/exception.rb +0 -58
- data/lib/minty/mixins/api_token_struct.rb +0 -4
- data/lib/minty/mixins/headers.rb +0 -19
- data/lib/minty/mixins/httpproxy.rb +0 -125
- data/lib/minty/mixins/initializer.rb +0 -38
- data/lib/minty/mixins/validation.rb +0 -113
- data/lib/minty/mixins.rb +0 -23
- data/lib/minty_client.rb +0 -4
- data/spec/integration/lib/minty/api/api_authentication_spec.rb +0 -122
- data/spec/integration/lib/minty/minty_client_spec.rb +0 -92
- data/spec/lib/minty/client_spec.rb +0 -223
- data/spec/lib/minty/mixins/httpproxy_spec.rb +0 -658
- data/spec/lib/minty/mixins/initializer_spec.rb +0 -121
- data/spec/lib/minty/mixins/token_management_spec.rb +0 -129
- data/spec/lib/minty/mixins/validation_spec.rb +0 -559
- data/spec/support/credentials.rb +0 -14
- data/spec/support/dummy_class.rb +0 -20
- data/spec/support/dummy_class_for_proxy.rb +0 -6
- data/spec/support/dummy_class_for_restclient.rb +0 -4
- data/spec/support/dummy_class_for_tokens.rb +0 -18
- data/spec/support/import_users.json +0 -13
- data/spec/support/stub_response.rb +0 -3
@@ -0,0 +1,275 @@
|
|
1
|
+
=begin
|
2
|
+
#Minty API
|
3
|
+
|
4
|
+
#Minty API
|
5
|
+
|
6
|
+
|
7
|
+
=end
|
8
|
+
|
9
|
+
module MintyApi
|
10
|
+
class Configuration
|
11
|
+
# Defines url scheme
|
12
|
+
attr_accessor :scheme
|
13
|
+
|
14
|
+
# Defines url host
|
15
|
+
attr_accessor :host
|
16
|
+
|
17
|
+
# Defines url base path
|
18
|
+
attr_accessor :base_path
|
19
|
+
|
20
|
+
# Define server configuration index
|
21
|
+
attr_accessor :server_index
|
22
|
+
|
23
|
+
# Define server operation configuration index
|
24
|
+
attr_accessor :server_operation_index
|
25
|
+
|
26
|
+
# Default server variables
|
27
|
+
attr_accessor :server_variables
|
28
|
+
|
29
|
+
# Default server operation variables
|
30
|
+
attr_accessor :server_operation_variables
|
31
|
+
|
32
|
+
# Defines API keys used with API Key authentications.
|
33
|
+
#
|
34
|
+
# @return [Hash] key: parameter name, value: parameter value (API key)
|
35
|
+
#
|
36
|
+
# @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
|
37
|
+
# config.api_key['api_key'] = 'xxx'
|
38
|
+
attr_accessor :api_key
|
39
|
+
|
40
|
+
# Defines API key prefixes used with API Key authentications.
|
41
|
+
#
|
42
|
+
# @return [Hash] key: parameter name, value: API key prefix
|
43
|
+
#
|
44
|
+
# @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
|
45
|
+
# config.api_key_prefix['api_key'] = 'Token'
|
46
|
+
attr_accessor :api_key_prefix
|
47
|
+
|
48
|
+
# Defines the username used with HTTP basic authentication.
|
49
|
+
#
|
50
|
+
# @return [String]
|
51
|
+
attr_accessor :username
|
52
|
+
|
53
|
+
# Defines the password used with HTTP basic authentication.
|
54
|
+
#
|
55
|
+
# @return [String]
|
56
|
+
attr_accessor :password
|
57
|
+
|
58
|
+
# Defines the access token (Bearer) used with OAuth2.
|
59
|
+
attr_accessor :access_token
|
60
|
+
|
61
|
+
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
62
|
+
# details will be logged with `logger.debug` (see the `logger` attribute).
|
63
|
+
# Default to false.
|
64
|
+
#
|
65
|
+
# @return [true, false]
|
66
|
+
attr_accessor :debugging
|
67
|
+
|
68
|
+
# Defines the logger used for debugging.
|
69
|
+
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
|
70
|
+
#
|
71
|
+
# @return [#debug]
|
72
|
+
attr_accessor :logger
|
73
|
+
|
74
|
+
# Defines the temporary folder to store downloaded files
|
75
|
+
# (for API endpoints that have file response).
|
76
|
+
# Default to use `Tempfile`.
|
77
|
+
#
|
78
|
+
# @return [String]
|
79
|
+
attr_accessor :temp_folder_path
|
80
|
+
|
81
|
+
# The time limit for HTTP request in seconds.
|
82
|
+
# Default to 0 (never times out).
|
83
|
+
attr_accessor :timeout
|
84
|
+
|
85
|
+
# Set this to false to skip client side validation in the operation.
|
86
|
+
# Default to true.
|
87
|
+
# @return [true, false]
|
88
|
+
attr_accessor :client_side_validation
|
89
|
+
|
90
|
+
### TLS/SSL setting
|
91
|
+
# Set this to false to skip verifying SSL certificate when calling API from https server.
|
92
|
+
# Default to true.
|
93
|
+
#
|
94
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
95
|
+
#
|
96
|
+
# @return [true, false]
|
97
|
+
attr_accessor :verify_ssl
|
98
|
+
|
99
|
+
### TLS/SSL setting
|
100
|
+
# Set this to false to skip verifying SSL host name
|
101
|
+
# Default to true.
|
102
|
+
#
|
103
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
104
|
+
#
|
105
|
+
# @return [true, false]
|
106
|
+
attr_accessor :verify_ssl_host
|
107
|
+
|
108
|
+
### TLS/SSL setting
|
109
|
+
# Set this to customize the certificate file to verify the peer.
|
110
|
+
#
|
111
|
+
# @return [String] the path to the certificate file
|
112
|
+
#
|
113
|
+
# @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
|
114
|
+
# https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
|
115
|
+
attr_accessor :ssl_ca_cert
|
116
|
+
|
117
|
+
### TLS/SSL setting
|
118
|
+
# Client certificate file (for client certificate)
|
119
|
+
attr_accessor :cert_file
|
120
|
+
|
121
|
+
### TLS/SSL setting
|
122
|
+
# Client private key file (for client certificate)
|
123
|
+
attr_accessor :key_file
|
124
|
+
|
125
|
+
# Set this to customize parameters encoding of array parameter with multi collectionFormat.
|
126
|
+
# Default to nil.
|
127
|
+
#
|
128
|
+
# @see The params_encoding option of Ethon. Related source code:
|
129
|
+
# https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
|
130
|
+
attr_accessor :params_encoding
|
131
|
+
|
132
|
+
|
133
|
+
attr_accessor :inject_format
|
134
|
+
|
135
|
+
attr_accessor :force_ending_format
|
136
|
+
|
137
|
+
def initialize
|
138
|
+
@scheme = 'http'
|
139
|
+
@host = 'localhost'
|
140
|
+
@base_path = ''
|
141
|
+
@server_index = 0
|
142
|
+
@server_operation_index = {}
|
143
|
+
@server_variables = {}
|
144
|
+
@server_operation_variables = {}
|
145
|
+
@api_key = {}
|
146
|
+
@api_key_prefix = {}
|
147
|
+
@client_side_validation = true
|
148
|
+
@verify_ssl = true
|
149
|
+
@verify_ssl_host = true
|
150
|
+
@cert_file = nil
|
151
|
+
@key_file = nil
|
152
|
+
@timeout = 0
|
153
|
+
@params_encoding = nil
|
154
|
+
@debugging = false
|
155
|
+
@inject_format = false
|
156
|
+
@force_ending_format = false
|
157
|
+
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
158
|
+
|
159
|
+
yield(self) if block_given?
|
160
|
+
end
|
161
|
+
|
162
|
+
# The default Configuration object.
|
163
|
+
def self.default
|
164
|
+
@@default ||= Configuration.new
|
165
|
+
end
|
166
|
+
|
167
|
+
def configure
|
168
|
+
yield(self) if block_given?
|
169
|
+
end
|
170
|
+
|
171
|
+
def scheme=(scheme)
|
172
|
+
# remove :// from scheme
|
173
|
+
@scheme = scheme.sub(/:\/\//, '')
|
174
|
+
end
|
175
|
+
|
176
|
+
def host=(host)
|
177
|
+
# remove http(s):// and anything after a slash
|
178
|
+
@host = host.sub(/https?:\/\//, '').split('/').first
|
179
|
+
end
|
180
|
+
|
181
|
+
def base_path=(base_path)
|
182
|
+
# Add leading and trailing slashes to base_path
|
183
|
+
@base_path = "/#{base_path}".gsub(/\/+/, '/')
|
184
|
+
@base_path = '' if @base_path == '/'
|
185
|
+
end
|
186
|
+
|
187
|
+
# Returns base URL for specified operation based on server settings
|
188
|
+
def base_url(operation = nil)
|
189
|
+
index = server_operation_index.fetch(operation, server_index)
|
190
|
+
return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil
|
191
|
+
|
192
|
+
server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
193
|
+
end
|
194
|
+
|
195
|
+
# Gets API key (with prefix if set).
|
196
|
+
# @param [String] param_name the parameter name of API key auth
|
197
|
+
def api_key_with_prefix(param_name, param_alias = nil)
|
198
|
+
key = @api_key[param_name]
|
199
|
+
key = @api_key.fetch(param_alias, key) unless param_alias.nil?
|
200
|
+
if @api_key_prefix[param_name]
|
201
|
+
"#{@api_key_prefix[param_name]} #{key}"
|
202
|
+
else
|
203
|
+
key
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
# Gets Basic Auth token string
|
208
|
+
def basic_auth_token
|
209
|
+
'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
|
210
|
+
end
|
211
|
+
|
212
|
+
# Returns Auth Settings hash for api client.
|
213
|
+
def auth_settings
|
214
|
+
{
|
215
|
+
'accessCode' =>
|
216
|
+
{
|
217
|
+
type: 'oauth2',
|
218
|
+
in: 'header',
|
219
|
+
key: 'Authorization',
|
220
|
+
value: "Bearer #{access_token}"
|
221
|
+
},
|
222
|
+
}
|
223
|
+
end
|
224
|
+
|
225
|
+
# Returns an array of Server setting
|
226
|
+
def server_settings
|
227
|
+
[
|
228
|
+
{
|
229
|
+
url: "",
|
230
|
+
description: "No description provided",
|
231
|
+
}
|
232
|
+
]
|
233
|
+
end
|
234
|
+
|
235
|
+
def operation_server_settings
|
236
|
+
{
|
237
|
+
}
|
238
|
+
end
|
239
|
+
|
240
|
+
# Returns URL based on server settings
|
241
|
+
#
|
242
|
+
# @param index array index of the server settings
|
243
|
+
# @param variables hash of variable and the corresponding value
|
244
|
+
def server_url(index, variables = {}, servers = nil)
|
245
|
+
servers = server_settings if servers == nil
|
246
|
+
|
247
|
+
# check array index out of bound
|
248
|
+
if (index < 0 || index >= servers.size)
|
249
|
+
fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
|
250
|
+
end
|
251
|
+
|
252
|
+
server = servers[index]
|
253
|
+
url = server[:url]
|
254
|
+
|
255
|
+
return url unless server.key? :variables
|
256
|
+
|
257
|
+
# go through variable and assign a value
|
258
|
+
server[:variables].each do |name, variable|
|
259
|
+
if variables.key?(name)
|
260
|
+
if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
|
261
|
+
url.gsub! "{" + name.to_s + "}", variables[name]
|
262
|
+
else
|
263
|
+
fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
|
264
|
+
end
|
265
|
+
else
|
266
|
+
# use default value
|
267
|
+
url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
url
|
272
|
+
end
|
273
|
+
|
274
|
+
end
|
275
|
+
end
|
@@ -0,0 +1,216 @@
|
|
1
|
+
=begin
|
2
|
+
#Minty API
|
3
|
+
|
4
|
+
#Minty API
|
5
|
+
|
6
|
+
|
7
|
+
=end
|
8
|
+
|
9
|
+
require 'date'
|
10
|
+
require 'time'
|
11
|
+
|
12
|
+
module MintyApi
|
13
|
+
class RedirectUrl
|
14
|
+
# The redirection URI.
|
15
|
+
attr_accessor :redirect_url
|
16
|
+
|
17
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
18
|
+
def self.attribute_map
|
19
|
+
{
|
20
|
+
:'redirect_url' => :'redirect_url'
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
# Returns all the JSON keys this model knows about
|
25
|
+
def self.acceptable_attributes
|
26
|
+
attribute_map.values
|
27
|
+
end
|
28
|
+
|
29
|
+
# Attribute type mapping.
|
30
|
+
def self.openapi_types
|
31
|
+
{
|
32
|
+
:'redirect_url' => :'String'
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
# List of attributes with nullable: true
|
37
|
+
def self.openapi_nullable
|
38
|
+
Set.new([
|
39
|
+
])
|
40
|
+
end
|
41
|
+
|
42
|
+
# Initializes the object
|
43
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
44
|
+
def initialize(attributes = {})
|
45
|
+
if (!attributes.is_a?(Hash))
|
46
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MintyApi::RedirectUrl` initialize method"
|
47
|
+
end
|
48
|
+
|
49
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
50
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
51
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
52
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MintyApi::RedirectUrl`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
53
|
+
end
|
54
|
+
h[k.to_sym] = v
|
55
|
+
}
|
56
|
+
|
57
|
+
if attributes.key?(:'redirect_url')
|
58
|
+
self.redirect_url = attributes[:'redirect_url']
|
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
|
+
redirect_url == o.redirect_url
|
81
|
+
end
|
82
|
+
|
83
|
+
# @see the `==` method
|
84
|
+
# @param [Object] Object to be compared
|
85
|
+
def eql?(o)
|
86
|
+
self == o
|
87
|
+
end
|
88
|
+
|
89
|
+
# Calculates hash code according to all attributes.
|
90
|
+
# @return [Integer] Hash code
|
91
|
+
def hash
|
92
|
+
[redirect_url].hash
|
93
|
+
end
|
94
|
+
|
95
|
+
# Builds the object from hash
|
96
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
97
|
+
# @return [Object] Returns the model itself
|
98
|
+
def self.build_from_hash(attributes)
|
99
|
+
new.build_from_hash(attributes)
|
100
|
+
end
|
101
|
+
|
102
|
+
# Builds the object from hash
|
103
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
104
|
+
# @return [Object] Returns the model itself
|
105
|
+
def build_from_hash(attributes)
|
106
|
+
return nil unless attributes.is_a?(Hash)
|
107
|
+
attributes = attributes.transform_keys(&:to_sym)
|
108
|
+
self.class.openapi_types.each_pair do |key, type|
|
109
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
110
|
+
self.send("#{key}=", nil)
|
111
|
+
elsif type =~ /\AArray<(.*)>/i
|
112
|
+
# check to ensure the input is an array given that the attribute
|
113
|
+
# is documented as an array but the input is not
|
114
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
115
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
116
|
+
end
|
117
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
118
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
self
|
123
|
+
end
|
124
|
+
|
125
|
+
# Deserializes the data based on type
|
126
|
+
# @param string type Data type
|
127
|
+
# @param string value Value to be deserialized
|
128
|
+
# @return [Object] Deserialized data
|
129
|
+
def _deserialize(type, value)
|
130
|
+
case type.to_sym
|
131
|
+
when :Time
|
132
|
+
Time.parse(value)
|
133
|
+
when :Date
|
134
|
+
Date.parse(value)
|
135
|
+
when :String
|
136
|
+
value.to_s
|
137
|
+
when :Integer
|
138
|
+
value.to_i
|
139
|
+
when :Float
|
140
|
+
value.to_f
|
141
|
+
when :Boolean
|
142
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
143
|
+
true
|
144
|
+
else
|
145
|
+
false
|
146
|
+
end
|
147
|
+
when :Object
|
148
|
+
# generic object (usually a Hash), return directly
|
149
|
+
value
|
150
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
151
|
+
inner_type = Regexp.last_match[:inner_type]
|
152
|
+
value.map { |v| _deserialize(inner_type, v) }
|
153
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
154
|
+
k_type = Regexp.last_match[:k_type]
|
155
|
+
v_type = Regexp.last_match[:v_type]
|
156
|
+
{}.tap do |hash|
|
157
|
+
value.each do |k, v|
|
158
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
else # model
|
162
|
+
# models (e.g. Pet) or oneOf
|
163
|
+
klass = MintyApi.const_get(type)
|
164
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
# Returns the string representation of the object
|
169
|
+
# @return [String] String presentation of the object
|
170
|
+
def to_s
|
171
|
+
to_hash.to_s
|
172
|
+
end
|
173
|
+
|
174
|
+
# to_body is an alias to to_hash (backward compatibility)
|
175
|
+
# @return [Hash] Returns the object in the form of hash
|
176
|
+
def to_body
|
177
|
+
to_hash
|
178
|
+
end
|
179
|
+
|
180
|
+
# Returns the object in the form of hash
|
181
|
+
# @return [Hash] Returns the object in the form of hash
|
182
|
+
def to_hash
|
183
|
+
hash = {}
|
184
|
+
self.class.attribute_map.each_pair do |attr, param|
|
185
|
+
value = self.send(attr)
|
186
|
+
if value.nil?
|
187
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
188
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
189
|
+
end
|
190
|
+
|
191
|
+
hash[param] = _to_hash(value)
|
192
|
+
end
|
193
|
+
hash
|
194
|
+
end
|
195
|
+
|
196
|
+
# Outputs non-array value in the form of hash
|
197
|
+
# For object, use to_hash. Otherwise, just return the value
|
198
|
+
# @param [Object] value Any valid value
|
199
|
+
# @return [Hash] Returns the value in the form of hash
|
200
|
+
def _to_hash(value)
|
201
|
+
if value.is_a?(Array)
|
202
|
+
value.compact.map { |v| _to_hash(v) }
|
203
|
+
elsif value.is_a?(Hash)
|
204
|
+
{}.tap do |hash|
|
205
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
206
|
+
end
|
207
|
+
elsif value.respond_to? :to_hash
|
208
|
+
value.to_hash
|
209
|
+
else
|
210
|
+
value
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
end
|
215
|
+
|
216
|
+
end
|
data/lib/minty/version.rb
CHANGED
data/lib/minty.rb
CHANGED
@@ -1,11 +1,37 @@
|
|
1
|
-
|
1
|
+
=begin
|
2
|
+
#Minty API
|
2
3
|
|
4
|
+
#Minty API
|
5
|
+
|
6
|
+
|
7
|
+
=end
|
8
|
+
|
9
|
+
# Common files
|
10
|
+
require 'minty/api_client'
|
11
|
+
require 'minty/api_error'
|
3
12
|
require 'minty/version'
|
4
|
-
require 'minty/
|
5
|
-
|
6
|
-
|
7
|
-
require 'minty/
|
8
|
-
|
13
|
+
require 'minty/configuration'
|
14
|
+
|
15
|
+
# Models
|
16
|
+
require 'minty/models/redirect_url'
|
17
|
+
|
18
|
+
# APIs
|
19
|
+
require 'minty/api/default_api'
|
9
20
|
|
10
|
-
module
|
21
|
+
module MintyApi
|
22
|
+
class << self
|
23
|
+
# Customize default settings for the SDK using block.
|
24
|
+
# MintyApi.configure do |config|
|
25
|
+
# config.username = "xxx"
|
26
|
+
# config.password = "xxx"
|
27
|
+
# end
|
28
|
+
# If no block given, return the default Configuration object.
|
29
|
+
def configure
|
30
|
+
if block_given?
|
31
|
+
yield(Configuration.default)
|
32
|
+
else
|
33
|
+
Configuration.default
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
11
37
|
end
|
data/minty.gemspec
CHANGED
@@ -1,39 +1,26 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
|
2
|
+
|
3
|
+
$:.push File.expand_path("../lib", __FILE__)
|
4
|
+
require "minty/version"
|
4
5
|
|
5
6
|
Gem::Specification.new do |s|
|
6
|
-
s.name =
|
7
|
-
s.version =
|
8
|
-
s.
|
9
|
-
s.
|
10
|
-
s.
|
11
|
-
s.
|
12
|
-
s.
|
7
|
+
s.name = "minty"
|
8
|
+
s.version = MintyApi::VERSION
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.authors = ["Minty"]
|
11
|
+
s.email = [""]
|
12
|
+
s.homepage = "https://www.minty.page"
|
13
|
+
s.summary = "Minty API Ruby Gem"
|
14
|
+
s.description = "Minty API"
|
15
|
+
s.license = "Unlicense"
|
16
|
+
s.required_ruby_version = ">= 2.4"
|
13
17
|
|
14
|
-
s.
|
15
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
17
|
-
s.require_paths = ['lib']
|
18
|
+
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
|
18
19
|
|
19
|
-
s.
|
20
|
-
s.add_runtime_dependency 'jwt', '~> 2.5'
|
21
|
-
s.add_runtime_dependency 'zache', '~> 0.12'
|
22
|
-
s.add_runtime_dependency 'addressable', '~> 2.8'
|
23
|
-
s.add_runtime_dependency 'retryable', '~> 3.0'
|
20
|
+
s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
|
24
21
|
|
25
|
-
s.
|
26
|
-
s.
|
27
|
-
s.
|
28
|
-
s.
|
29
|
-
s.add_development_dependency 'dotenv-rails', '~> 2.0'
|
30
|
-
s.add_development_dependency 'pry', '~> 0.10'
|
31
|
-
s.add_development_dependency 'pry-nav', '~> 0.2'
|
32
|
-
s.add_development_dependency 'rspec', '~> 3.11'
|
33
|
-
s.add_development_dependency 'rack-test', '~> 0.6'
|
34
|
-
s.add_development_dependency 'rack', '~> 2.1'
|
35
|
-
s.add_development_dependency 'simplecov', '~> 0.9'
|
36
|
-
s.add_development_dependency 'faker', '~> 2.0'
|
37
|
-
s.add_development_dependency 'gem-release', '~> 0.7'
|
38
|
-
s.license = 'MIT'
|
22
|
+
s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
|
23
|
+
s.test_files = `find spec/*`.split("\n")
|
24
|
+
s.executables = []
|
25
|
+
s.require_paths = ["lib"]
|
39
26
|
end
|
data/pkg/minty-1.1.0.gem
ADDED
Binary file
|
data/publish_rubygem.sh
CHANGED
@@ -5,6 +5,6 @@ mkdir /root/.gem
|
|
5
5
|
# Get API key from rubygems.org
|
6
6
|
curl -u "$RUBYGEMS_EMAIL":"$RUBYGEMS_PASSWORD" https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials; chmod 0600 ~/.gem/credentials
|
7
7
|
# Build Gem
|
8
|
-
gem build minty.gemspec
|
8
|
+
gem build minty-ruby.gemspec
|
9
9
|
# Publish Gem
|
10
10
|
gem push minty-*.gem
|
@@ -0,0 +1,65 @@
|
|
1
|
+
=begin
|
2
|
+
#Minty API
|
3
|
+
|
4
|
+
#Minty API
|
5
|
+
|
6
|
+
|
7
|
+
=end
|
8
|
+
|
9
|
+
require 'spec_helper'
|
10
|
+
require 'json'
|
11
|
+
|
12
|
+
# Unit tests for MintyApi::DefaultApi
|
13
|
+
describe 'DefaultApi' do
|
14
|
+
before do
|
15
|
+
# run before each test
|
16
|
+
@api_instance = MintyApi::DefaultApi.new
|
17
|
+
end
|
18
|
+
|
19
|
+
after do
|
20
|
+
# run after each test
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'test an instance of DefaultApi' do
|
24
|
+
it 'should create an instance of DefaultApi' do
|
25
|
+
expect(@api_instance).to be_instance_of(MintyApi::DefaultApi)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# unit tests for api_v1_forgot_password_url_get
|
30
|
+
# forgot_password_url
|
31
|
+
# forgot_password_url
|
32
|
+
# @param api_minty_application_id
|
33
|
+
# @param [Hash] opts the optional parameters
|
34
|
+
# @return [RedirectUrl]
|
35
|
+
describe 'api_v1_forgot_password_url_get test' do
|
36
|
+
it 'should work' do
|
37
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# unit tests for api_v1_sign_in_url_get
|
42
|
+
# sign_in_url summary
|
43
|
+
# sign_in_url description
|
44
|
+
# @param api_minty_application_id
|
45
|
+
# @param [Hash] opts the optional parameters
|
46
|
+
# @return [RedirectUrl]
|
47
|
+
describe 'api_v1_sign_in_url_get test' do
|
48
|
+
it 'should work' do
|
49
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# unit tests for api_v1_sign_up_url_get
|
54
|
+
# sign_up_url
|
55
|
+
# sign_up_url
|
56
|
+
# @param api_minty_application_id
|
57
|
+
# @param [Hash] opts the optional parameters
|
58
|
+
# @return [RedirectUrl]
|
59
|
+
describe 'api_v1_sign_up_url_get test' do
|
60
|
+
it 'should work' do
|
61
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|