wesley-key-sdk 4.0.0 → 4.2.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.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +47 -34
  3. data/bin/console +4 -4
  4. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/api_helper.rb +2 -2
  5. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/apis/base_api.rb +3 -3
  6. data/lib/swagger_petstore_open_api30/apis/pet_api.rb +287 -0
  7. data/lib/swagger_petstore_open_api30/apis/store_api.rb +131 -0
  8. data/lib/swagger_petstore_open_api30/apis/user_api.rb +233 -0
  9. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/client.rb +34 -15
  10. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/configuration.rb +30 -20
  11. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/exceptions/api_exception.rb +2 -2
  12. data/lib/swagger_petstore_open_api30/exceptions/oauth_provider_exception.rb +64 -0
  13. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/api_response.rb +2 -2
  14. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/auth/api_key.rb +15 -15
  15. data/lib/swagger_petstore_open_api30/http/auth/petstore_auth.rb +112 -0
  16. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/http_call_back.rb +2 -2
  17. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/http_method_enum.rb +2 -2
  18. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/http_request.rb +2 -2
  19. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/http_response.rb +2 -2
  20. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/proxy_settings.rb +2 -2
  21. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/logging/configuration/api_logging_configuration.rb +2 -2
  22. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/logging/sdk_logger.rb +2 -2
  23. data/lib/swagger_petstore_open_api30/models/api_response.rb +118 -0
  24. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/models/base_model.rb +2 -2
  25. data/lib/{webhooks_and_callbacks_api/models/package.rb → swagger_petstore_open_api30/models/category.rb} +39 -29
  26. data/lib/swagger_petstore_open_api30/models/oauth_provider_error.rb +62 -0
  27. data/lib/swagger_petstore_open_api30/models/oauth_scope_petstore_auth.rb +36 -0
  28. data/lib/swagger_petstore_open_api30/models/oauth_token.rb +125 -0
  29. data/lib/swagger_petstore_open_api30/models/order.rb +167 -0
  30. data/lib/swagger_petstore_open_api30/models/order_status.rb +40 -0
  31. data/lib/swagger_petstore_open_api30/models/pet.rb +168 -0
  32. data/lib/swagger_petstore_open_api30/models/pet_status.rb +40 -0
  33. data/lib/{webhooks_and_callbacks_api/models/delivery_details.rb → swagger_petstore_open_api30/models/tag.rb} +36 -35
  34. data/lib/swagger_petstore_open_api30/models/user.rb +182 -0
  35. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/utilities/date_time_helper.rb +2 -2
  36. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/utilities/file_wrapper.rb +2 -2
  37. data/lib/swagger_petstore_open_api30/utilities/xml_utilities.rb +12 -0
  38. data/lib/swagger_petstore_open_api30.rb +62 -0
  39. metadata +37 -78
  40. data/lib/webhooks_and_callbacks_api/apis/orders_api.rb +0 -34
  41. data/lib/webhooks_and_callbacks_api/events/callbacks/callbacks_a_handler.rb +0 -66
  42. data/lib/webhooks_and_callbacks_api/events/callbacks/callbacks_b_handler.rb +0 -78
  43. data/lib/webhooks_and_callbacks_api/events/signature_verification_failure.rb +0 -33
  44. data/lib/webhooks_and_callbacks_api/events/signature_verification_result.rb +0 -14
  45. data/lib/webhooks_and_callbacks_api/events/unknown_event.rb +0 -32
  46. data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_a_handler.rb +0 -67
  47. data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_b_handler.rb +0 -86
  48. data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_c_handler.rb +0 -79
  49. data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_handler.rb +0 -67
  50. data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_no_verification_handler.rb +0 -39
  51. data/lib/webhooks_and_callbacks_api/exceptions/error_exception.rb +0 -57
  52. data/lib/webhooks_and_callbacks_api/http/auth/bearer_auth.rb +0 -53
  53. data/lib/webhooks_and_callbacks_api/models/address.rb +0 -114
  54. data/lib/webhooks_and_callbacks_api/models/audit_log_event.rb +0 -115
  55. data/lib/webhooks_and_callbacks_api/models/create_order_request.rb +0 -131
  56. data/lib/webhooks_and_callbacks_api/models/email_notification_callback.rb +0 -97
  57. data/lib/webhooks_and_callbacks_api/models/event.rb +0 -52
  58. data/lib/webhooks_and_callbacks_api/models/event_type.rb +0 -26
  59. data/lib/webhooks_and_callbacks_api/models/event_type1.rb +0 -26
  60. data/lib/webhooks_and_callbacks_api/models/event_type2.rb +0 -26
  61. data/lib/webhooks_and_callbacks_api/models/event_type3.rb +0 -26
  62. data/lib/webhooks_and_callbacks_api/models/fulfillment_callback.rb +0 -411
  63. data/lib/webhooks_and_callbacks_api/models/fulfillment_status.rb +0 -40
  64. data/lib/webhooks_and_callbacks_api/models/fulfillment_statuss.rb +0 -40
  65. data/lib/webhooks_and_callbacks_api/models/inventory_stock_decrease_event.rb +0 -90
  66. data/lib/webhooks_and_callbacks_api/models/inventory_stock_depleted_event.rb +0 -90
  67. data/lib/webhooks_and_callbacks_api/models/inventory_stock_increase_event.rb +0 -90
  68. data/lib/webhooks_and_callbacks_api/models/notification_callback.rb +0 -119
  69. data/lib/webhooks_and_callbacks_api/models/oauth_scope_oauth_acg.rb +0 -44
  70. data/lib/webhooks_and_callbacks_api/models/order.rb +0 -161
  71. data/lib/webhooks_and_callbacks_api/models/order_created_event.rb +0 -314
  72. data/lib/webhooks_and_callbacks_api/models/order_item.rb +0 -102
  73. data/lib/webhooks_and_callbacks_api/models/order_updated_event.rb +0 -100
  74. data/lib/webhooks_and_callbacks_api/models/payment_callback.rb +0 -167
  75. data/lib/webhooks_and_callbacks_api/models/payment_completed_event.rb +0 -98
  76. data/lib/webhooks_and_callbacks_api/models/payment_status.rb +0 -40
  77. data/lib/webhooks_and_callbacks_api/models/payment_status_created_event.rb +0 -89
  78. data/lib/webhooks_and_callbacks_api/models/payment_status_updated_event.rb +0 -89
  79. data/lib/webhooks_and_callbacks_api/models/primitive_collection_event.rb +0 -98
  80. data/lib/webhooks_and_callbacks_api/models/root_level_primitive_one_of_event_request.rb +0 -40
  81. data/lib/webhooks_and_callbacks_api/models/root_level_primitive_one_of_event_request1.rb +0 -40
  82. data/lib/webhooks_and_callbacks_api/models/sms_notification_callback.rb +0 -95
  83. data/lib/webhooks_and_callbacks_api/models/status.rb +0 -44
  84. data/lib/webhooks_and_callbacks_api/models/status1.rb +0 -36
  85. data/lib/webhooks_and_callbacks_api/models/status2.rb +0 -36
  86. data/lib/webhooks_and_callbacks_api/models/system_alert_notification_event.rb +0 -90
  87. data/lib/webhooks_and_callbacks_api/models/system_maintenance_notification_event.rb +0 -90
  88. data/lib/webhooks_and_callbacks_api/models/system_performance_notification_event.rb +0 -90
  89. data/lib/webhooks_and_callbacks_api/models/user_action_notification_event.rb +0 -90
  90. data/lib/webhooks_and_callbacks_api/models/user_preference_notification_event.rb +0 -90
  91. data/lib/webhooks_and_callbacks_api/models/user_status_notification_event.rb +0 -90
  92. data/lib/webhooks_and_callbacks_api/models/webhook.rb +0 -142
  93. data/lib/webhooks_and_callbacks_api/models/webhook_registration.rb +0 -103
  94. data/lib/webhooks_and_callbacks_api/models/webhook_update.rb +0 -105
  95. data/lib/webhooks_and_callbacks_api/utilities/union_type_lookup.rb +0 -172
  96. data/lib/webhooks_and_callbacks_api.rb +0 -122
@@ -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
@@ -0,0 +1,168 @@
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
@@ -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
+ # 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
@@ -1,36 +1,35 @@
1
- # webhooks_and_callbacks_api
1
+ # swagger_petstore_open_api30
2
2
  #
3
3
  # This file was automatically generated by
4
4
  # APIMATIC v3.0 ( https://www.apimatic.io ).
5
5
 
6
- require 'date'
7
- module WebhooksAndCallbacksApi
8
- # DeliveryDetails Model.
9
- class DeliveryDetails < BaseModel
6
+ module SwaggerPetstoreOpenApi30
7
+ # Tag Model.
8
+ class Tag < BaseModel
10
9
  SKIP = Object.new
11
10
  private_constant :SKIP
12
11
 
13
12
  # TODO: Write general description for this method
14
- # @return [String]
15
- attr_accessor :method
13
+ # @return [Integer]
14
+ attr_accessor :id
16
15
 
17
16
  # TODO: Write general description for this method
18
- # @return [DateTime]
19
- attr_accessor :eta
17
+ # @return [String]
18
+ attr_accessor :name
20
19
 
21
20
  # A mapping from model property names to API property names.
22
21
  def self.names
23
22
  @_hash = {} if @_hash.nil?
24
- @_hash['method'] = 'method'
25
- @_hash['eta'] = 'eta'
23
+ @_hash['id'] = 'id'
24
+ @_hash['name'] = 'name'
26
25
  @_hash
27
26
  end
28
27
 
29
28
  # An array for optional fields
30
29
  def self.optionals
31
30
  %w[
32
- method
33
- eta
31
+ id
32
+ name
34
33
  ]
35
34
  end
36
35
 
@@ -39,12 +38,12 @@ module WebhooksAndCallbacksApi
39
38
  []
40
39
  end
41
40
 
42
- def initialize(method: SKIP, eta: SKIP, additional_properties: nil)
41
+ def initialize(id: SKIP, name: SKIP, additional_properties: nil)
43
42
  # Add additional model properties to the instance
44
43
  additional_properties = {} if additional_properties.nil?
45
44
 
46
- @method = method unless method == SKIP
47
- @eta = eta unless eta == SKIP
45
+ @id = id unless id == SKIP
46
+ @name = name unless name == SKIP
48
47
  @additional_properties = additional_properties
49
48
  end
50
49
 
@@ -53,12 +52,8 @@ module WebhooksAndCallbacksApi
53
52
  return nil unless hash
54
53
 
55
54
  # Extract variables from the hash.
56
- method = hash.key?('method') ? hash['method'] : SKIP
57
- eta = if hash.key?('eta')
58
- (DateTimeHelper.from_rfc3339(hash['eta']) if hash['eta'])
59
- else
60
- SKIP
61
- end
55
+ id = hash.key?('id') ? hash['id'] : SKIP
56
+ name = hash.key?('name') ? hash['name'] : SKIP
62
57
 
63
58
  # Create a new hash for additional properties, removing known properties.
64
59
  new_hash = hash.reject { |k, _| names.value?(k) }
@@ -68,36 +63,42 @@ module WebhooksAndCallbacksApi
68
63
  )
69
64
 
70
65
  # Create object from extracted values.
71
- DeliveryDetails.new(method: method,
72
- eta: eta,
73
- additional_properties: additional_properties)
66
+ Tag.new(id: id,
67
+ name: name,
68
+ additional_properties: additional_properties)
74
69
  end
75
70
 
76
- def to_custom_eta
77
- DateTimeHelper.to_rfc3339(eta)
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
78
  end
79
79
 
80
- # Validates an instance of the object from a given value.
81
- # @param [DeliveryDetails | Hash] The value against the validation is performed.
82
- def self.validate(value)
83
- return true if value.instance_of? self
80
+ def to_xml_element(doc, root_name)
81
+ root = doc.create_element(root_name)
84
82
 
85
- return false unless value.instance_of? Hash
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)
86
87
 
87
- true
88
+ root
88
89
  end
89
90
 
90
91
  # Provides a human-readable string representation of the object.
91
92
  def to_s
92
93
  class_name = self.class.name.split('::').last
93
- "<#{class_name} method: #{@method}, eta: #{@eta}, additional_properties:"\
94
+ "<#{class_name} id: #{@id}, name: #{@name}, additional_properties:"\
94
95
  " #{@additional_properties}>"
95
96
  end
96
97
 
97
98
  # Provides a debugging-friendly string with detailed object information.
98
99
  def inspect
99
100
  class_name = self.class.name.split('::').last
100
- "<#{class_name} method: #{@method.inspect}, eta: #{@eta.inspect}, additional_properties:"\
101
+ "<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}, additional_properties:"\
101
102
  " #{@additional_properties}>"
102
103
  end
103
104
  end