wesley-key-sdk 3.0.7 → 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 (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +168 -131
  3. data/bin/console +4 -4
  4. data/lib/swagger_petstore_open_api30/api_helper.rb +10 -0
  5. data/lib/{cypress_test_api/controllers/base_controller.rb → swagger_petstore_open_api30/apis/base_api.rb} +17 -10
  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/swagger_petstore_open_api30/client.rb +95 -0
  10. data/lib/{cypress_test_api → swagger_petstore_open_api30}/configuration.rb +72 -47
  11. data/lib/{cypress_test_api → swagger_petstore_open_api30}/exceptions/api_exception.rb +4 -4
  12. data/lib/swagger_petstore_open_api30/exceptions/oauth_provider_exception.rb +64 -0
  13. data/lib/swagger_petstore_open_api30/http/api_response.rb +19 -0
  14. data/lib/swagger_petstore_open_api30/http/auth/api_key.rb +52 -0
  15. data/lib/swagger_petstore_open_api30/http/auth/petstore_auth.rb +112 -0
  16. data/lib/swagger_petstore_open_api30/http/http_call_back.rb +10 -0
  17. data/lib/swagger_petstore_open_api30/http/http_method_enum.rb +10 -0
  18. data/lib/swagger_petstore_open_api30/http/http_request.rb +10 -0
  19. data/lib/swagger_petstore_open_api30/http/http_response.rb +10 -0
  20. data/lib/{cypress_test_api → swagger_petstore_open_api30}/http/proxy_settings.rb +4 -4
  21. data/lib/swagger_petstore_open_api30/logging/configuration/api_logging_configuration.rb +186 -0
  22. data/lib/swagger_petstore_open_api30/logging/sdk_logger.rb +17 -0
  23. data/lib/swagger_petstore_open_api30/models/api_response.rb +118 -0
  24. data/lib/{cypress_test_api → swagger_petstore_open_api30}/models/base_model.rb +4 -4
  25. data/lib/swagger_petstore_open_api30/models/category.rb +105 -0
  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/swagger_petstore_open_api30/models/tag.rb +105 -0
  34. data/lib/swagger_petstore_open_api30/models/user.rb +182 -0
  35. data/lib/swagger_petstore_open_api30/utilities/date_time_helper.rb +11 -0
  36. data/lib/{cypress_test_api → swagger_petstore_open_api30}/utilities/file_wrapper.rb +4 -4
  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 -64
  40. data/lib/cypress_test_api/api_helper.rb +0 -10
  41. data/lib/cypress_test_api/client.rb +0 -58
  42. data/lib/cypress_test_api/controllers/api_controller.rb +0 -102
  43. data/lib/cypress_test_api/http/http_call_back.rb +0 -10
  44. data/lib/cypress_test_api/http/http_method_enum.rb +0 -10
  45. data/lib/cypress_test_api/http/http_request.rb +0 -10
  46. data/lib/cypress_test_api/http/http_response.rb +0 -10
  47. data/lib/cypress_test_api/models/custom_enum.rb +0 -40
  48. data/lib/cypress_test_api/models/deer.rb +0 -68
  49. data/lib/cypress_test_api/models/item.rb +0 -166
  50. data/lib/cypress_test_api/models/item_response.rb +0 -80
  51. data/lib/cypress_test_api/models/lion.rb +0 -68
  52. data/lib/cypress_test_api/models/message.rb +0 -68
  53. data/lib/cypress_test_api/models/message2.rb +0 -71
  54. data/lib/cypress_test_api/models/multiple_arrays_request.rb +0 -70
  55. data/lib/cypress_test_api/models/nac_tag.rb +0 -265
  56. data/lib/cypress_test_api/models/o_auth_scope_o_auth_acg_enum.rb +0 -44
  57. data/lib/cypress_test_api/models/response_http400.rb +0 -62
  58. data/lib/cypress_test_api/models/response_http404.rb +0 -62
  59. data/lib/cypress_test_api/models/status11_enum.rb +0 -40
  60. data/lib/cypress_test_api/models/status1_enum.rb +0 -40
  61. data/lib/cypress_test_api/models/status_enum.rb +0 -40
  62. data/lib/cypress_test_api/models/tokens_request.rb +0 -60
  63. data/lib/cypress_test_api/utilities/date_time_helper.rb +0 -11
  64. data/lib/cypress_test_api.rb +0 -55
  65. data/test/controllers/controller_test_base.rb +0 -23
  66. data/test/controllers/test_api_controller.rb +0 -40
  67. data/test/http_response_catcher.rb +0 -19
@@ -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
@@ -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
+ # Tag Model.
8
+ class Tag < 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
+ Tag.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,182 @@
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
+ # 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 :username
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [String]
22
+ attr_accessor :first_name
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [String]
26
+ attr_accessor :last_name
27
+
28
+ # TODO: Write general description for this method
29
+ # @return [String]
30
+ attr_accessor :email
31
+
32
+ # TODO: Write general description for this method
33
+ # @return [String]
34
+ attr_accessor :password
35
+
36
+ # TODO: Write general description for this method
37
+ # @return [String]
38
+ attr_accessor :phone
39
+
40
+ # User Status
41
+ # @return [Integer]
42
+ attr_accessor :user_status
43
+
44
+ # A mapping from model property names to API property names.
45
+ def self.names
46
+ @_hash = {} if @_hash.nil?
47
+ @_hash['id'] = 'id'
48
+ @_hash['username'] = 'username'
49
+ @_hash['first_name'] = 'firstName'
50
+ @_hash['last_name'] = 'lastName'
51
+ @_hash['email'] = 'email'
52
+ @_hash['password'] = 'password'
53
+ @_hash['phone'] = 'phone'
54
+ @_hash['user_status'] = 'userStatus'
55
+ @_hash
56
+ end
57
+
58
+ # An array for optional fields
59
+ def self.optionals
60
+ %w[
61
+ id
62
+ username
63
+ first_name
64
+ last_name
65
+ email
66
+ password
67
+ phone
68
+ user_status
69
+ ]
70
+ end
71
+
72
+ # An array for nullable fields
73
+ def self.nullables
74
+ []
75
+ end
76
+
77
+ def initialize(id: SKIP, username: SKIP, first_name: SKIP, last_name: SKIP,
78
+ email: SKIP, password: SKIP, phone: SKIP, user_status: SKIP,
79
+ additional_properties: nil)
80
+ # Add additional model properties to the instance
81
+ additional_properties = {} if additional_properties.nil?
82
+
83
+ @id = id unless id == SKIP
84
+ @username = username unless username == SKIP
85
+ @first_name = first_name unless first_name == SKIP
86
+ @last_name = last_name unless last_name == SKIP
87
+ @email = email unless email == SKIP
88
+ @password = password unless password == SKIP
89
+ @phone = phone unless phone == SKIP
90
+ @user_status = user_status unless user_status == SKIP
91
+ @additional_properties = additional_properties
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
+ id = hash.key?('id') ? hash['id'] : SKIP
100
+ username = hash.key?('username') ? hash['username'] : SKIP
101
+ first_name = hash.key?('firstName') ? hash['firstName'] : SKIP
102
+ last_name = hash.key?('lastName') ? hash['lastName'] : SKIP
103
+ email = hash.key?('email') ? hash['email'] : SKIP
104
+ password = hash.key?('password') ? hash['password'] : SKIP
105
+ phone = hash.key?('phone') ? hash['phone'] : SKIP
106
+ user_status = hash.key?('userStatus') ? hash['userStatus'] : SKIP
107
+
108
+ # Create a new hash for additional properties, removing known properties.
109
+ new_hash = hash.reject { |k, _| names.value?(k) }
110
+
111
+ additional_properties = APIHelper.get_additional_properties(
112
+ new_hash, proc { |value| value }
113
+ )
114
+
115
+ # Create object from extracted values.
116
+ User.new(id: id,
117
+ username: username,
118
+ first_name: first_name,
119
+ last_name: last_name,
120
+ email: email,
121
+ password: password,
122
+ phone: phone,
123
+ user_status: user_status,
124
+ additional_properties: additional_properties)
125
+ end
126
+
127
+ def self.from_element(root)
128
+ id = XmlUtilities.from_element(root, 'id', Integer)
129
+ username = XmlUtilities.from_element(root, 'username', String)
130
+ first_name = XmlUtilities.from_element(root, 'firstName', String)
131
+ last_name = XmlUtilities.from_element(root, 'lastName', String)
132
+ email = XmlUtilities.from_element(root, 'email', String)
133
+ password = XmlUtilities.from_element(root, 'password', String)
134
+ phone = XmlUtilities.from_element(root, 'phone', String)
135
+ user_status = XmlUtilities.from_element(root, 'userStatus', Integer)
136
+
137
+ new(id: id,
138
+ username: username,
139
+ first_name: first_name,
140
+ last_name: last_name,
141
+ email: email,
142
+ password: password,
143
+ phone: phone,
144
+ user_status: user_status,
145
+ additional_properties: additional_properties)
146
+ end
147
+
148
+ def to_xml_element(doc, root_name)
149
+ root = doc.create_element(root_name)
150
+
151
+ XmlUtilities.add_as_subelement(doc, root, 'id', id)
152
+ XmlUtilities.add_as_subelement(doc, root, 'username', username)
153
+ XmlUtilities.add_as_subelement(doc, root, 'firstName', first_name)
154
+ XmlUtilities.add_as_subelement(doc, root, 'lastName', last_name)
155
+ XmlUtilities.add_as_subelement(doc, root, 'email', email)
156
+ XmlUtilities.add_as_subelement(doc, root, 'password', password)
157
+ XmlUtilities.add_as_subelement(doc, root, 'phone', phone)
158
+ XmlUtilities.add_as_subelement(doc, root, 'userStatus', user_status)
159
+ XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
160
+ additional_properties)
161
+
162
+ root
163
+ end
164
+
165
+ # Provides a human-readable string representation of the object.
166
+ def to_s
167
+ class_name = self.class.name.split('::').last
168
+ "<#{class_name} id: #{@id}, username: #{@username}, first_name: #{@first_name}, last_name:"\
169
+ " #{@last_name}, email: #{@email}, password: #{@password}, phone: #{@phone}, user_status:"\
170
+ " #{@user_status}, additional_properties: #{@additional_properties}>"
171
+ end
172
+
173
+ # Provides a debugging-friendly string with detailed object information.
174
+ def inspect
175
+ class_name = self.class.name.split('::').last
176
+ "<#{class_name} id: #{@id.inspect}, username: #{@username.inspect}, first_name:"\
177
+ " #{@first_name.inspect}, last_name: #{@last_name.inspect}, email: #{@email.inspect},"\
178
+ " password: #{@password.inspect}, phone: #{@phone.inspect}, user_status:"\
179
+ " #{@user_status.inspect}, additional_properties: #{@additional_properties}>"
180
+ end
181
+ end
182
+ end