allq_client 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 (55) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/Gemfile.lock +69 -0
  4. data/README.md +111 -0
  5. data/Rakefile +8 -0
  6. data/allq_client.gemspec +46 -0
  7. data/docs/ActionsApi.md +544 -0
  8. data/docs/AdminApi.md +98 -0
  9. data/docs/BasicPayload.md +11 -0
  10. data/docs/BasicResponse.md +8 -0
  11. data/docs/JobRef.md +8 -0
  12. data/docs/JobResponse.md +12 -0
  13. data/docs/NewJob.md +13 -0
  14. data/docs/NewParentJob.md +16 -0
  15. data/docs/StatsInfo.md +9 -0
  16. data/docs/StatsResults.md +10 -0
  17. data/docs/StatsTube.md +14 -0
  18. data/docs/Throttle.md +9 -0
  19. data/docs/TubeRef.md +8 -0
  20. data/git_push.sh +55 -0
  21. data/lib/allq_client.rb +52 -0
  22. data/lib/allq_client/api/actions_api.rb +642 -0
  23. data/lib/allq_client/api/admin_api.rb +128 -0
  24. data/lib/allq_client/api_client.rb +388 -0
  25. data/lib/allq_client/api_error.rb +38 -0
  26. data/lib/allq_client/configuration.rb +202 -0
  27. data/lib/allq_client/models/basic_payload.rb +223 -0
  28. data/lib/allq_client/models/basic_response.rb +193 -0
  29. data/lib/allq_client/models/job_ref.rb +194 -0
  30. data/lib/allq_client/models/job_response.rb +253 -0
  31. data/lib/allq_client/models/new_job.rb +274 -0
  32. data/lib/allq_client/models/new_parent_job.rb +306 -0
  33. data/lib/allq_client/models/stats_info.rb +208 -0
  34. data/lib/allq_client/models/stats_results.rb +226 -0
  35. data/lib/allq_client/models/stats_tube.rb +289 -0
  36. data/lib/allq_client/models/throttle.rb +213 -0
  37. data/lib/allq_client/models/tube_ref.rb +194 -0
  38. data/lib/allq_client/version.rb +15 -0
  39. data/spec/api/actions_api_spec.rb +169 -0
  40. data/spec/api/admin_api_spec.rb +58 -0
  41. data/spec/api_client_spec.rb +226 -0
  42. data/spec/configuration_spec.rb +42 -0
  43. data/spec/models/basic_payload_spec.rb +60 -0
  44. data/spec/models/basic_response_spec.rb +42 -0
  45. data/spec/models/job_ref_spec.rb +42 -0
  46. data/spec/models/job_response_spec.rb +66 -0
  47. data/spec/models/new_job_spec.rb +72 -0
  48. data/spec/models/new_parent_job_spec.rb +90 -0
  49. data/spec/models/stats_info_spec.rb +48 -0
  50. data/spec/models/stats_results_spec.rb +54 -0
  51. data/spec/models/stats_tube_spec.rb +78 -0
  52. data/spec/models/throttle_spec.rb +48 -0
  53. data/spec/models/tube_ref_spec.rb +42 -0
  54. data/spec/spec_helper.rb +111 -0
  55. metadata +292 -0
@@ -0,0 +1,213 @@
1
+ =begin
2
+ #AllQ
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Allq
16
+ # Throttle on tube
17
+ class Throttle
18
+ # Name of tube
19
+ attr_accessor :tube
20
+
21
+ # Transactions per second
22
+ attr_accessor :tps
23
+
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'tube' => :'tube',
29
+ :'tps' => :'tps'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'tube' => :'String',
37
+ :'tps' => :'Integer'
38
+ }
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ return unless attributes.is_a?(Hash)
45
+
46
+ # convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
48
+
49
+ if attributes.has_key?(:'tube')
50
+ self.tube = attributes[:'tube']
51
+ else
52
+ self.tube = "default"
53
+ end
54
+
55
+ if attributes.has_key?(:'tps')
56
+ self.tps = attributes[:'tps']
57
+ else
58
+ self.tps = 1000
59
+ end
60
+
61
+ end
62
+
63
+ # Show invalid properties with the reasons. Usually used together with valid?
64
+ # @return Array for valid properties with the reasons
65
+ def list_invalid_properties
66
+ invalid_properties = Array.new
67
+ if @tube.nil?
68
+ invalid_properties.push("invalid value for 'tube', tube cannot be nil.")
69
+ end
70
+
71
+ if @tps.nil?
72
+ invalid_properties.push("invalid value for 'tps', tps cannot be nil.")
73
+ end
74
+
75
+ return invalid_properties
76
+ end
77
+
78
+ # Check to see if the all the properties in the model are valid
79
+ # @return true if the model is valid
80
+ def valid?
81
+ return false if @tube.nil?
82
+ return false if @tps.nil?
83
+ return true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ tube == o.tube &&
92
+ tps == o.tps
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Fixnum] Hash code
103
+ def hash
104
+ [tube, tps].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def build_from_hash(attributes)
111
+ return nil unless attributes.is_a?(Hash)
112
+ self.class.swagger_types.each_pair do |key, type|
113
+ if type =~ /\AArray<(.*)>/i
114
+ # check to ensure the input is an array given that the the attribute
115
+ # is documented as an array but the input is not
116
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
117
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
118
+ end
119
+ elsif !attributes[self.class.attribute_map[key]].nil?
120
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
121
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
122
+ end
123
+
124
+ self
125
+ end
126
+
127
+ # Deserializes the data based on type
128
+ # @param string type Data type
129
+ # @param string value Value to be deserialized
130
+ # @return [Object] Deserialized data
131
+ def _deserialize(type, value)
132
+ case type.to_sym
133
+ when :DateTime
134
+ DateTime.parse(value)
135
+ when :Date
136
+ Date.parse(value)
137
+ when :String
138
+ value.to_s
139
+ when :Integer
140
+ value.to_i
141
+ when :Float
142
+ value.to_f
143
+ when :BOOLEAN
144
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
145
+ true
146
+ else
147
+ false
148
+ end
149
+ when :Object
150
+ # generic object (usually a Hash), return directly
151
+ value
152
+ when /\AArray<(?<inner_type>.+)>\z/
153
+ inner_type = Regexp.last_match[:inner_type]
154
+ value.map { |v| _deserialize(inner_type, v) }
155
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
156
+ k_type = Regexp.last_match[:k_type]
157
+ v_type = Regexp.last_match[:v_type]
158
+ {}.tap do |hash|
159
+ value.each do |k, v|
160
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
161
+ end
162
+ end
163
+ else # model
164
+ temp_model = Allq.const_get(type).new
165
+ temp_model.build_from_hash(value)
166
+ end
167
+ end
168
+
169
+ # Returns the string representation of the object
170
+ # @return [String] String presentation of the object
171
+ def to_s
172
+ to_hash.to_s
173
+ end
174
+
175
+ # to_body is an alias to to_hash (backward compatibility)
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_body
178
+ to_hash
179
+ end
180
+
181
+ # Returns the object in the form of hash
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_hash
184
+ hash = {}
185
+ self.class.attribute_map.each_pair do |attr, param|
186
+ value = self.send(attr)
187
+ next if value.nil?
188
+ hash[param] = _to_hash(value)
189
+ end
190
+ hash
191
+ end
192
+
193
+ # Outputs non-array value in the form of hash
194
+ # For object, use to_hash. Otherwise, just return the value
195
+ # @param [Object] value Any valid value
196
+ # @return [Hash] Returns the value in the form of hash
197
+ def _to_hash(value)
198
+ if value.is_a?(Array)
199
+ value.compact.map{ |v| _to_hash(v) }
200
+ elsif value.is_a?(Hash)
201
+ {}.tap do |hash|
202
+ value.each { |k, v| hash[k] = _to_hash(v) }
203
+ end
204
+ elsif value.respond_to? :to_hash
205
+ value.to_hash
206
+ else
207
+ value
208
+ end
209
+ end
210
+
211
+ end
212
+
213
+ end
@@ -0,0 +1,194 @@
1
+ =begin
2
+ #AllQ
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Allq
16
+ # Name of tube
17
+ class TubeRef
18
+ # Name of tube
19
+ attr_accessor :tube
20
+
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'tube' => :'tube'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.swagger_types
31
+ {
32
+ :'tube' => :'String'
33
+ }
34
+ end
35
+
36
+ # Initializes the object
37
+ # @param [Hash] attributes Model attributes in the form of hash
38
+ def initialize(attributes = {})
39
+ return unless attributes.is_a?(Hash)
40
+
41
+ # convert string to symbol for hash key
42
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
43
+
44
+ if attributes.has_key?(:'tube')
45
+ self.tube = attributes[:'tube']
46
+ end
47
+
48
+ end
49
+
50
+ # Show invalid properties with the reasons. Usually used together with valid?
51
+ # @return Array for valid properties with the reasons
52
+ def list_invalid_properties
53
+ invalid_properties = Array.new
54
+ if @tube.nil?
55
+ invalid_properties.push("invalid value for 'tube', tube cannot be nil.")
56
+ end
57
+
58
+ return invalid_properties
59
+ end
60
+
61
+ # Check to see if the all the properties in the model are valid
62
+ # @return true if the model is valid
63
+ def valid?
64
+ return false if @tube.nil?
65
+ return true
66
+ end
67
+
68
+ # Checks equality by comparing each attribute.
69
+ # @param [Object] Object to be compared
70
+ def ==(o)
71
+ return true if self.equal?(o)
72
+ self.class == o.class &&
73
+ tube == o.tube
74
+ end
75
+
76
+ # @see the `==` method
77
+ # @param [Object] Object to be compared
78
+ def eql?(o)
79
+ self == o
80
+ end
81
+
82
+ # Calculates hash code according to all attributes.
83
+ # @return [Fixnum] Hash code
84
+ def hash
85
+ [tube].hash
86
+ end
87
+
88
+ # Builds the object from hash
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ # @return [Object] Returns the model itself
91
+ def build_from_hash(attributes)
92
+ return nil unless attributes.is_a?(Hash)
93
+ self.class.swagger_types.each_pair do |key, type|
94
+ if type =~ /\AArray<(.*)>/i
95
+ # check to ensure the input is an array given that the the attribute
96
+ # is documented as an array but the input is not
97
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
98
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
99
+ end
100
+ elsif !attributes[self.class.attribute_map[key]].nil?
101
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
102
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
103
+ end
104
+
105
+ self
106
+ end
107
+
108
+ # Deserializes the data based on type
109
+ # @param string type Data type
110
+ # @param string value Value to be deserialized
111
+ # @return [Object] Deserialized data
112
+ def _deserialize(type, value)
113
+ case type.to_sym
114
+ when :DateTime
115
+ DateTime.parse(value)
116
+ when :Date
117
+ Date.parse(value)
118
+ when :String
119
+ value.to_s
120
+ when :Integer
121
+ value.to_i
122
+ when :Float
123
+ value.to_f
124
+ when :BOOLEAN
125
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
126
+ true
127
+ else
128
+ false
129
+ end
130
+ when :Object
131
+ # generic object (usually a Hash), return directly
132
+ value
133
+ when /\AArray<(?<inner_type>.+)>\z/
134
+ inner_type = Regexp.last_match[:inner_type]
135
+ value.map { |v| _deserialize(inner_type, v) }
136
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
137
+ k_type = Regexp.last_match[:k_type]
138
+ v_type = Regexp.last_match[:v_type]
139
+ {}.tap do |hash|
140
+ value.each do |k, v|
141
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
142
+ end
143
+ end
144
+ else # model
145
+ temp_model = Allq.const_get(type).new
146
+ temp_model.build_from_hash(value)
147
+ end
148
+ end
149
+
150
+ # Returns the string representation of the object
151
+ # @return [String] String presentation of the object
152
+ def to_s
153
+ to_hash.to_s
154
+ end
155
+
156
+ # to_body is an alias to to_hash (backward compatibility)
157
+ # @return [Hash] Returns the object in the form of hash
158
+ def to_body
159
+ to_hash
160
+ end
161
+
162
+ # Returns the object in the form of hash
163
+ # @return [Hash] Returns the object in the form of hash
164
+ def to_hash
165
+ hash = {}
166
+ self.class.attribute_map.each_pair do |attr, param|
167
+ value = self.send(attr)
168
+ next if value.nil?
169
+ hash[param] = _to_hash(value)
170
+ end
171
+ hash
172
+ end
173
+
174
+ # Outputs non-array value in the form of hash
175
+ # For object, use to_hash. Otherwise, just return the value
176
+ # @param [Object] value Any valid value
177
+ # @return [Hash] Returns the value in the form of hash
178
+ def _to_hash(value)
179
+ if value.is_a?(Array)
180
+ value.compact.map{ |v| _to_hash(v) }
181
+ elsif value.is_a?(Hash)
182
+ {}.tap do |hash|
183
+ value.each { |k, v| hash[k] = _to_hash(v) }
184
+ end
185
+ elsif value.respond_to? :to_hash
186
+ value.to_hash
187
+ else
188
+ value
189
+ end
190
+ end
191
+
192
+ end
193
+
194
+ end
@@ -0,0 +1,15 @@
1
+ =begin
2
+ #AllQ
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ module Allq
14
+ VERSION = "1.0.0"
15
+ end
@@ -0,0 +1,169 @@
1
+ =begin
2
+ #AllQ
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for Allq::ActionsApi
17
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
+ # Please update as you see appropriate
19
+ describe 'ActionsApi' do
20
+ before do
21
+ # run before each test
22
+ @instance = Allq::ActionsApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of ActionsApi' do
30
+ it 'should create an instance of ActionsApi' do
31
+ expect(@instance).to be_instance_of(Allq::ActionsApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for bury_put
36
+ # Bury
37
+ # Bury Job
38
+ # @param job_id Job ID
39
+ # @param [Hash] opts the optional parameters
40
+ # @return [BasicResponse]
41
+ describe 'bury_put test' do
42
+ it "should work" do
43
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ end
45
+ end
46
+
47
+ # unit tests for job_delete
48
+ # Delete
49
+ # Finished Job
50
+ # @param job_id Job ID
51
+ # @param [Hash] opts the optional parameters
52
+ # @option opts [String] :tube Name of Tube (For deleting \&quot;ready\&quot; objects)
53
+ # @return [BasicResponse]
54
+ describe 'job_delete test' do
55
+ it "should work" do
56
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
57
+ end
58
+ end
59
+
60
+ # unit tests for job_get
61
+ # Job
62
+ # Get job from queue
63
+ # @param tube Name of tube
64
+ # @param [Hash] opts the optional parameters
65
+ # @return [JobResponse]
66
+ describe 'job_get test' do
67
+ it "should work" do
68
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
69
+ end
70
+ end
71
+
72
+ # unit tests for job_post
73
+ # Job
74
+ # Put job into queue
75
+ # @param new_job New Job Object
76
+ # @param [Hash] opts the optional parameters
77
+ # @return [JobRef]
78
+ describe 'job_post test' do
79
+ it "should work" do
80
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
81
+ end
82
+ end
83
+
84
+ # unit tests for parent_job_post
85
+ # Parent Job
86
+ # Create a parent job
87
+ # @param new_parent_job New Parent Job Data
88
+ # @param [Hash] opts the optional parameters
89
+ # @return [JobRef]
90
+ describe 'parent_job_post test' do
91
+ it "should work" do
92
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
93
+ end
94
+ end
95
+
96
+ # unit tests for peek_get
97
+ # Peek
98
+ # Peek at next job
99
+ # @param tube Tube name
100
+ # @param [Hash] opts the optional parameters
101
+ # @option opts [String] :buried Look in buried
102
+ # @return [JobResponse]
103
+ describe 'peek_get test' do
104
+ it "should work" do
105
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
106
+ end
107
+ end
108
+
109
+ # unit tests for release_put
110
+ # Release
111
+ # Releases job back into queue
112
+ # @param job_id Job ID
113
+ # @param [Hash] opts the optional parameters
114
+ # @return [BasicResponse]
115
+ describe 'release_put test' do
116
+ it "should work" do
117
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
118
+ end
119
+ end
120
+
121
+ # unit tests for set_children_started_put
122
+ # Set Children Started
123
+ # When a parent job doesn&#39;t know how many children are going to be added, this is the event that sets the final children count on the parent_job, allowing it to run when the children are done.
124
+ # @param job_id Job ID
125
+ # @param [Hash] opts the optional parameters
126
+ # @return [BasicResponse]
127
+ describe 'set_children_started_put test' do
128
+ it "should work" do
129
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
130
+ end
131
+ end
132
+
133
+ # unit tests for throttle_post
134
+ # Throttle
135
+ # Creates a throttle on a tube
136
+ # @param throttle Throttle info
137
+ # @param [Hash] opts the optional parameters
138
+ # @return [TubeRef]
139
+ describe 'throttle_post test' do
140
+ it "should work" do
141
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
142
+ end
143
+ end
144
+
145
+ # unit tests for touch_put
146
+ # Touch
147
+ # Touch job
148
+ # @param job_id Job ID
149
+ # @param [Hash] opts the optional parameters
150
+ # @return [BasicResponse]
151
+ describe 'touch_put test' do
152
+ it "should work" do
153
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
154
+ end
155
+ end
156
+
157
+ # unit tests for tube_delete
158
+ # Clear Tube
159
+ # Delete all contents of tube
160
+ # @param tube Tube Name
161
+ # @param [Hash] opts the optional parameters
162
+ # @return [BasicResponse]
163
+ describe 'tube_delete test' do
164
+ it "should work" do
165
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
166
+ end
167
+ end
168
+
169
+ end