wesley-key-sdk 4.2.0 → 4.3.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 (96) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +34 -47
  3. data/bin/console +4 -4
  4. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/api_helper.rb +2 -2
  5. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/apis/base_api.rb +3 -3
  6. data/lib/webhooks_and_callbacks_api/apis/orders_api.rb +34 -0
  7. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/client.rb +15 -34
  8. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/configuration.rb +20 -30
  9. data/lib/webhooks_and_callbacks_api/events/callbacks/callbacks_a_handler.rb +66 -0
  10. data/lib/webhooks_and_callbacks_api/events/callbacks/callbacks_b_handler.rb +78 -0
  11. data/lib/webhooks_and_callbacks_api/events/signature_verification_failure.rb +33 -0
  12. data/lib/webhooks_and_callbacks_api/events/signature_verification_result.rb +14 -0
  13. data/lib/webhooks_and_callbacks_api/events/unknown_event.rb +32 -0
  14. data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_a_handler.rb +67 -0
  15. data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_b_handler.rb +86 -0
  16. data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_c_handler.rb +79 -0
  17. data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_handler.rb +67 -0
  18. data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_no_verification_handler.rb +39 -0
  19. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/exceptions/api_exception.rb +2 -2
  20. data/lib/webhooks_and_callbacks_api/exceptions/error_exception.rb +57 -0
  21. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/http/api_response.rb +2 -2
  22. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/http/auth/api_key.rb +15 -15
  23. data/lib/webhooks_and_callbacks_api/http/auth/bearer_auth.rb +53 -0
  24. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/http/http_call_back.rb +2 -2
  25. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/http/http_method_enum.rb +2 -2
  26. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/http/http_request.rb +2 -2
  27. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/http/http_response.rb +2 -2
  28. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/http/proxy_settings.rb +2 -2
  29. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/logging/configuration/api_logging_configuration.rb +2 -2
  30. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/logging/sdk_logger.rb +2 -2
  31. data/lib/webhooks_and_callbacks_api/models/address.rb +114 -0
  32. data/lib/webhooks_and_callbacks_api/models/audit_log_event.rb +115 -0
  33. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/models/base_model.rb +2 -2
  34. data/lib/webhooks_and_callbacks_api/models/create_order_request.rb +131 -0
  35. data/lib/{swagger_petstore_open_api30/models/tag.rb → webhooks_and_callbacks_api/models/delivery_details.rb} +35 -36
  36. data/lib/webhooks_and_callbacks_api/models/email_notification_callback.rb +97 -0
  37. data/lib/webhooks_and_callbacks_api/models/event.rb +52 -0
  38. data/lib/webhooks_and_callbacks_api/models/event_type.rb +26 -0
  39. data/lib/webhooks_and_callbacks_api/models/event_type1.rb +26 -0
  40. data/lib/webhooks_and_callbacks_api/models/event_type2.rb +26 -0
  41. data/lib/webhooks_and_callbacks_api/models/event_type3.rb +26 -0
  42. data/lib/webhooks_and_callbacks_api/models/fulfillment_callback.rb +411 -0
  43. data/lib/webhooks_and_callbacks_api/models/fulfillment_status.rb +40 -0
  44. data/lib/webhooks_and_callbacks_api/models/fulfillment_statuss.rb +40 -0
  45. data/lib/webhooks_and_callbacks_api/models/inventory_stock_decrease_event.rb +90 -0
  46. data/lib/webhooks_and_callbacks_api/models/inventory_stock_depleted_event.rb +90 -0
  47. data/lib/webhooks_and_callbacks_api/models/inventory_stock_increase_event.rb +90 -0
  48. data/lib/webhooks_and_callbacks_api/models/notification_callback.rb +119 -0
  49. data/lib/webhooks_and_callbacks_api/models/oauth_scope_oauth_acg.rb +44 -0
  50. data/lib/webhooks_and_callbacks_api/models/order.rb +161 -0
  51. data/lib/webhooks_and_callbacks_api/models/order_created_event.rb +314 -0
  52. data/lib/webhooks_and_callbacks_api/models/order_item.rb +102 -0
  53. data/lib/webhooks_and_callbacks_api/models/order_updated_event.rb +100 -0
  54. data/lib/{swagger_petstore_open_api30/models/category.rb → webhooks_and_callbacks_api/models/package.rb} +29 -39
  55. data/lib/webhooks_and_callbacks_api/models/payment_callback.rb +167 -0
  56. data/lib/webhooks_and_callbacks_api/models/payment_completed_event.rb +98 -0
  57. data/lib/webhooks_and_callbacks_api/models/payment_status.rb +40 -0
  58. data/lib/webhooks_and_callbacks_api/models/payment_status_created_event.rb +89 -0
  59. data/lib/webhooks_and_callbacks_api/models/payment_status_updated_event.rb +89 -0
  60. data/lib/webhooks_and_callbacks_api/models/primitive_collection_event.rb +98 -0
  61. data/lib/webhooks_and_callbacks_api/models/root_level_primitive_one_of_event_request.rb +40 -0
  62. data/lib/webhooks_and_callbacks_api/models/root_level_primitive_one_of_event_request1.rb +40 -0
  63. data/lib/webhooks_and_callbacks_api/models/sms_notification_callback.rb +95 -0
  64. data/lib/webhooks_and_callbacks_api/models/status.rb +44 -0
  65. data/lib/webhooks_and_callbacks_api/models/status1.rb +36 -0
  66. data/lib/webhooks_and_callbacks_api/models/status2.rb +36 -0
  67. data/lib/webhooks_and_callbacks_api/models/system_alert_notification_event.rb +90 -0
  68. data/lib/webhooks_and_callbacks_api/models/system_maintenance_notification_event.rb +90 -0
  69. data/lib/webhooks_and_callbacks_api/models/system_performance_notification_event.rb +90 -0
  70. data/lib/webhooks_and_callbacks_api/models/user_action_notification_event.rb +90 -0
  71. data/lib/webhooks_and_callbacks_api/models/user_preference_notification_event.rb +90 -0
  72. data/lib/webhooks_and_callbacks_api/models/user_status_notification_event.rb +90 -0
  73. data/lib/webhooks_and_callbacks_api/models/webhook.rb +142 -0
  74. data/lib/webhooks_and_callbacks_api/models/webhook_registration.rb +103 -0
  75. data/lib/webhooks_and_callbacks_api/models/webhook_update.rb +105 -0
  76. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/utilities/date_time_helper.rb +2 -2
  77. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/utilities/file_wrapper.rb +2 -2
  78. data/lib/webhooks_and_callbacks_api/utilities/union_type_lookup.rb +172 -0
  79. data/lib/webhooks_and_callbacks_api.rb +122 -0
  80. metadata +78 -37
  81. data/lib/swagger_petstore_open_api30/apis/pet_api.rb +0 -287
  82. data/lib/swagger_petstore_open_api30/apis/store_api.rb +0 -131
  83. data/lib/swagger_petstore_open_api30/apis/user_api.rb +0 -233
  84. data/lib/swagger_petstore_open_api30/exceptions/oauth_provider_exception.rb +0 -64
  85. data/lib/swagger_petstore_open_api30/http/auth/petstore_auth.rb +0 -112
  86. data/lib/swagger_petstore_open_api30/models/api_response.rb +0 -118
  87. data/lib/swagger_petstore_open_api30/models/oauth_provider_error.rb +0 -62
  88. data/lib/swagger_petstore_open_api30/models/oauth_scope_petstore_auth.rb +0 -36
  89. data/lib/swagger_petstore_open_api30/models/oauth_token.rb +0 -125
  90. data/lib/swagger_petstore_open_api30/models/order.rb +0 -167
  91. data/lib/swagger_petstore_open_api30/models/order_status.rb +0 -40
  92. data/lib/swagger_petstore_open_api30/models/pet.rb +0 -168
  93. data/lib/swagger_petstore_open_api30/models/pet_status.rb +0 -40
  94. data/lib/swagger_petstore_open_api30/models/user.rb +0 -182
  95. data/lib/swagger_petstore_open_api30/utilities/xml_utilities.rb +0 -12
  96. data/lib/swagger_petstore_open_api30.rb +0 -62
@@ -1,62 +0,0 @@
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
@@ -1,36 +0,0 @@
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
@@ -1,125 +0,0 @@
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
@@ -1,167 +0,0 @@
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
@@ -1,40 +0,0 @@
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
@@ -1,168 +0,0 @@
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
- # Pet Model.
8
- class Pet < 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 [Category]
22
- attr_accessor :category
23
-
24
- # TODO: Write general description for this method
25
- # @return [Array[String]]
26
- attr_accessor :photo_urls
27
-
28
- # TODO: Write general description for this method
29
- # @return [Array[Tag]]
30
- attr_accessor :tags
31
-
32
- # pet status in the store
33
- # @return [PetStatus]
34
- attr_accessor :status
35
-
36
- # A mapping from model property names to API property names.
37
- def self.names
38
- @_hash = {} if @_hash.nil?
39
- @_hash['id'] = 'id'
40
- @_hash['name'] = 'name'
41
- @_hash['category'] = 'category'
42
- @_hash['photo_urls'] = 'photoUrls'
43
- @_hash['tags'] = 'tags'
44
- @_hash['status'] = 'status'
45
- @_hash
46
- end
47
-
48
- # An array for optional fields
49
- def self.optionals
50
- %w[
51
- id
52
- category
53
- tags
54
- status
55
- ]
56
- end
57
-
58
- # An array for nullable fields
59
- def self.nullables
60
- []
61
- end
62
-
63
- def initialize(name:, photo_urls:, id: SKIP, category: SKIP, tags: SKIP,
64
- status: SKIP, additional_properties: nil)
65
- # Add additional model properties to the instance
66
- additional_properties = {} if additional_properties.nil?
67
-
68
- @id = id unless id == SKIP
69
- @name = name
70
- @category = category unless category == SKIP
71
- @photo_urls = photo_urls
72
- @tags = tags unless tags == SKIP
73
- @status = status unless status == SKIP
74
- @additional_properties = additional_properties
75
- end
76
-
77
- # Creates an instance of the object from a hash.
78
- def self.from_hash(hash)
79
- return nil unless hash
80
-
81
- # Extract variables from the hash.
82
- name = hash.key?('name') ? hash['name'] : nil
83
- photo_urls = hash.key?('photoUrls') ? hash['photoUrls'] : nil
84
- id = hash.key?('id') ? hash['id'] : SKIP
85
- category = Category.from_hash(hash['category']) if hash['category']
86
- # Parameter is an array, so we need to iterate through it
87
- tags = nil
88
- unless hash['tags'].nil?
89
- tags = []
90
- hash['tags'].each do |structure|
91
- tags << (Tag.from_hash(structure) if structure)
92
- end
93
- end
94
-
95
- tags = SKIP unless hash.key?('tags')
96
- status = hash.key?('status') ? hash['status'] : SKIP
97
-
98
- # Create a new hash for additional properties, removing known properties.
99
- new_hash = hash.reject { |k, _| names.value?(k) }
100
-
101
- additional_properties = APIHelper.get_additional_properties(
102
- new_hash, proc { |value| value }
103
- )
104
-
105
- # Create object from extracted values.
106
- Pet.new(name: name,
107
- photo_urls: photo_urls,
108
- id: id,
109
- category: category,
110
- tags: tags,
111
- status: status,
112
- additional_properties: additional_properties)
113
- end
114
-
115
- def self.from_element(root)
116
- name = XmlUtilities.from_element(root, 'name', String)
117
- photo_urls = XmlUtilities.from_element_to_array(
118
- root, 'photoUrl', String, wrapping_element_name: 'photoUrls'
119
- )
120
- id = XmlUtilities.from_element(root, 'id', Integer)
121
- category = XmlUtilities.from_element(root, 'category', Category)
122
- tags = XmlUtilities.from_element_to_array(root, 'tag', Tag,
123
- wrapping_element_name: 'tags')
124
- status = XmlUtilities.from_element(root, 'status', String)
125
-
126
- new(name: name,
127
- photo_urls: photo_urls,
128
- id: id,
129
- category: category,
130
- tags: tags,
131
- status: status,
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, 'name', name)
139
- XmlUtilities.add_array_as_subelement(doc, root, 'photoUrl', photo_urls,
140
- wrapping_element_name: 'photoUrls')
141
- XmlUtilities.add_as_subelement(doc, root, 'id', id)
142
- XmlUtilities.add_as_subelement(doc, root, 'category', category)
143
- XmlUtilities.add_array_as_subelement(doc, root, 'tag', tags,
144
- wrapping_element_name: 'tags')
145
- XmlUtilities.add_as_subelement(doc, root, 'status', status)
146
- XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
147
- additional_properties)
148
-
149
- root
150
- end
151
-
152
- # Provides a human-readable string representation of the object.
153
- def to_s
154
- class_name = self.class.name.split('::').last
155
- "<#{class_name} id: #{@id}, name: #{@name}, category: #{@category}, photo_urls:"\
156
- " #{@photo_urls}, tags: #{@tags}, status: #{@status}, additional_properties:"\
157
- " #{@additional_properties}>"
158
- end
159
-
160
- # Provides a debugging-friendly string with detailed object information.
161
- def inspect
162
- class_name = self.class.name.split('::').last
163
- "<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}, category: #{@category.inspect},"\
164
- " photo_urls: #{@photo_urls.inspect}, tags: #{@tags.inspect}, status: #{@status.inspect},"\
165
- " additional_properties: #{@additional_properties}>"
166
- end
167
- end
168
- end
@@ -1,40 +0,0 @@
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
- # pet status in the store
8
- class PetStatus
9
- PET_STATUS = [
10
- # TODO: Write general description for AVAILABLE
11
- AVAILABLE = 'available'.freeze,
12
-
13
- # TODO: Write general description for PENDING
14
- PENDING = 'pending'.freeze,
15
-
16
- # TODO: Write general description for SOLD
17
- SOLD = 'sold'.freeze
18
- ].freeze
19
-
20
- def self.validate(value)
21
- return false if value.nil?
22
-
23
- PET_STATUS.include?(value)
24
- end
25
-
26
- def self.from_value(value, default_value = AVAILABLE)
27
- return default_value if value.nil?
28
-
29
- str = value.to_s.strip
30
-
31
- case str.downcase
32
- when 'available' then AVAILABLE
33
- when 'pending' then PENDING
34
- when 'sold' then SOLD
35
- else
36
- default_value
37
- end
38
- end
39
- end
40
- end