chainlink-apimatic-sdk 0.0.1

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.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +181 -0
  4. data/bin/console +15 -0
  5. data/lib/swagger_petstore_open_api30/api_helper.rb +10 -0
  6. data/lib/swagger_petstore_open_api30/apis/base_api.rb +67 -0
  7. data/lib/swagger_petstore_open_api30/apis/pet_api.rb +287 -0
  8. data/lib/swagger_petstore_open_api30/apis/store_api.rb +131 -0
  9. data/lib/swagger_petstore_open_api30/apis/user_api.rb +233 -0
  10. data/lib/swagger_petstore_open_api30/client.rb +94 -0
  11. data/lib/swagger_petstore_open_api30/configuration.rb +180 -0
  12. data/lib/swagger_petstore_open_api30/exceptions/api_exception.rb +21 -0
  13. data/lib/swagger_petstore_open_api30/exceptions/oauth_provider_exception.rb +64 -0
  14. data/lib/swagger_petstore_open_api30/http/api_response.rb +19 -0
  15. data/lib/swagger_petstore_open_api30/http/auth/api_key.rb +52 -0
  16. data/lib/swagger_petstore_open_api30/http/auth/petstore_auth.rb +112 -0
  17. data/lib/swagger_petstore_open_api30/http/http_call_back.rb +10 -0
  18. data/lib/swagger_petstore_open_api30/http/http_method_enum.rb +10 -0
  19. data/lib/swagger_petstore_open_api30/http/http_request.rb +10 -0
  20. data/lib/swagger_petstore_open_api30/http/http_response.rb +10 -0
  21. data/lib/swagger_petstore_open_api30/http/proxy_settings.rb +22 -0
  22. data/lib/swagger_petstore_open_api30/logging/configuration/api_logging_configuration.rb +186 -0
  23. data/lib/swagger_petstore_open_api30/logging/sdk_logger.rb +17 -0
  24. data/lib/swagger_petstore_open_api30/models/api_response.rb +118 -0
  25. data/lib/swagger_petstore_open_api30/models/base_model.rb +110 -0
  26. data/lib/swagger_petstore_open_api30/models/category.rb +105 -0
  27. data/lib/swagger_petstore_open_api30/models/oauth_provider_error.rb +62 -0
  28. data/lib/swagger_petstore_open_api30/models/oauth_scope_petstore_auth.rb +36 -0
  29. data/lib/swagger_petstore_open_api30/models/oauth_token.rb +125 -0
  30. data/lib/swagger_petstore_open_api30/models/order.rb +167 -0
  31. data/lib/swagger_petstore_open_api30/models/order_status.rb +40 -0
  32. data/lib/swagger_petstore_open_api30/models/pet.rb +168 -0
  33. data/lib/swagger_petstore_open_api30/models/pet_status.rb +40 -0
  34. data/lib/swagger_petstore_open_api30/models/tag.rb +105 -0
  35. data/lib/swagger_petstore_open_api30/models/user.rb +182 -0
  36. data/lib/swagger_petstore_open_api30/utilities/date_time_helper.rb +11 -0
  37. data/lib/swagger_petstore_open_api30/utilities/file_wrapper.rb +28 -0
  38. data/lib/swagger_petstore_open_api30/utilities/xml_utilities.rb +12 -0
  39. data/lib/swagger_petstore_open_api30.rb +62 -0
  40. metadata +123 -0
@@ -0,0 +1,110 @@
1
+ # swagger_petstore_open_api30
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SwaggerPetstoreOpenApi30
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
+ end
109
+ # rubocop:enable all
110
+ end
@@ -0,0 +1,105 @@
1
+ # swagger_petstore_open_api30
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SwaggerPetstoreOpenApi30
7
+ # Category Model.
8
+ class Category < 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
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['id'] = 'id'
24
+ @_hash['name'] = 'name'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ id
32
+ name
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(id: SKIP, name: SKIP, additional_properties: nil)
42
+ # Add additional model properties to the instance
43
+ additional_properties = {} if additional_properties.nil?
44
+
45
+ @id = id unless id == SKIP
46
+ @name = name unless name == SKIP
47
+ @additional_properties = additional_properties
48
+ end
49
+
50
+ # Creates an instance of the object from a hash.
51
+ def self.from_hash(hash)
52
+ return nil unless hash
53
+
54
+ # Extract variables from the hash.
55
+ id = hash.key?('id') ? hash['id'] : SKIP
56
+ name = hash.key?('name') ? hash['name'] : SKIP
57
+
58
+ # Create a new hash for additional properties, removing known properties.
59
+ new_hash = hash.reject { |k, _| names.value?(k) }
60
+
61
+ additional_properties = APIHelper.get_additional_properties(
62
+ new_hash, proc { |value| value }
63
+ )
64
+
65
+ # Create object from extracted values.
66
+ Category.new(id: id,
67
+ name: name,
68
+ additional_properties: additional_properties)
69
+ end
70
+
71
+ def self.from_element(root)
72
+ id = XmlUtilities.from_element(root, 'id', Integer)
73
+ name = XmlUtilities.from_element(root, 'name', String)
74
+
75
+ new(id: id,
76
+ name: name,
77
+ additional_properties: additional_properties)
78
+ end
79
+
80
+ def to_xml_element(doc, root_name)
81
+ root = doc.create_element(root_name)
82
+
83
+ XmlUtilities.add_as_subelement(doc, root, 'id', id)
84
+ XmlUtilities.add_as_subelement(doc, root, 'name', name)
85
+ XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
86
+ additional_properties)
87
+
88
+ root
89
+ end
90
+
91
+ # Provides a human-readable string representation of the object.
92
+ def to_s
93
+ class_name = self.class.name.split('::').last
94
+ "<#{class_name} id: #{@id}, name: #{@name}, additional_properties:"\
95
+ " #{@additional_properties}>"
96
+ end
97
+
98
+ # Provides a debugging-friendly string with detailed object information.
99
+ def inspect
100
+ class_name = self.class.name.split('::').last
101
+ "<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}, additional_properties:"\
102
+ " #{@additional_properties}>"
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,62 @@
1
+ # swagger_petstore_open_api30
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SwaggerPetstoreOpenApi30
7
+ # OAuth 2 Authorization error codes
8
+ class OauthProviderError
9
+ OAUTH_PROVIDER_ERROR = [
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
+ OAUTH_PROVIDER_ERROR.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,36 @@
1
+ # swagger_petstore_open_api30
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SwaggerPetstoreOpenApi30
7
+ # OAuth 2 scopes supported by the API
8
+ class OauthScopePetstoreAuth
9
+ OAUTH_SCOPE_PETSTORE_AUTH = [
10
+ # modify pets in your account
11
+ WRITEPETS = 'write:pets'.freeze,
12
+
13
+ # read your pets
14
+ READPETS = 'read:pets'.freeze
15
+ ].freeze
16
+
17
+ def self.validate(value)
18
+ return false if value.nil?
19
+
20
+ OAUTH_SCOPE_PETSTORE_AUTH.include?(value)
21
+ end
22
+
23
+ def self.from_value(value, default_value = WRITEPETS)
24
+ return default_value if value.nil?
25
+
26
+ str = value.to_s.strip
27
+
28
+ case str.downcase
29
+ when 'writepets' then WRITEPETS
30
+ when 'readpets' then READPETS
31
+ else
32
+ default_value
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,125 @@
1
+ # swagger_petstore_open_api30
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SwaggerPetstoreOpenApi30
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:, token_type:, expires_in: SKIP, scope: SKIP,
66
+ expiry: SKIP, refresh_token: SKIP)
67
+ @access_token = access_token
68
+ @token_type = token_type
69
+ @expires_in = expires_in unless expires_in == SKIP
70
+ @scope = scope unless scope == SKIP
71
+ @expiry = expiry unless expiry == SKIP
72
+ @refresh_token = refresh_token unless refresh_token == SKIP
73
+ end
74
+
75
+ # Creates an instance of the object from a hash.
76
+ def self.from_hash(hash)
77
+ return nil unless hash
78
+
79
+ # Extract variables from the hash.
80
+ access_token = hash.key?('access_token') ? hash['access_token'] : nil
81
+ token_type = hash.key?('token_type') ? hash['token_type'] : nil
82
+ expires_in = hash.key?('expires_in') ? hash['expires_in'] : SKIP
83
+ scope = hash.key?('scope') ? hash['scope'] : SKIP
84
+ expiry = hash.key?('expiry') ? hash['expiry'] : SKIP
85
+ refresh_token = hash.key?('refresh_token') ? hash['refresh_token'] : SKIP
86
+
87
+ # Create object from extracted values.
88
+ OauthToken.new(access_token: access_token,
89
+ token_type: token_type,
90
+ expires_in: expires_in,
91
+ scope: scope,
92
+ expiry: expiry,
93
+ refresh_token: refresh_token)
94
+ end
95
+
96
+ def self.from_element(root)
97
+ access_token = XmlUtilities.from_element(root, 'access_token', String)
98
+ token_type = XmlUtilities.from_element(root, 'token_type', String)
99
+ expires_in = XmlUtilities.from_element(root, 'expires_in', Integer)
100
+ scope = XmlUtilities.from_element(root, 'scope', String)
101
+ expiry = XmlUtilities.from_element(root, 'expiry', Integer)
102
+ refresh_token = XmlUtilities.from_element(root, 'refresh_token', String)
103
+
104
+ new(access_token: access_token,
105
+ token_type: token_type,
106
+ expires_in: expires_in,
107
+ scope: scope,
108
+ expiry: expiry,
109
+ refresh_token: refresh_token)
110
+ end
111
+
112
+ def to_xml_element(doc, root_name)
113
+ root = doc.create_element(root_name)
114
+
115
+ XmlUtilities.add_as_subelement(doc, root, 'access_token', access_token)
116
+ XmlUtilities.add_as_subelement(doc, root, 'token_type', token_type)
117
+ XmlUtilities.add_as_subelement(doc, root, 'expires_in', expires_in)
118
+ XmlUtilities.add_as_subelement(doc, root, 'scope', scope)
119
+ XmlUtilities.add_as_subelement(doc, root, 'expiry', expiry)
120
+ XmlUtilities.add_as_subelement(doc, root, 'refresh_token', refresh_token)
121
+
122
+ root
123
+ end
124
+ end
125
+ end
@@ -0,0 +1,167 @@
1
+ # swagger_petstore_open_api30
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ require 'date'
7
+ module SwaggerPetstoreOpenApi30
8
+ # Order Model.
9
+ class Order < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [Integer]
15
+ attr_accessor :id
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [Integer]
19
+ attr_accessor :pet_id
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [Integer]
23
+ attr_accessor :quantity
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [DateTime]
27
+ attr_accessor :ship_date
28
+
29
+ # Order Status
30
+ # @return [OrderStatus]
31
+ attr_accessor :status
32
+
33
+ # Order Status
34
+ # @return [TrueClass | FalseClass]
35
+ attr_accessor :complete
36
+
37
+ # A mapping from model property names to API property names.
38
+ def self.names
39
+ @_hash = {} if @_hash.nil?
40
+ @_hash['id'] = 'id'
41
+ @_hash['pet_id'] = 'petId'
42
+ @_hash['quantity'] = 'quantity'
43
+ @_hash['ship_date'] = 'shipDate'
44
+ @_hash['status'] = 'status'
45
+ @_hash['complete'] = 'complete'
46
+ @_hash
47
+ end
48
+
49
+ # An array for optional fields
50
+ def self.optionals
51
+ %w[
52
+ id
53
+ pet_id
54
+ quantity
55
+ ship_date
56
+ status
57
+ complete
58
+ ]
59
+ end
60
+
61
+ # An array for nullable fields
62
+ def self.nullables
63
+ []
64
+ end
65
+
66
+ def initialize(id: SKIP, pet_id: SKIP, quantity: SKIP, ship_date: SKIP,
67
+ status: SKIP, complete: SKIP, additional_properties: nil)
68
+ # Add additional model properties to the instance
69
+ additional_properties = {} if additional_properties.nil?
70
+
71
+ @id = id unless id == SKIP
72
+ @pet_id = pet_id unless pet_id == SKIP
73
+ @quantity = quantity unless quantity == SKIP
74
+ @ship_date = ship_date unless ship_date == SKIP
75
+ @status = status unless status == SKIP
76
+ @complete = complete unless complete == SKIP
77
+ @additional_properties = additional_properties
78
+ end
79
+
80
+ # Creates an instance of the object from a hash.
81
+ def self.from_hash(hash)
82
+ return nil unless hash
83
+
84
+ # Extract variables from the hash.
85
+ id = hash.key?('id') ? hash['id'] : SKIP
86
+ pet_id = hash.key?('petId') ? hash['petId'] : SKIP
87
+ quantity = hash.key?('quantity') ? hash['quantity'] : SKIP
88
+ ship_date = if hash.key?('shipDate')
89
+ (DateTimeHelper.from_rfc3339(hash['shipDate']) if hash['shipDate'])
90
+ else
91
+ SKIP
92
+ end
93
+ status = hash.key?('status') ? hash['status'] : SKIP
94
+ complete = hash.key?('complete') ? hash['complete'] : SKIP
95
+
96
+ # Create a new hash for additional properties, removing known properties.
97
+ new_hash = hash.reject { |k, _| names.value?(k) }
98
+
99
+ additional_properties = APIHelper.get_additional_properties(
100
+ new_hash, proc { |value| value }
101
+ )
102
+
103
+ # Create object from extracted values.
104
+ Order.new(id: id,
105
+ pet_id: pet_id,
106
+ quantity: quantity,
107
+ ship_date: ship_date,
108
+ status: status,
109
+ complete: complete,
110
+ additional_properties: additional_properties)
111
+ end
112
+
113
+ def to_custom_ship_date
114
+ DateTimeHelper.to_rfc3339(ship_date)
115
+ end
116
+
117
+ def self.from_element(root)
118
+ id = XmlUtilities.from_element(root, 'id', Integer)
119
+ pet_id = XmlUtilities.from_element(root, 'petId', Integer)
120
+ quantity = XmlUtilities.from_element(root, 'quantity', Integer)
121
+ ship_date = XmlUtilities.from_element(root, 'shipDate', String,
122
+ datetime_format: 'rfc3339')
123
+ status = XmlUtilities.from_element(root, 'status', String)
124
+ complete = XmlUtilities.from_element(root, 'complete', TrueClass)
125
+
126
+ new(id: id,
127
+ pet_id: pet_id,
128
+ quantity: quantity,
129
+ ship_date: ship_date,
130
+ status: status,
131
+ complete: complete,
132
+ additional_properties: additional_properties)
133
+ end
134
+
135
+ def to_xml_element(doc, root_name)
136
+ root = doc.create_element(root_name)
137
+
138
+ XmlUtilities.add_as_subelement(doc, root, 'id', id)
139
+ XmlUtilities.add_as_subelement(doc, root, 'petId', pet_id)
140
+ XmlUtilities.add_as_subelement(doc, root, 'quantity', quantity)
141
+ XmlUtilities.add_as_subelement(doc, root, 'shipDate', ship_date,
142
+ datetime_format: 'rfc3339')
143
+ XmlUtilities.add_as_subelement(doc, root, 'status', status)
144
+ XmlUtilities.add_as_subelement(doc, root, 'complete', complete)
145
+ XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
146
+ additional_properties)
147
+
148
+ root
149
+ end
150
+
151
+ # Provides a human-readable string representation of the object.
152
+ def to_s
153
+ class_name = self.class.name.split('::').last
154
+ "<#{class_name} id: #{@id}, pet_id: #{@pet_id}, quantity: #{@quantity}, ship_date:"\
155
+ " #{@ship_date}, status: #{@status}, complete: #{@complete}, additional_properties:"\
156
+ " #{@additional_properties}>"
157
+ end
158
+
159
+ # Provides a debugging-friendly string with detailed object information.
160
+ def inspect
161
+ class_name = self.class.name.split('::').last
162
+ "<#{class_name} id: #{@id.inspect}, pet_id: #{@pet_id.inspect}, quantity:"\
163
+ " #{@quantity.inspect}, ship_date: #{@ship_date.inspect}, status: #{@status.inspect},"\
164
+ " complete: #{@complete.inspect}, additional_properties: #{@additional_properties}>"
165
+ end
166
+ end
167
+ end
@@ -0,0 +1,40 @@
1
+ # swagger_petstore_open_api30
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SwaggerPetstoreOpenApi30
7
+ # Order Status
8
+ class OrderStatus
9
+ ORDER_STATUS = [
10
+ # TODO: Write general description for PLACED
11
+ PLACED = 'placed'.freeze,
12
+
13
+ # TODO: Write general description for APPROVED
14
+ APPROVED = 'approved'.freeze,
15
+
16
+ # TODO: Write general description for DELIVERED
17
+ DELIVERED = 'delivered'.freeze
18
+ ].freeze
19
+
20
+ def self.validate(value)
21
+ return false if value.nil?
22
+
23
+ ORDER_STATUS.include?(value)
24
+ end
25
+
26
+ def self.from_value(value, default_value = PLACED)
27
+ return default_value if value.nil?
28
+
29
+ str = value.to_s.strip
30
+
31
+ case str.downcase
32
+ when 'placed' then PLACED
33
+ when 'approved' then APPROVED
34
+ when 'delivered' then DELIVERED
35
+ else
36
+ default_value
37
+ end
38
+ end
39
+ end
40
+ end