apimaticPetstore 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +119 -0
  4. data/lib/swagger_petstore/api_helper.rb +10 -0
  5. data/lib/swagger_petstore/client.rb +76 -0
  6. data/lib/swagger_petstore/configuration.rb +125 -0
  7. data/lib/swagger_petstore/controllers/base_controller.rb +65 -0
  8. data/lib/swagger_petstore/controllers/pet_controller.rb +221 -0
  9. data/lib/swagger_petstore/controllers/store_controller.rb +104 -0
  10. data/lib/swagger_petstore/controllers/user_controller.rb +197 -0
  11. data/lib/swagger_petstore/exceptions/api_exception.rb +10 -0
  12. data/lib/swagger_petstore/exceptions/o_auth_provider_exception.rb +48 -0
  13. data/lib/swagger_petstore/http/http_call_back.rb +10 -0
  14. data/lib/swagger_petstore/http/http_method_enum.rb +10 -0
  15. data/lib/swagger_petstore/http/http_request.rb +10 -0
  16. data/lib/swagger_petstore/http/http_response.rb +10 -0
  17. data/lib/swagger_petstore/models/add_pet_request.rb +102 -0
  18. data/lib/swagger_petstore/models/base_model.rb +58 -0
  19. data/lib/swagger_petstore/models/category.rb +57 -0
  20. data/lib/swagger_petstore/models/create_user_request.rb +111 -0
  21. data/lib/swagger_petstore/models/create_users_with_array_input_request.rb +111 -0
  22. data/lib/swagger_petstore/models/create_users_with_list_input_request.rb +111 -0
  23. data/lib/swagger_petstore/models/o_auth_provider_error_enum.rb +39 -0
  24. data/lib/swagger_petstore/models/o_auth_scope_enum.rb +17 -0
  25. data/lib/swagger_petstore/models/o_auth_token.rb +100 -0
  26. data/lib/swagger_petstore/models/place_order_request.rb +93 -0
  27. data/lib/swagger_petstore/models/response200.rb +66 -0
  28. data/lib/swagger_petstore/models/response2001.rb +102 -0
  29. data/lib/swagger_petstore/models/response20011.rb +48 -0
  30. data/lib/swagger_petstore/models/response20012.rb +111 -0
  31. data/lib/swagger_petstore/models/response2007.rb +93 -0
  32. data/lib/swagger_petstore/models/tag.rb +66 -0
  33. data/lib/swagger_petstore/models/update_pet_request.rb +102 -0
  34. data/lib/swagger_petstore/models/update_user_request.rb +111 -0
  35. data/lib/swagger_petstore/utilities/date_time_helper.rb +11 -0
  36. data/lib/swagger_petstore/utilities/file_wrapper.rb +16 -0
  37. data/lib/swagger_petstore.rb +59 -0
  38. data/test/controllers/controller_test_base.rb +33 -0
  39. data/test/controllers/test_pet_controller.rb +194 -0
  40. data/test/controllers/test_store_controller.rb +158 -0
  41. data/test/controllers/test_user_controller.rb +184 -0
  42. data/test/http_response_catcher.rb +19 -0
  43. metadata +161 -0
@@ -0,0 +1,111 @@
1
+ # swagger_petstore
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SwaggerPetstore
7
+ # CreateUserRequest Model.
8
+ class CreateUserRequest < 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
+ # TODO: Write general description for this method
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
+ []
61
+ end
62
+
63
+ # An array for nullable fields
64
+ def self.nullables
65
+ []
66
+ end
67
+
68
+ def initialize(id = nil,
69
+ username = nil,
70
+ first_name = nil,
71
+ last_name = nil,
72
+ email = nil,
73
+ password = nil,
74
+ phone = nil,
75
+ user_status = nil)
76
+ @id = id
77
+ @username = username
78
+ @first_name = first_name
79
+ @last_name = last_name
80
+ @email = email
81
+ @password = password
82
+ @phone = phone
83
+ @user_status = user_status
84
+ end
85
+
86
+ # Creates an instance of the object from a hash.
87
+ def self.from_hash(hash)
88
+ return nil unless hash
89
+
90
+ # Extract variables from the hash.
91
+ id = hash.key?('id') ? hash['id'] : nil
92
+ username = hash.key?('username') ? hash['username'] : nil
93
+ first_name = hash.key?('firstName') ? hash['firstName'] : nil
94
+ last_name = hash.key?('lastName') ? hash['lastName'] : nil
95
+ email = hash.key?('email') ? hash['email'] : nil
96
+ password = hash.key?('password') ? hash['password'] : nil
97
+ phone = hash.key?('phone') ? hash['phone'] : nil
98
+ user_status = hash.key?('userStatus') ? hash['userStatus'] : nil
99
+
100
+ # Create object from extracted values.
101
+ CreateUserRequest.new(id,
102
+ username,
103
+ first_name,
104
+ last_name,
105
+ email,
106
+ password,
107
+ phone,
108
+ user_status)
109
+ end
110
+ end
111
+ end
@@ -0,0 +1,111 @@
1
+ # swagger_petstore
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SwaggerPetstore
7
+ # CreateUsersWithArrayInputRequest Model.
8
+ class CreateUsersWithArrayInputRequest < 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
+ # TODO: Write general description for this method
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
+ []
61
+ end
62
+
63
+ # An array for nullable fields
64
+ def self.nullables
65
+ []
66
+ end
67
+
68
+ def initialize(id = nil,
69
+ username = nil,
70
+ first_name = nil,
71
+ last_name = nil,
72
+ email = nil,
73
+ password = nil,
74
+ phone = nil,
75
+ user_status = nil)
76
+ @id = id
77
+ @username = username
78
+ @first_name = first_name
79
+ @last_name = last_name
80
+ @email = email
81
+ @password = password
82
+ @phone = phone
83
+ @user_status = user_status
84
+ end
85
+
86
+ # Creates an instance of the object from a hash.
87
+ def self.from_hash(hash)
88
+ return nil unless hash
89
+
90
+ # Extract variables from the hash.
91
+ id = hash.key?('id') ? hash['id'] : nil
92
+ username = hash.key?('username') ? hash['username'] : nil
93
+ first_name = hash.key?('firstName') ? hash['firstName'] : nil
94
+ last_name = hash.key?('lastName') ? hash['lastName'] : nil
95
+ email = hash.key?('email') ? hash['email'] : nil
96
+ password = hash.key?('password') ? hash['password'] : nil
97
+ phone = hash.key?('phone') ? hash['phone'] : nil
98
+ user_status = hash.key?('userStatus') ? hash['userStatus'] : nil
99
+
100
+ # Create object from extracted values.
101
+ CreateUsersWithArrayInputRequest.new(id,
102
+ username,
103
+ first_name,
104
+ last_name,
105
+ email,
106
+ password,
107
+ phone,
108
+ user_status)
109
+ end
110
+ end
111
+ end
@@ -0,0 +1,111 @@
1
+ # swagger_petstore
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SwaggerPetstore
7
+ # CreateUsersWithListInputRequest Model.
8
+ class CreateUsersWithListInputRequest < 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
+ # TODO: Write general description for this method
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
+ []
61
+ end
62
+
63
+ # An array for nullable fields
64
+ def self.nullables
65
+ []
66
+ end
67
+
68
+ def initialize(id = nil,
69
+ username = nil,
70
+ first_name = nil,
71
+ last_name = nil,
72
+ email = nil,
73
+ password = nil,
74
+ phone = nil,
75
+ user_status = nil)
76
+ @id = id
77
+ @username = username
78
+ @first_name = first_name
79
+ @last_name = last_name
80
+ @email = email
81
+ @password = password
82
+ @phone = phone
83
+ @user_status = user_status
84
+ end
85
+
86
+ # Creates an instance of the object from a hash.
87
+ def self.from_hash(hash)
88
+ return nil unless hash
89
+
90
+ # Extract variables from the hash.
91
+ id = hash.key?('id') ? hash['id'] : nil
92
+ username = hash.key?('username') ? hash['username'] : nil
93
+ first_name = hash.key?('firstName') ? hash['firstName'] : nil
94
+ last_name = hash.key?('lastName') ? hash['lastName'] : nil
95
+ email = hash.key?('email') ? hash['email'] : nil
96
+ password = hash.key?('password') ? hash['password'] : nil
97
+ phone = hash.key?('phone') ? hash['phone'] : nil
98
+ user_status = hash.key?('userStatus') ? hash['userStatus'] : nil
99
+
100
+ # Create object from extracted values.
101
+ CreateUsersWithListInputRequest.new(id,
102
+ username,
103
+ first_name,
104
+ last_name,
105
+ email,
106
+ password,
107
+ phone,
108
+ user_status)
109
+ end
110
+ end
111
+ end
@@ -0,0 +1,39 @@
1
+ # swagger_petstore
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SwaggerPetstore
7
+ # OAuth 2 Authorization error codes
8
+ class OAuthProviderErrorEnum
9
+ O_AUTH_PROVIDER_ERROR_ENUM = [
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
+ end
39
+ end
@@ -0,0 +1,17 @@
1
+ # swagger_petstore
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SwaggerPetstore
7
+ # OAuth 2 scopes supported by the API
8
+ class OAuthScopeEnum
9
+ O_AUTH_SCOPE_ENUM = [
10
+ # TODO: Write general description for READPETS
11
+ READPETS = 'read:pets'.freeze,
12
+
13
+ # TODO: Write general description for WRITEPETS
14
+ WRITEPETS = 'write:pets'.freeze
15
+ ].freeze
16
+ end
17
+ end
@@ -0,0 +1,100 @@
1
+ # swagger_petstore
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SwaggerPetstore
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 = nil,
66
+ token_type = nil,
67
+ expires_in = SKIP,
68
+ scope = SKIP,
69
+ expiry = SKIP,
70
+ refresh_token = SKIP)
71
+ @access_token = access_token
72
+ @token_type = token_type
73
+ @expires_in = expires_in unless expires_in == SKIP
74
+ @scope = scope unless scope == SKIP
75
+ @expiry = expiry unless expiry == SKIP
76
+ @refresh_token = refresh_token unless refresh_token == SKIP
77
+ end
78
+
79
+ # Creates an instance of the object from a hash.
80
+ def self.from_hash(hash)
81
+ return nil unless hash
82
+
83
+ # Extract variables from the hash.
84
+ access_token = hash.key?('access_token') ? hash['access_token'] : nil
85
+ token_type = hash.key?('token_type') ? hash['token_type'] : nil
86
+ expires_in = hash.key?('expires_in') ? hash['expires_in'] : SKIP
87
+ scope = hash.key?('scope') ? hash['scope'] : SKIP
88
+ expiry = hash.key?('expiry') ? hash['expiry'] : SKIP
89
+ refresh_token = hash.key?('refresh_token') ? hash['refresh_token'] : SKIP
90
+
91
+ # Create object from extracted values.
92
+ OAuthToken.new(access_token,
93
+ token_type,
94
+ expires_in,
95
+ scope,
96
+ expiry,
97
+ refresh_token)
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,93 @@
1
+ # swagger_petstore
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SwaggerPetstore
7
+ # PlaceOrderRequest Model.
8
+ class PlaceOrderRequest < 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 [Integer]
18
+ attr_accessor :pet_id
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [Integer]
22
+ attr_accessor :quantity
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [String]
26
+ attr_accessor :ship_date
27
+
28
+ # TODO: Write general description for this method
29
+ # @return [String]
30
+ attr_accessor :status
31
+
32
+ # TODO: Write general description for this method
33
+ # @return [TrueClass|FalseClass]
34
+ attr_accessor :complete
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['pet_id'] = 'petId'
41
+ @_hash['quantity'] = 'quantity'
42
+ @_hash['ship_date'] = 'shipDate'
43
+ @_hash['status'] = 'status'
44
+ @_hash['complete'] = 'complete'
45
+ @_hash
46
+ end
47
+
48
+ # An array for optional fields
49
+ def self.optionals
50
+ []
51
+ end
52
+
53
+ # An array for nullable fields
54
+ def self.nullables
55
+ []
56
+ end
57
+
58
+ def initialize(id = nil,
59
+ pet_id = nil,
60
+ quantity = nil,
61
+ ship_date = nil,
62
+ status = nil,
63
+ complete = nil)
64
+ @id = id
65
+ @pet_id = pet_id
66
+ @quantity = quantity
67
+ @ship_date = ship_date
68
+ @status = status
69
+ @complete = complete
70
+ end
71
+
72
+ # Creates an instance of the object from a hash.
73
+ def self.from_hash(hash)
74
+ return nil unless hash
75
+
76
+ # Extract variables from the hash.
77
+ id = hash.key?('id') ? hash['id'] : nil
78
+ pet_id = hash.key?('petId') ? hash['petId'] : nil
79
+ quantity = hash.key?('quantity') ? hash['quantity'] : nil
80
+ ship_date = hash.key?('shipDate') ? hash['shipDate'] : nil
81
+ status = hash.key?('status') ? hash['status'] : nil
82
+ complete = hash.key?('complete') ? hash['complete'] : nil
83
+
84
+ # Create object from extracted values.
85
+ PlaceOrderRequest.new(id,
86
+ pet_id,
87
+ quantity,
88
+ ship_date,
89
+ status,
90
+ complete)
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,66 @@
1
+ # swagger_petstore
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SwaggerPetstore
7
+ # Response200 Model.
8
+ class Response200 < 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
+ []
36
+ end
37
+
38
+ # An array for nullable fields
39
+ def self.nullables
40
+ []
41
+ end
42
+
43
+ def initialize(code = nil,
44
+ type = nil,
45
+ message = nil)
46
+ @code = code
47
+ @type = type
48
+ @message = message
49
+ end
50
+
51
+ # Creates an instance of the object from a hash.
52
+ def self.from_hash(hash)
53
+ return nil unless hash
54
+
55
+ # Extract variables from the hash.
56
+ code = hash.key?('code') ? hash['code'] : nil
57
+ type = hash.key?('type') ? hash['type'] : nil
58
+ message = hash.key?('message') ? hash['message'] : nil
59
+
60
+ # Create object from extracted values.
61
+ Response200.new(code,
62
+ type,
63
+ message)
64
+ end
65
+ end
66
+ end