petstore-pets 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +96 -0
  4. data/lib/swagger_petstore_open_api30/api_helper.rb +10 -0
  5. data/lib/swagger_petstore_open_api30/client.rb +72 -0
  6. data/lib/swagger_petstore_open_api30/configuration.rb +125 -0
  7. data/lib/swagger_petstore_open_api30/controllers/base_controller.rb +66 -0
  8. data/lib/swagger_petstore_open_api30/controllers/pet_controller.rb +226 -0
  9. data/lib/swagger_petstore_open_api30/controllers/store_controller.rb +107 -0
  10. data/lib/swagger_petstore_open_api30/controllers/user_controller.rb +189 -0
  11. data/lib/swagger_petstore_open_api30/exceptions/api_exception.rb +21 -0
  12. data/lib/swagger_petstore_open_api30/http/auth/custom_header_authentication.rb +42 -0
  13. data/lib/swagger_petstore_open_api30/http/http_call_back.rb +10 -0
  14. data/lib/swagger_petstore_open_api30/http/http_method_enum.rb +10 -0
  15. data/lib/swagger_petstore_open_api30/http/http_request.rb +10 -0
  16. data/lib/swagger_petstore_open_api30/http/http_response.rb +10 -0
  17. data/lib/swagger_petstore_open_api30/models/address.rb +90 -0
  18. data/lib/swagger_petstore_open_api30/models/base_model.rb +110 -0
  19. data/lib/swagger_petstore_open_api30/models/category.rb +71 -0
  20. data/lib/swagger_petstore_open_api30/models/customer.rb +90 -0
  21. data/lib/swagger_petstore_open_api30/models/order.rb +120 -0
  22. data/lib/swagger_petstore_open_api30/models/order_status_enum.rb +26 -0
  23. data/lib/swagger_petstore_open_api30/models/pet.rb +118 -0
  24. data/lib/swagger_petstore_open_api30/models/pet_image.rb +81 -0
  25. data/lib/swagger_petstore_open_api30/models/pet_status_enum.rb +26 -0
  26. data/lib/swagger_petstore_open_api30/models/status_enum.rb +26 -0
  27. data/lib/swagger_petstore_open_api30/models/tag.rb +71 -0
  28. data/lib/swagger_petstore_open_api30/models/user.rb +132 -0
  29. data/lib/swagger_petstore_open_api30/utilities/date_time_helper.rb +11 -0
  30. data/lib/swagger_petstore_open_api30/utilities/file_wrapper.rb +28 -0
  31. data/lib/swagger_petstore_open_api30.rb +53 -0
  32. data/test/controllers/controller_test_base.rb +29 -0
  33. data/test/controllers/test_pet_controller.rb +50 -0
  34. data/test/controllers/test_store_controller.rb +56 -0
  35. data/test/controllers/test_user_controller.rb +53 -0
  36. data/test/http_response_catcher.rb +19 -0
  37. metadata +147 -0
@@ -0,0 +1,90 @@
1
+ # swagger_petstore_open_api30
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SwaggerPetstoreOpenApi30
7
+ # Customer Model.
8
+ class Customer < 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 [Array[Address]]
22
+ attr_accessor :address
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['id'] = 'id'
28
+ @_hash['username'] = 'username'
29
+ @_hash['address'] = 'address'
30
+ @_hash
31
+ end
32
+
33
+ # An array for optional fields
34
+ def self.optionals
35
+ %w[
36
+ id
37
+ username
38
+ address
39
+ ]
40
+ end
41
+
42
+ # An array for nullable fields
43
+ def self.nullables
44
+ []
45
+ end
46
+
47
+ def initialize(id = SKIP, username = SKIP, address = SKIP)
48
+ @id = id unless id == SKIP
49
+ @username = username unless username == SKIP
50
+ @address = address unless address == SKIP
51
+ end
52
+
53
+ # Creates an instance of the object from a hash.
54
+ def self.from_hash(hash)
55
+ return nil unless hash
56
+
57
+ # Extract variables from the hash.
58
+ id = hash.key?('id') ? hash['id'] : SKIP
59
+ username = hash.key?('username') ? hash['username'] : SKIP
60
+ # Parameter is an array, so we need to iterate through it
61
+ address = nil
62
+ unless hash['address'].nil?
63
+ address = []
64
+ hash['address'].each do |structure|
65
+ address << (Address.from_hash(structure) if structure)
66
+ end
67
+ end
68
+
69
+ address = SKIP unless hash.key?('address')
70
+
71
+ # Create object from extracted values.
72
+ Customer.new(id,
73
+ username,
74
+ address)
75
+ end
76
+
77
+ # Provides a human-readable string representation of the object.
78
+ def to_s
79
+ class_name = self.class.name.split('::').last
80
+ "<#{class_name} id: #{@id}, username: #{@username}, address: #{@address}>"
81
+ end
82
+
83
+ # Provides a debugging-friendly string with detailed object information.
84
+ def inspect
85
+ class_name = self.class.name.split('::').last
86
+ "<#{class_name} id: #{@id.inspect}, username: #{@username.inspect}, address:"\
87
+ " #{@address.inspect}>"
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,120 @@
1
+ # swagger_petstore_open_api30
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://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 [OrderStatusEnum]
31
+ attr_accessor :order_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['order_status'] = 'orderStatus'
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
+ order_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
+ order_status = OrderStatusEnum::APPROVED, complete = SKIP)
68
+ @id = id unless id == SKIP
69
+ @pet_id = pet_id unless pet_id == SKIP
70
+ @quantity = quantity unless quantity == SKIP
71
+ @ship_date = ship_date unless ship_date == SKIP
72
+ @order_status = order_status unless order_status == SKIP
73
+ @complete = complete unless complete == SKIP
74
+ end
75
+
76
+ # Creates an instance of the object from a hash.
77
+ def self.from_hash(hash)
78
+ return nil unless hash
79
+
80
+ # Extract variables from the hash.
81
+ id = hash.key?('id') ? hash['id'] : SKIP
82
+ pet_id = hash.key?('petId') ? hash['petId'] : SKIP
83
+ quantity = hash.key?('quantity') ? hash['quantity'] : SKIP
84
+ ship_date = if hash.key?('shipDate')
85
+ (DateTimeHelper.from_rfc3339(hash['shipDate']) if hash['shipDate'])
86
+ else
87
+ SKIP
88
+ end
89
+ order_status = hash['orderStatus'] ||= OrderStatusEnum::APPROVED
90
+ complete = hash.key?('complete') ? hash['complete'] : SKIP
91
+
92
+ # Create object from extracted values.
93
+ Order.new(id,
94
+ pet_id,
95
+ quantity,
96
+ ship_date,
97
+ order_status,
98
+ complete)
99
+ end
100
+
101
+ def to_custom_ship_date
102
+ DateTimeHelper.to_rfc3339(ship_date)
103
+ end
104
+
105
+ # Provides a human-readable string representation of the object.
106
+ def to_s
107
+ class_name = self.class.name.split('::').last
108
+ "<#{class_name} id: #{@id}, pet_id: #{@pet_id}, quantity: #{@quantity}, ship_date:"\
109
+ " #{@ship_date}, order_status: #{@order_status}, complete: #{@complete}>"
110
+ end
111
+
112
+ # Provides a debugging-friendly string with detailed object information.
113
+ def inspect
114
+ class_name = self.class.name.split('::').last
115
+ "<#{class_name} id: #{@id.inspect}, pet_id: #{@pet_id.inspect}, quantity:"\
116
+ " #{@quantity.inspect}, ship_date: #{@ship_date.inspect}, order_status:"\
117
+ " #{@order_status.inspect}, complete: #{@complete.inspect}>"
118
+ end
119
+ end
120
+ end
@@ -0,0 +1,26 @@
1
+ # swagger_petstore_open_api30
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SwaggerPetstoreOpenApi30
7
+ # Order Status
8
+ class OrderStatusEnum
9
+ ORDER_STATUS_ENUM = [
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_ENUM.include?(value)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,118 @@
1
+ # swagger_petstore_open_api30
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://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 [String]
14
+ attr_accessor :name
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Array[String]]
18
+ attr_accessor :photo_urls
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [Integer]
22
+ attr_accessor :id
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [Category]
26
+ attr_accessor :category
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 [PetStatusEnum]
34
+ attr_accessor :pet_status
35
+
36
+ # A mapping from model property names to API property names.
37
+ def self.names
38
+ @_hash = {} if @_hash.nil?
39
+ @_hash['name'] = 'name'
40
+ @_hash['photo_urls'] = 'photoUrls'
41
+ @_hash['id'] = 'id'
42
+ @_hash['category'] = 'category'
43
+ @_hash['tags'] = 'tags'
44
+ @_hash['pet_status'] = 'petStatus'
45
+ @_hash
46
+ end
47
+
48
+ # An array for optional fields
49
+ def self.optionals
50
+ %w[
51
+ id
52
+ category
53
+ tags
54
+ pet_status
55
+ ]
56
+ end
57
+
58
+ # An array for nullable fields
59
+ def self.nullables
60
+ []
61
+ end
62
+
63
+ def initialize(name = nil, photo_urls = nil, id = SKIP, category = SKIP,
64
+ tags = SKIP, pet_status = SKIP)
65
+ @name = name
66
+ @photo_urls = photo_urls
67
+ @id = id unless id == SKIP
68
+ @category = category unless category == SKIP
69
+ @tags = tags unless tags == SKIP
70
+ @pet_status = pet_status unless pet_status == SKIP
71
+ end
72
+
73
+ # Creates an instance of the object from a hash.
74
+ def self.from_hash(hash)
75
+ return nil unless hash
76
+
77
+ # Extract variables from the hash.
78
+ name = hash.key?('name') ? hash['name'] : nil
79
+ photo_urls = hash.key?('photoUrls') ? hash['photoUrls'] : nil
80
+ id = hash.key?('id') ? hash['id'] : SKIP
81
+ category = Category.from_hash(hash['category']) if hash['category']
82
+ # Parameter is an array, so we need to iterate through it
83
+ tags = nil
84
+ unless hash['tags'].nil?
85
+ tags = []
86
+ hash['tags'].each do |structure|
87
+ tags << (Tag.from_hash(structure) if structure)
88
+ end
89
+ end
90
+
91
+ tags = SKIP unless hash.key?('tags')
92
+ pet_status = hash.key?('petStatus') ? hash['petStatus'] : SKIP
93
+
94
+ # Create object from extracted values.
95
+ Pet.new(name,
96
+ photo_urls,
97
+ id,
98
+ category,
99
+ tags,
100
+ pet_status)
101
+ end
102
+
103
+ # Provides a human-readable string representation of the object.
104
+ def to_s
105
+ class_name = self.class.name.split('::').last
106
+ "<#{class_name} name: #{@name}, photo_urls: #{@photo_urls}, id: #{@id}, category:"\
107
+ " #{@category}, tags: #{@tags}, pet_status: #{@pet_status}>"
108
+ end
109
+
110
+ # Provides a debugging-friendly string with detailed object information.
111
+ def inspect
112
+ class_name = self.class.name.split('::').last
113
+ "<#{class_name} name: #{@name.inspect}, photo_urls: #{@photo_urls.inspect}, id:"\
114
+ " #{@id.inspect}, category: #{@category.inspect}, tags: #{@tags.inspect}, pet_status:"\
115
+ " #{@pet_status.inspect}>"
116
+ end
117
+ end
118
+ end
@@ -0,0 +1,81 @@
1
+ # swagger_petstore_open_api30
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SwaggerPetstoreOpenApi30
7
+ # PetImage Model.
8
+ class PetImage < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Integer]
14
+ attr_accessor :code
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :type
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [String]
22
+ attr_accessor :message
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['code'] = 'code'
28
+ @_hash['type'] = 'type'
29
+ @_hash['message'] = 'message'
30
+ @_hash
31
+ end
32
+
33
+ # An array for optional fields
34
+ def self.optionals
35
+ %w[
36
+ code
37
+ type
38
+ message
39
+ ]
40
+ end
41
+
42
+ # An array for nullable fields
43
+ def self.nullables
44
+ []
45
+ end
46
+
47
+ def initialize(code = SKIP, type = SKIP, message = SKIP)
48
+ @code = code unless code == SKIP
49
+ @type = type unless type == SKIP
50
+ @message = message unless message == SKIP
51
+ end
52
+
53
+ # Creates an instance of the object from a hash.
54
+ def self.from_hash(hash)
55
+ return nil unless hash
56
+
57
+ # Extract variables from the hash.
58
+ code = hash.key?('code') ? hash['code'] : SKIP
59
+ type = hash.key?('type') ? hash['type'] : SKIP
60
+ message = hash.key?('message') ? hash['message'] : SKIP
61
+
62
+ # Create object from extracted values.
63
+ PetImage.new(code,
64
+ type,
65
+ message)
66
+ end
67
+
68
+ # Provides a human-readable string representation of the object.
69
+ def to_s
70
+ class_name = self.class.name.split('::').last
71
+ "<#{class_name} code: #{@code}, type: #{@type}, message: #{@message}>"
72
+ end
73
+
74
+ # Provides a debugging-friendly string with detailed object information.
75
+ def inspect
76
+ class_name = self.class.name.split('::').last
77
+ "<#{class_name} code: #{@code.inspect}, type: #{@type.inspect}, message:"\
78
+ " #{@message.inspect}>"
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,26 @@
1
+ # swagger_petstore_open_api30
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SwaggerPetstoreOpenApi30
7
+ # pet status in the store
8
+ class PetStatusEnum
9
+ PET_STATUS_ENUM = [
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_ENUM.include?(value)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ # swagger_petstore_open_api30
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SwaggerPetstoreOpenApi30
7
+ # status.
8
+ class StatusEnum
9
+ STATUS_ENUM = [
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
+ STATUS_ENUM.include?(value)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,71 @@
1
+ # swagger_petstore_open_api30
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://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)
42
+ @id = id unless id == SKIP
43
+ @name = name unless name == SKIP
44
+ end
45
+
46
+ # Creates an instance of the object from a hash.
47
+ def self.from_hash(hash)
48
+ return nil unless hash
49
+
50
+ # Extract variables from the hash.
51
+ id = hash.key?('id') ? hash['id'] : SKIP
52
+ name = hash.key?('name') ? hash['name'] : SKIP
53
+
54
+ # Create object from extracted values.
55
+ Tag.new(id,
56
+ name)
57
+ end
58
+
59
+ # Provides a human-readable string representation of the object.
60
+ def to_s
61
+ class_name = self.class.name.split('::').last
62
+ "<#{class_name} id: #{@id}, name: #{@name}>"
63
+ end
64
+
65
+ # Provides a debugging-friendly string with detailed object information.
66
+ def inspect
67
+ class_name = self.class.name.split('::').last
68
+ "<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}>"
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,132 @@
1
+ # swagger_petstore_open_api30
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://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,
78
+ last_name = SKIP, email = SKIP, password = SKIP,
79
+ phone = SKIP, user_status = SKIP)
80
+ @id = id unless id == SKIP
81
+ @username = username unless username == SKIP
82
+ @first_name = first_name unless first_name == SKIP
83
+ @last_name = last_name unless last_name == SKIP
84
+ @email = email unless email == SKIP
85
+ @password = password unless password == SKIP
86
+ @phone = phone unless phone == SKIP
87
+ @user_status = user_status unless user_status == SKIP
88
+ end
89
+
90
+ # Creates an instance of the object from a hash.
91
+ def self.from_hash(hash)
92
+ return nil unless hash
93
+
94
+ # Extract variables from the hash.
95
+ id = hash.key?('id') ? hash['id'] : SKIP
96
+ username = hash.key?('username') ? hash['username'] : SKIP
97
+ first_name = hash.key?('firstName') ? hash['firstName'] : SKIP
98
+ last_name = hash.key?('lastName') ? hash['lastName'] : SKIP
99
+ email = hash.key?('email') ? hash['email'] : SKIP
100
+ password = hash.key?('password') ? hash['password'] : SKIP
101
+ phone = hash.key?('phone') ? hash['phone'] : SKIP
102
+ user_status = hash.key?('userStatus') ? hash['userStatus'] : SKIP
103
+
104
+ # Create object from extracted values.
105
+ User.new(id,
106
+ username,
107
+ first_name,
108
+ last_name,
109
+ email,
110
+ password,
111
+ phone,
112
+ user_status)
113
+ end
114
+
115
+ # Provides a human-readable string representation of the object.
116
+ def to_s
117
+ class_name = self.class.name.split('::').last
118
+ "<#{class_name} id: #{@id}, username: #{@username}, first_name: #{@first_name}, last_name:"\
119
+ " #{@last_name}, email: #{@email}, password: #{@password}, phone: #{@phone}, user_status:"\
120
+ " #{@user_status}>"
121
+ end
122
+
123
+ # Provides a debugging-friendly string with detailed object information.
124
+ def inspect
125
+ class_name = self.class.name.split('::').last
126
+ "<#{class_name} id: #{@id.inspect}, username: #{@username.inspect}, first_name:"\
127
+ " #{@first_name.inspect}, last_name: #{@last_name.inspect}, email: #{@email.inspect},"\
128
+ " password: #{@password.inspect}, phone: #{@phone.inspect}, user_status:"\
129
+ " #{@user_status.inspect}>"
130
+ end
131
+ end
132
+ end
@@ -0,0 +1,11 @@
1
+ # swagger_petstore_open_api30
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ require 'date'
7
+ module SwaggerPetstoreOpenApi30
8
+ # A utility that supports dateTime conversion to different formats
9
+ class DateTimeHelper < CoreLibrary::DateTimeHelper
10
+ end
11
+ end