colorado-booth-sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +202 -0
- data/bin/console +15 -0
- data/lib/multi_auth_sample/api_helper.rb +10 -0
- data/lib/multi_auth_sample/client.rb +118 -0
- data/lib/multi_auth_sample/configuration.rb +262 -0
- data/lib/multi_auth_sample/controllers/authentication_controller.rb +149 -0
- data/lib/multi_auth_sample/controllers/base_controller.rb +60 -0
- data/lib/multi_auth_sample/controllers/o_auth_authorization_controller.rb +188 -0
- data/lib/multi_auth_sample/exceptions/api_exception.rb +21 -0
- data/lib/multi_auth_sample/exceptions/o_auth_provider_exception.rb +64 -0
- data/lib/multi_auth_sample/http/auth/api_header.rb +59 -0
- data/lib/multi_auth_sample/http/auth/api_key.rb +59 -0
- data/lib/multi_auth_sample/http/auth/basic_auth.rb +62 -0
- data/lib/multi_auth_sample/http/auth/custom_auth.rb +40 -0
- data/lib/multi_auth_sample/http/auth/o_auth_acg.rb +163 -0
- data/lib/multi_auth_sample/http/auth/o_auth_bearer_token.rb +53 -0
- data/lib/multi_auth_sample/http/auth/o_auth_ccg.rb +148 -0
- data/lib/multi_auth_sample/http/auth/o_auth_ropcg.rb +139 -0
- data/lib/multi_auth_sample/http/http_call_back.rb +10 -0
- data/lib/multi_auth_sample/http/http_method_enum.rb +10 -0
- data/lib/multi_auth_sample/http/http_request.rb +10 -0
- data/lib/multi_auth_sample/http/http_response.rb +10 -0
- data/lib/multi_auth_sample/http/proxy_settings.rb +22 -0
- data/lib/multi_auth_sample/models/base_model.rb +122 -0
- data/lib/multi_auth_sample/models/o_auth_provider_error_enum.rb +62 -0
- data/lib/multi_auth_sample/models/o_auth_scope_o_auth_acg_enum.rb +26 -0
- data/lib/multi_auth_sample/models/o_auth_token.rb +106 -0
- data/lib/multi_auth_sample/models/service_status.rb +140 -0
- data/lib/multi_auth_sample/models/suite_code_enum.rb +50 -0
- data/lib/multi_auth_sample/models/user.rb +111 -0
- data/lib/multi_auth_sample/utilities/date_time_helper.rb +11 -0
- data/lib/multi_auth_sample/utilities/file_wrapper.rb +28 -0
- data/lib/multi_auth_sample.rb +55 -0
- data/test/controllers/controller_test_base.rb +60 -0
- data/test/controllers/test_authentication_controller.rb +110 -0
- data/test/http_response_catcher.rb +19 -0
- metadata +150 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# multi_auth_sample
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0
|
|
4
|
+
# ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module MultiAuthSample
|
|
7
|
+
# Base model.
|
|
8
|
+
# rubocop:disable all
|
|
9
|
+
class BaseModel < CoreLibrary::BaseModel
|
|
10
|
+
# Returns a Hash representation of the current object.
|
|
11
|
+
def to_hash
|
|
12
|
+
# validating the model being serialized
|
|
13
|
+
self.class.validate(self) if self.class.respond_to?(:validate)
|
|
14
|
+
|
|
15
|
+
hash = {}
|
|
16
|
+
instance_variables.each do |name|
|
|
17
|
+
value = instance_variable_get(name)
|
|
18
|
+
name = name[1..]
|
|
19
|
+
if name == 'additional_properties'
|
|
20
|
+
additional_properties = process_additional_properties(value, self.class.names)
|
|
21
|
+
hash.merge!(additional_properties)
|
|
22
|
+
else
|
|
23
|
+
key = self.class.names.key?(name) ? self.class.names[name] : name
|
|
24
|
+
optional_fields = self.class.optionals
|
|
25
|
+
nullable_fields = self.class.nullables
|
|
26
|
+
if value.nil?
|
|
27
|
+
next unless nullable_fields.include?(name)
|
|
28
|
+
|
|
29
|
+
if !optional_fields.include?(name) && !nullable_fields.include?(name)
|
|
30
|
+
raise ArgumentError,
|
|
31
|
+
"`#{name}` cannot be nil in `#{self.class}`. Please specify a valid value."
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
hash[key] = nil
|
|
36
|
+
unless value.nil?
|
|
37
|
+
if respond_to?("to_custom_#{name}")
|
|
38
|
+
if (value.instance_of? Array) || (value.instance_of? Hash)
|
|
39
|
+
params = [hash, key]
|
|
40
|
+
hash[key] = send("to_custom_#{name}", *params)
|
|
41
|
+
else
|
|
42
|
+
hash[key] = send("to_custom_#{name}")
|
|
43
|
+
end
|
|
44
|
+
elsif respond_to?("to_union_type_#{name}")
|
|
45
|
+
hash[key] = send("to_union_type_#{name}")
|
|
46
|
+
elsif value.instance_of? Array
|
|
47
|
+
hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
|
|
48
|
+
elsif value.instance_of? Hash
|
|
49
|
+
hash[key] = {}
|
|
50
|
+
value.each do |k, v|
|
|
51
|
+
hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
|
|
52
|
+
end
|
|
53
|
+
else
|
|
54
|
+
hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
hash
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Processes additional properties, ensuring no conflicts with existing properties.
|
|
63
|
+
def process_additional_properties(additional_properties, existing_prop_names)
|
|
64
|
+
hash = {}
|
|
65
|
+
additional_properties.each do |name, value|
|
|
66
|
+
check_for_conflict(name, existing_prop_names)
|
|
67
|
+
|
|
68
|
+
hash[name] = if value.is_a?(Array)
|
|
69
|
+
process_array(value)
|
|
70
|
+
elsif value.is_a?(Hash)
|
|
71
|
+
process_hash(value)
|
|
72
|
+
else
|
|
73
|
+
process_basic_value(value)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
hash
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Checks if an additional property conflicts with a model's existing property.
|
|
80
|
+
def check_for_conflict(name, existing_prop_names)
|
|
81
|
+
return unless existing_prop_names.key?(name)
|
|
82
|
+
|
|
83
|
+
raise ArgumentError, "An additional property key, '#{name}' conflicts with one of the model's properties"
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Processes an array of values, recursively calling `to_hash` on BaseModel objects.
|
|
87
|
+
def process_array(value)
|
|
88
|
+
value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Processes a hash of values, recursively calling `to_hash` on BaseModel objects.
|
|
92
|
+
def process_hash(value)
|
|
93
|
+
value.transform_values do |v|
|
|
94
|
+
v.is_a?(BaseModel) ? v.to_hash : v
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Processes a basic value (non-array, non-hash).
|
|
99
|
+
def process_basic_value(value)
|
|
100
|
+
value.is_a?(BaseModel) ? value.to_hash : value
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Returns a JSON representation of the curent object.
|
|
104
|
+
def to_json(options = {})
|
|
105
|
+
hash = to_hash
|
|
106
|
+
hash.to_json(options)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def get_additional_properties
|
|
110
|
+
# Collect all additional properties
|
|
111
|
+
additional_props = instance_variables.each_with_object({}) do |var, hash|
|
|
112
|
+
var_name = var.to_s.delete('@').to_sym
|
|
113
|
+
if !self.class.names.key?(var_name.to_s)
|
|
114
|
+
hash[var_name] = instance_variable_get(var)
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
additional_props
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
# rubocop:enable all
|
|
122
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# multi_auth_sample
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0
|
|
4
|
+
# ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module MultiAuthSample
|
|
7
|
+
# OAuth 2 Authorization error codes
|
|
8
|
+
class OAuthProviderErrorEnum
|
|
9
|
+
O_AUTH_PROVIDER_ERROR_ENUM = [
|
|
10
|
+
# The request is missing a required parameter, includes an unsupported
|
|
11
|
+
# parameter value (other than grant type), repeats a parameter, includes
|
|
12
|
+
# multiple credentials, utilizes more than one mechanism for
|
|
13
|
+
# authenticating the client, or is otherwise malformed.
|
|
14
|
+
INVALID_REQUEST = 'invalid_request'.freeze,
|
|
15
|
+
|
|
16
|
+
# Client authentication failed (e.g., unknown client, no client
|
|
17
|
+
# authentication included, or unsupported authentication method).
|
|
18
|
+
INVALID_CLIENT = 'invalid_client'.freeze,
|
|
19
|
+
|
|
20
|
+
# The provided authorization grant (e.g., authorization code, resource
|
|
21
|
+
# owner credentials) or refresh token is invalid, expired, revoked, does
|
|
22
|
+
# not match the redirection URI used in the authorization request, or was
|
|
23
|
+
# issued to another client.
|
|
24
|
+
INVALID_GRANT = 'invalid_grant'.freeze,
|
|
25
|
+
|
|
26
|
+
# The authenticated client is not authorized to use this authorization
|
|
27
|
+
# grant type.
|
|
28
|
+
UNAUTHORIZED_CLIENT = 'unauthorized_client'.freeze,
|
|
29
|
+
|
|
30
|
+
# The authorization grant type is not supported by the authorization
|
|
31
|
+
# server.
|
|
32
|
+
UNSUPPORTED_GRANT_TYPE = 'unsupported_grant_type'.freeze,
|
|
33
|
+
|
|
34
|
+
# The requested scope is invalid, unknown, malformed, or exceeds the scope
|
|
35
|
+
# granted by the resource owner.
|
|
36
|
+
INVALID_SCOPE = 'invalid_scope'.freeze
|
|
37
|
+
].freeze
|
|
38
|
+
|
|
39
|
+
def self.validate(value)
|
|
40
|
+
return false if value.nil?
|
|
41
|
+
|
|
42
|
+
O_AUTH_PROVIDER_ERROR_ENUM.include?(value)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def self.from_value(value, default_value = INVALID_REQUEST)
|
|
46
|
+
return default_value if value.nil?
|
|
47
|
+
|
|
48
|
+
str = value.to_s.strip
|
|
49
|
+
|
|
50
|
+
case str.downcase
|
|
51
|
+
when 'invalid_request' then INVALID_REQUEST
|
|
52
|
+
when 'invalid_client' then INVALID_CLIENT
|
|
53
|
+
when 'invalid_grant' then INVALID_GRANT
|
|
54
|
+
when 'unauthorized_client' then UNAUTHORIZED_CLIENT
|
|
55
|
+
when 'unsupported_grant_type' then UNSUPPORTED_GRANT_TYPE
|
|
56
|
+
when 'invalid_scope' then INVALID_SCOPE
|
|
57
|
+
else
|
|
58
|
+
default_value
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# multi_auth_sample
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0
|
|
4
|
+
# ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module MultiAuthSample
|
|
7
|
+
# OAuth 2 scopes supported by the API
|
|
8
|
+
class OAuthScopeOAuthACGEnum
|
|
9
|
+
O_AUTH_SCOPE_O_AUTH_ACG_ENUM = [
|
|
10
|
+
# Read request for files
|
|
11
|
+
READ_SCOPE = 'file_requests.read'.freeze
|
|
12
|
+
].freeze
|
|
13
|
+
|
|
14
|
+
def self.validate(value)
|
|
15
|
+
return false if value.nil?
|
|
16
|
+
|
|
17
|
+
O_AUTH_SCOPE_O_AUTH_ACG_ENUM.include?(value)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.from_value(value, default_value = READ_SCOPE)
|
|
21
|
+
return default_value if value.nil?
|
|
22
|
+
|
|
23
|
+
default_value
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# multi_auth_sample
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0
|
|
4
|
+
# ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module MultiAuthSample
|
|
7
|
+
# OAuth 2 Authorization endpoint response
|
|
8
|
+
class OAuthToken < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Access token
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :access_token
|
|
15
|
+
|
|
16
|
+
# Type of access token
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :token_type
|
|
19
|
+
|
|
20
|
+
# Time in seconds before the access token expires
|
|
21
|
+
# @return [Integer]
|
|
22
|
+
attr_accessor :expires_in
|
|
23
|
+
|
|
24
|
+
# List of scopes granted
|
|
25
|
+
# This is a space-delimited list of strings.
|
|
26
|
+
# @return [String]
|
|
27
|
+
attr_accessor :scope
|
|
28
|
+
|
|
29
|
+
# Time of token expiry as unix timestamp (UTC)
|
|
30
|
+
# @return [Integer]
|
|
31
|
+
attr_accessor :expiry
|
|
32
|
+
|
|
33
|
+
# Refresh token
|
|
34
|
+
# Used to get a new access token when it expires.
|
|
35
|
+
# @return [String]
|
|
36
|
+
attr_accessor :refresh_token
|
|
37
|
+
|
|
38
|
+
# A mapping from model property names to API property names.
|
|
39
|
+
def self.names
|
|
40
|
+
@_hash = {} if @_hash.nil?
|
|
41
|
+
@_hash['access_token'] = 'access_token'
|
|
42
|
+
@_hash['token_type'] = 'token_type'
|
|
43
|
+
@_hash['expires_in'] = 'expires_in'
|
|
44
|
+
@_hash['scope'] = 'scope'
|
|
45
|
+
@_hash['expiry'] = 'expiry'
|
|
46
|
+
@_hash['refresh_token'] = 'refresh_token'
|
|
47
|
+
@_hash
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# An array for optional fields
|
|
51
|
+
def self.optionals
|
|
52
|
+
%w[
|
|
53
|
+
expires_in
|
|
54
|
+
scope
|
|
55
|
+
expiry
|
|
56
|
+
refresh_token
|
|
57
|
+
]
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# An array for nullable fields
|
|
61
|
+
def self.nullables
|
|
62
|
+
[]
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def initialize(access_token = nil, token_type = nil, expires_in = SKIP,
|
|
66
|
+
scope = SKIP, expiry = SKIP, refresh_token = SKIP,
|
|
67
|
+
additional_properties = {})
|
|
68
|
+
# Add additional model properties to the instance.
|
|
69
|
+
additional_properties.each do |_name, _value|
|
|
70
|
+
instance_variable_set("@#{_name}", _value)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
@access_token = access_token
|
|
74
|
+
@token_type = token_type
|
|
75
|
+
@expires_in = expires_in unless expires_in == SKIP
|
|
76
|
+
@scope = scope unless scope == SKIP
|
|
77
|
+
@expiry = expiry unless expiry == SKIP
|
|
78
|
+
@refresh_token = refresh_token unless refresh_token == SKIP
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Creates an instance of the object from a hash.
|
|
82
|
+
def self.from_hash(hash)
|
|
83
|
+
return nil unless hash
|
|
84
|
+
|
|
85
|
+
# Extract variables from the hash.
|
|
86
|
+
access_token = hash.key?('access_token') ? hash['access_token'] : nil
|
|
87
|
+
token_type = hash.key?('token_type') ? hash['token_type'] : nil
|
|
88
|
+
expires_in = hash.key?('expires_in') ? hash['expires_in'] : SKIP
|
|
89
|
+
scope = hash.key?('scope') ? hash['scope'] : SKIP
|
|
90
|
+
expiry = hash.key?('expiry') ? hash['expiry'] : SKIP
|
|
91
|
+
refresh_token = hash.key?('refresh_token') ? hash['refresh_token'] : SKIP
|
|
92
|
+
|
|
93
|
+
# Clean out expected properties from Hash.
|
|
94
|
+
additional_properties = hash.reject { |k, _| names.value?(k) }
|
|
95
|
+
|
|
96
|
+
# Create object from extracted values.
|
|
97
|
+
OAuthToken.new(access_token,
|
|
98
|
+
token_type,
|
|
99
|
+
expires_in,
|
|
100
|
+
scope,
|
|
101
|
+
expiry,
|
|
102
|
+
refresh_token,
|
|
103
|
+
additional_properties)
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# multi_auth_sample
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0
|
|
4
|
+
# ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module MultiAuthSample
|
|
7
|
+
# ServiceStatus Model.
|
|
8
|
+
class ServiceStatus < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :app
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :moto
|
|
19
|
+
|
|
20
|
+
# TODO: Write general description for this method
|
|
21
|
+
# @return [Integer]
|
|
22
|
+
attr_accessor :notes
|
|
23
|
+
|
|
24
|
+
# TODO: Write general description for this method
|
|
25
|
+
# @return [Integer]
|
|
26
|
+
attr_accessor :users
|
|
27
|
+
|
|
28
|
+
# TODO: Write general description for this method
|
|
29
|
+
# @return [String]
|
|
30
|
+
attr_accessor :time
|
|
31
|
+
|
|
32
|
+
# TODO: Write general description for this method
|
|
33
|
+
# @return [String]
|
|
34
|
+
attr_accessor :os
|
|
35
|
+
|
|
36
|
+
# TODO: Write general description for this method
|
|
37
|
+
# @return [String]
|
|
38
|
+
attr_accessor :php_version
|
|
39
|
+
|
|
40
|
+
# TODO: Write general description for this method
|
|
41
|
+
# @return [String]
|
|
42
|
+
attr_accessor :status
|
|
43
|
+
|
|
44
|
+
# A mapping from model property names to API property names.
|
|
45
|
+
def self.names
|
|
46
|
+
@_hash = {} if @_hash.nil?
|
|
47
|
+
@_hash['app'] = 'app'
|
|
48
|
+
@_hash['moto'] = 'moto'
|
|
49
|
+
@_hash['notes'] = 'notes'
|
|
50
|
+
@_hash['users'] = 'users'
|
|
51
|
+
@_hash['time'] = 'time'
|
|
52
|
+
@_hash['os'] = 'os'
|
|
53
|
+
@_hash['php_version'] = 'php_version'
|
|
54
|
+
@_hash['status'] = 'status'
|
|
55
|
+
@_hash
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# An array for optional fields
|
|
59
|
+
def self.optionals
|
|
60
|
+
%w[
|
|
61
|
+
app
|
|
62
|
+
moto
|
|
63
|
+
notes
|
|
64
|
+
users
|
|
65
|
+
time
|
|
66
|
+
os
|
|
67
|
+
php_version
|
|
68
|
+
]
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# An array for nullable fields
|
|
72
|
+
def self.nullables
|
|
73
|
+
[]
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def initialize(status = nil, app = SKIP, moto = SKIP, notes = SKIP,
|
|
77
|
+
users = SKIP, time = SKIP, os = SKIP, php_version = SKIP,
|
|
78
|
+
additional_properties = {})
|
|
79
|
+
# Add additional model properties to the instance.
|
|
80
|
+
additional_properties.each do |_name, _value|
|
|
81
|
+
instance_variable_set("@#{_name}", _value)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
@app = app unless app == SKIP
|
|
85
|
+
@moto = moto unless moto == SKIP
|
|
86
|
+
@notes = notes unless notes == SKIP
|
|
87
|
+
@users = users unless users == SKIP
|
|
88
|
+
@time = time unless time == SKIP
|
|
89
|
+
@os = os unless os == SKIP
|
|
90
|
+
@php_version = php_version unless php_version == SKIP
|
|
91
|
+
@status = status
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Creates an instance of the object from a hash.
|
|
95
|
+
def self.from_hash(hash)
|
|
96
|
+
return nil unless hash
|
|
97
|
+
|
|
98
|
+
# Extract variables from the hash.
|
|
99
|
+
status = hash.key?('status') ? hash['status'] : nil
|
|
100
|
+
app = hash.key?('app') ? hash['app'] : SKIP
|
|
101
|
+
moto = hash.key?('moto') ? hash['moto'] : SKIP
|
|
102
|
+
notes = hash.key?('notes') ? hash['notes'] : SKIP
|
|
103
|
+
users = hash.key?('users') ? hash['users'] : SKIP
|
|
104
|
+
time = hash.key?('time') ? hash['time'] : SKIP
|
|
105
|
+
os = hash.key?('os') ? hash['os'] : SKIP
|
|
106
|
+
php_version = hash.key?('php_version') ? hash['php_version'] : SKIP
|
|
107
|
+
|
|
108
|
+
# Clean out expected properties from Hash.
|
|
109
|
+
additional_properties = hash.reject { |k, _| names.value?(k) }
|
|
110
|
+
|
|
111
|
+
# Create object from extracted values.
|
|
112
|
+
ServiceStatus.new(status,
|
|
113
|
+
app,
|
|
114
|
+
moto,
|
|
115
|
+
notes,
|
|
116
|
+
users,
|
|
117
|
+
time,
|
|
118
|
+
os,
|
|
119
|
+
php_version,
|
|
120
|
+
additional_properties)
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Provides a human-readable string representation of the object.
|
|
124
|
+
def to_s
|
|
125
|
+
class_name = self.class.name.split('::').last
|
|
126
|
+
"<#{class_name} app: #{@app}, moto: #{@moto}, notes: #{@notes}, users: #{@users}, time:"\
|
|
127
|
+
" #{@time}, os: #{@os}, php_version: #{@php_version}, status: #{@status},"\
|
|
128
|
+
" additional_properties: #{get_additional_properties}>"
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
132
|
+
def inspect
|
|
133
|
+
class_name = self.class.name.split('::').last
|
|
134
|
+
"<#{class_name} app: #{@app.inspect}, moto: #{@moto.inspect}, notes: #{@notes.inspect},"\
|
|
135
|
+
" users: #{@users.inspect}, time: #{@time.inspect}, os: #{@os.inspect}, php_version:"\
|
|
136
|
+
" #{@php_version.inspect}, status: #{@status.inspect}, additional_properties:"\
|
|
137
|
+
" #{get_additional_properties}>"
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# multi_auth_sample
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0
|
|
4
|
+
# ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module MultiAuthSample
|
|
7
|
+
# A integer based enum representing a Suite in a game of cards
|
|
8
|
+
class SuiteCodeEnum
|
|
9
|
+
SUITE_CODE_ENUM = [
|
|
10
|
+
# TODO: Write general description for HEARTS
|
|
11
|
+
HEARTS = 1,
|
|
12
|
+
|
|
13
|
+
# TODO: Write general description for SPADES
|
|
14
|
+
SPADES = 2,
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for CLUBS
|
|
17
|
+
CLUBS = 3,
|
|
18
|
+
|
|
19
|
+
# TODO: Write general description for DIAMONDS
|
|
20
|
+
DIAMONDS = 4
|
|
21
|
+
].freeze
|
|
22
|
+
|
|
23
|
+
def self.validate(value)
|
|
24
|
+
return false if value.nil?
|
|
25
|
+
|
|
26
|
+
SUITE_CODE_ENUM.include?(value)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def self.from_value(value, default_value = HEARTS)
|
|
30
|
+
return default_value if value.nil?
|
|
31
|
+
|
|
32
|
+
str = value.to_s.strip
|
|
33
|
+
if str.match?(/\A\d+\z/)
|
|
34
|
+
num = str.to_i
|
|
35
|
+
return num if SUITE_CODE_ENUM.include?(num)
|
|
36
|
+
|
|
37
|
+
return default_value
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
case str.downcase
|
|
41
|
+
when 'hearts' then HEARTS
|
|
42
|
+
when 'spades' then SPADES
|
|
43
|
+
when 'clubs' then CLUBS
|
|
44
|
+
when 'diamonds' then DIAMONDS
|
|
45
|
+
else
|
|
46
|
+
default_value
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# multi_auth_sample
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0
|
|
4
|
+
# ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module MultiAuthSample
|
|
7
|
+
# User Model.
|
|
8
|
+
class User < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [Integer]
|
|
14
|
+
attr_accessor :id
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :name
|
|
19
|
+
|
|
20
|
+
# TODO: Write general description for this method
|
|
21
|
+
# @return [String]
|
|
22
|
+
attr_accessor :email
|
|
23
|
+
|
|
24
|
+
# TODO: Write general description for this method
|
|
25
|
+
# @return [String]
|
|
26
|
+
attr_accessor :created_at
|
|
27
|
+
|
|
28
|
+
# TODO: Write general description for this method
|
|
29
|
+
# @return [String]
|
|
30
|
+
attr_accessor :updated_at
|
|
31
|
+
|
|
32
|
+
# A mapping from model property names to API property names.
|
|
33
|
+
def self.names
|
|
34
|
+
@_hash = {} if @_hash.nil?
|
|
35
|
+
@_hash['id'] = 'id'
|
|
36
|
+
@_hash['name'] = 'name'
|
|
37
|
+
@_hash['email'] = 'email'
|
|
38
|
+
@_hash['created_at'] = 'created_at'
|
|
39
|
+
@_hash['updated_at'] = 'updated_at'
|
|
40
|
+
@_hash
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# An array for optional fields
|
|
44
|
+
def self.optionals
|
|
45
|
+
%w[
|
|
46
|
+
id
|
|
47
|
+
name
|
|
48
|
+
email
|
|
49
|
+
created_at
|
|
50
|
+
updated_at
|
|
51
|
+
]
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# An array for nullable fields
|
|
55
|
+
def self.nullables
|
|
56
|
+
[]
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def initialize(id = SKIP, name = SKIP, email = SKIP, created_at = SKIP,
|
|
60
|
+
updated_at = SKIP, additional_properties = {})
|
|
61
|
+
# Add additional model properties to the instance.
|
|
62
|
+
additional_properties.each do |_name, _value|
|
|
63
|
+
instance_variable_set("@#{_name}", _value)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
@id = id unless id == SKIP
|
|
67
|
+
@name = name unless name == SKIP
|
|
68
|
+
@email = email unless email == SKIP
|
|
69
|
+
@created_at = created_at unless created_at == SKIP
|
|
70
|
+
@updated_at = updated_at unless updated_at == SKIP
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Creates an instance of the object from a hash.
|
|
74
|
+
def self.from_hash(hash)
|
|
75
|
+
return nil unless hash
|
|
76
|
+
|
|
77
|
+
# Extract variables from the hash.
|
|
78
|
+
id = hash.key?('id') ? hash['id'] : SKIP
|
|
79
|
+
name = hash.key?('name') ? hash['name'] : SKIP
|
|
80
|
+
email = hash.key?('email') ? hash['email'] : SKIP
|
|
81
|
+
created_at = hash.key?('created_at') ? hash['created_at'] : SKIP
|
|
82
|
+
updated_at = hash.key?('updated_at') ? hash['updated_at'] : SKIP
|
|
83
|
+
|
|
84
|
+
# Clean out expected properties from Hash.
|
|
85
|
+
additional_properties = hash.reject { |k, _| names.value?(k) }
|
|
86
|
+
|
|
87
|
+
# Create object from extracted values.
|
|
88
|
+
User.new(id,
|
|
89
|
+
name,
|
|
90
|
+
email,
|
|
91
|
+
created_at,
|
|
92
|
+
updated_at,
|
|
93
|
+
additional_properties)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Provides a human-readable string representation of the object.
|
|
97
|
+
def to_s
|
|
98
|
+
class_name = self.class.name.split('::').last
|
|
99
|
+
"<#{class_name} id: #{@id}, name: #{@name}, email: #{@email}, created_at: #{@created_at},"\
|
|
100
|
+
" updated_at: #{@updated_at}, additional_properties: #{get_additional_properties}>"
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
104
|
+
def inspect
|
|
105
|
+
class_name = self.class.name.split('::').last
|
|
106
|
+
"<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}, email: #{@email.inspect},"\
|
|
107
|
+
" created_at: #{@created_at.inspect}, updated_at: #{@updated_at.inspect},"\
|
|
108
|
+
" additional_properties: #{get_additional_properties}>"
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# multi_auth_sample
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0
|
|
4
|
+
# ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
require 'date'
|
|
7
|
+
module MultiAuthSample
|
|
8
|
+
# A utility that supports dateTime conversion to different formats
|
|
9
|
+
class DateTimeHelper < CoreLibrary::DateTimeHelper
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# multi_auth_sample
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0
|
|
4
|
+
# ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module MultiAuthSample
|
|
7
|
+
# A utility to allow users to set the content-type for files
|
|
8
|
+
class FileWrapper < CoreLibrary::FileWrapper
|
|
9
|
+
# The constructor.
|
|
10
|
+
# @param [File] file The file to be sent in the request.
|
|
11
|
+
# @param [string] content_type The content type of the provided file.
|
|
12
|
+
def initialize(file, content_type: 'application/octet-stream')
|
|
13
|
+
super
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Provides a human-readable string representation of the object.
|
|
17
|
+
def to_s
|
|
18
|
+
class_name = self.class.name.split('::').last
|
|
19
|
+
"<#{class_name} file: #{@file}, content_type: #{@content_type}>"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
23
|
+
def to_inspect
|
|
24
|
+
class_name = self.class.name.split('::').last
|
|
25
|
+
"<#{class_name} file: #{@file.inspect}, content_type: #{@content_type.inspect}>"
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|