apimaticPetstore 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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,102 @@
1
+ # swagger_petstore
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SwaggerPetstore
7
+ # Response2001 Model.
8
+ class Response2001 < 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 [List of 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 [List of Tag]
30
+ attr_accessor :tags
31
+
32
+ # TODO: Write general description for this method
33
+ # @return [String]
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['name'] = 'name'
40
+ @_hash['photo_urls'] = 'photoUrls'
41
+ @_hash['id'] = 'id'
42
+ @_hash['category'] = 'category'
43
+ @_hash['tags'] = 'tags'
44
+ @_hash['status'] = 'status'
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(name = nil,
59
+ photo_urls = nil,
60
+ id = nil,
61
+ category = nil,
62
+ tags = nil,
63
+ status = nil)
64
+ @name = name
65
+ @photo_urls = photo_urls
66
+ @id = id
67
+ @category = category
68
+ @tags = tags
69
+ @status = status
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
+ name = hash.key?('name') ? hash['name'] : nil
78
+ photo_urls = hash.key?('photoUrls') ? hash['photoUrls'] : nil
79
+ id = hash.key?('id') ? hash['id'] : nil
80
+ category = Category.from_hash(hash['category']) if hash['category']
81
+ # Parameter is an array, so we need to iterate through it
82
+ tags = nil
83
+ unless hash['tags'].nil?
84
+ tags = []
85
+ hash['tags'].each do |structure|
86
+ tags << (Tag.from_hash(structure) if structure)
87
+ end
88
+ end
89
+
90
+ tags = nil unless hash.key?('tags')
91
+ status = hash.key?('status') ? hash['status'] : nil
92
+
93
+ # Create object from extracted values.
94
+ Response2001.new(name,
95
+ photo_urls,
96
+ id,
97
+ category,
98
+ tags,
99
+ status)
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,48 @@
1
+ # swagger_petstore
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SwaggerPetstore
7
+ # Response20011 Model.
8
+ class Response20011 < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Integer]
14
+ attr_accessor :key1
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['key1'] = 'key1'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ []
26
+ end
27
+
28
+ # An array for nullable fields
29
+ def self.nullables
30
+ []
31
+ end
32
+
33
+ def initialize(key1 = nil)
34
+ @key1 = key1
35
+ end
36
+
37
+ # Creates an instance of the object from a hash.
38
+ def self.from_hash(hash)
39
+ return nil unless hash
40
+
41
+ # Extract variables from the hash.
42
+ key1 = hash.key?('key1') ? hash['key1'] : nil
43
+
44
+ # Create object from extracted values.
45
+ Response20011.new(key1)
46
+ end
47
+ end
48
+ 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
+ # Response20012 Model.
8
+ class Response20012 < 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
+ Response20012.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,93 @@
1
+ # swagger_petstore
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SwaggerPetstore
7
+ # Response2007 Model.
8
+ class Response2007 < 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
+ Response2007.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
+ # 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 [List of String]
14
+ attr_accessor :photo_urls
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Integer]
18
+ attr_accessor :id
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [String]
22
+ attr_accessor :name
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['photo_urls'] = 'photoUrls'
28
+ @_hash['id'] = 'id'
29
+ @_hash['name'] = 'name'
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(photo_urls = nil,
44
+ id = nil,
45
+ name = nil)
46
+ @photo_urls = photo_urls
47
+ @id = id
48
+ @name = name
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
+ photo_urls = hash.key?('photoUrls') ? hash['photoUrls'] : nil
57
+ id = hash.key?('id') ? hash['id'] : nil
58
+ name = hash.key?('name') ? hash['name'] : nil
59
+
60
+ # Create object from extracted values.
61
+ Tag.new(photo_urls,
62
+ id,
63
+ name)
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,102 @@
1
+ # swagger_petstore
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SwaggerPetstore
7
+ # UpdatePetRequest Model.
8
+ class UpdatePetRequest < 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 [List of 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 [List of Tag]
30
+ attr_accessor :tags
31
+
32
+ # TODO: Write general description for this method
33
+ # @return [String]
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['name'] = 'name'
40
+ @_hash['photo_urls'] = 'photoUrls'
41
+ @_hash['id'] = 'id'
42
+ @_hash['category'] = 'category'
43
+ @_hash['tags'] = 'tags'
44
+ @_hash['status'] = 'status'
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(name = nil,
59
+ photo_urls = nil,
60
+ id = nil,
61
+ category = nil,
62
+ tags = nil,
63
+ status = nil)
64
+ @name = name
65
+ @photo_urls = photo_urls
66
+ @id = id
67
+ @category = category
68
+ @tags = tags
69
+ @status = status
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
+ name = hash.key?('name') ? hash['name'] : nil
78
+ photo_urls = hash.key?('photoUrls') ? hash['photoUrls'] : nil
79
+ id = hash.key?('id') ? hash['id'] : nil
80
+ category = Category.from_hash(hash['category']) if hash['category']
81
+ # Parameter is an array, so we need to iterate through it
82
+ tags = nil
83
+ unless hash['tags'].nil?
84
+ tags = []
85
+ hash['tags'].each do |structure|
86
+ tags << (Tag.from_hash(structure) if structure)
87
+ end
88
+ end
89
+
90
+ tags = nil unless hash.key?('tags')
91
+ status = hash.key?('status') ? hash['status'] : nil
92
+
93
+ # Create object from extracted values.
94
+ UpdatePetRequest.new(name,
95
+ photo_urls,
96
+ id,
97
+ category,
98
+ tags,
99
+ status)
100
+ end
101
+ end
102
+ 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
+ # UpdateUserRequest Model.
8
+ class UpdateUserRequest < 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
+ UpdateUserRequest.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,11 @@
1
+ # swagger_petstore
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ require 'date'
7
+ module SwaggerPetstore
8
+ # A utility that supports dateTime conversion to different formats
9
+ class DateTimeHelper < CoreLibrary::DateTimeHelper
10
+ end
11
+ end
@@ -0,0 +1,16 @@
1
+ # swagger_petstore
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SwaggerPetstore
7
+ # A utility to allow users to set the content-type for files
8
+ class FileWrapper < CoreLibrary::FileWrapper
9
+ # The constructor.
10
+ # @param [File] file The file to be sent in the request.
11
+ # @param [string] content_type The content type of the provided file.
12
+ def initialize(file, content_type: 'application/octet-stream')
13
+ super
14
+ end
15
+ end
16
+ end