dkron-ruby 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/DEVELOP.md +596 -0
  3. data/Gemfile +7 -0
  4. data/Gemfile.lock +69 -0
  5. data/README.md +99 -0
  6. data/Rakefile +8 -0
  7. data/dkron-ruby.gemspec +45 -0
  8. data/docs/DefaultApi.md +131 -0
  9. data/docs/Execution.md +13 -0
  10. data/docs/ExecutionsApi.md +55 -0
  11. data/docs/Job.md +28 -0
  12. data/docs/JobsApi.md +295 -0
  13. data/docs/Member.md +18 -0
  14. data/docs/MembersApi.md +49 -0
  15. data/docs/Processors.md +7 -0
  16. data/docs/Status.md +10 -0
  17. data/git_push.sh +55 -0
  18. data/lib/dkron-ruby.rb +48 -0
  19. data/lib/dkron-ruby/api/default_api.rb +161 -0
  20. data/lib/dkron-ruby/api/executions_api.rb +75 -0
  21. data/lib/dkron-ruby/api/jobs_api.rb +335 -0
  22. data/lib/dkron-ruby/api/members_api.rb +69 -0
  23. data/lib/dkron-ruby/api_client.rb +390 -0
  24. data/lib/dkron-ruby/api_error.rb +38 -0
  25. data/lib/dkron-ruby/configuration.rb +202 -0
  26. data/lib/dkron-ruby/models/execution.rb +236 -0
  27. data/lib/dkron-ruby/models/job.rb +403 -0
  28. data/lib/dkron-ruby/models/member.rb +288 -0
  29. data/lib/dkron-ruby/models/processors.rb +176 -0
  30. data/lib/dkron-ruby/models/status.rb +206 -0
  31. data/lib/dkron-ruby/version.rb +15 -0
  32. data/spec/api/default_api_spec.rb +65 -0
  33. data/spec/api/executions_api_spec.rb +46 -0
  34. data/spec/api/jobs_api_spec.rb +102 -0
  35. data/spec/api/members_api_spec.rb +45 -0
  36. data/spec/api_client_spec.rb +243 -0
  37. data/spec/configuration_spec.rb +42 -0
  38. data/spec/models/execution_spec.rb +71 -0
  39. data/spec/models/job_spec.rb +161 -0
  40. data/spec/models/member_spec.rb +101 -0
  41. data/spec/models/processors_spec.rb +35 -0
  42. data/spec/models/status_spec.rb +53 -0
  43. data/spec/spec_helper.rb +111 -0
  44. metadata +283 -0
@@ -0,0 +1,176 @@
1
+ =begin
2
+ #Dkron REST API
3
+
4
+ #You can communicate with Dkron using a RESTful JSON API over HTTP. Dkron nodes usually listen on port `8080` for API requests. All examples in this section assume that you've found a running leader at `localhost:8080`. Dkron implements a RESTful JSON API over HTTP to communicate with software clients. Dkron listens in port `8080` by default. All examples in this section assume that you're using the default port. Default API responses are unformatted JSON add the `pretty=true` param to format the response.
5
+
6
+ OpenAPI spec version: 2.2
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.13
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Dkron
16
+ # Processor plugins used to process executions results of this job
17
+ class Processors
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ }
22
+ end
23
+
24
+ # Attribute type mapping.
25
+ def self.swagger_types
26
+ {
27
+ }
28
+ end
29
+
30
+ # Initializes the object
31
+ # @param [Hash] attributes Model attributes in the form of hash
32
+ def initialize(attributes = {})
33
+ return unless attributes.is_a?(Hash)
34
+
35
+ # convert string to symbol for hash key
36
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
37
+ end
38
+
39
+ # Show invalid properties with the reasons. Usually used together with valid?
40
+ # @return Array for valid properties with the reasons
41
+ def list_invalid_properties
42
+ invalid_properties = Array.new
43
+ invalid_properties
44
+ end
45
+
46
+ # Check to see if the all the properties in the model are valid
47
+ # @return true if the model is valid
48
+ def valid?
49
+ true
50
+ end
51
+
52
+ # Checks equality by comparing each attribute.
53
+ # @param [Object] Object to be compared
54
+ def ==(o)
55
+ return true if self.equal?(o)
56
+ self.class == o.class
57
+ end
58
+
59
+ # @see the `==` method
60
+ # @param [Object] Object to be compared
61
+ def eql?(o)
62
+ self == o
63
+ end
64
+
65
+ # Calculates hash code according to all attributes.
66
+ # @return [Fixnum] Hash code
67
+ def hash
68
+ [].hash
69
+ end
70
+
71
+ # Builds the object from hash
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ # @return [Object] Returns the model itself
74
+ def build_from_hash(attributes)
75
+ return nil unless attributes.is_a?(Hash)
76
+ self.class.swagger_types.each_pair do |key, type|
77
+ if type =~ /\AArray<(.*)>/i
78
+ # check to ensure the input is an array given that the attribute
79
+ # is documented as an array but the input is not
80
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
81
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
82
+ end
83
+ elsif !attributes[self.class.attribute_map[key]].nil?
84
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
85
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
86
+ end
87
+
88
+ self
89
+ end
90
+
91
+ # Deserializes the data based on type
92
+ # @param string type Data type
93
+ # @param string value Value to be deserialized
94
+ # @return [Object] Deserialized data
95
+ def _deserialize(type, value)
96
+ case type.to_sym
97
+ when :DateTime
98
+ DateTime.parse(value)
99
+ when :Date
100
+ Date.parse(value)
101
+ when :String
102
+ value.to_s
103
+ when :Integer
104
+ value.to_i
105
+ when :Float
106
+ value.to_f
107
+ when :BOOLEAN
108
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
109
+ true
110
+ else
111
+ false
112
+ end
113
+ when :Object
114
+ # generic object (usually a Hash), return directly
115
+ value
116
+ when /\AArray<(?<inner_type>.+)>\z/
117
+ inner_type = Regexp.last_match[:inner_type]
118
+ value.map { |v| _deserialize(inner_type, v) }
119
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
120
+ k_type = Regexp.last_match[:k_type]
121
+ v_type = Regexp.last_match[:v_type]
122
+ {}.tap do |hash|
123
+ value.each do |k, v|
124
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
125
+ end
126
+ end
127
+ else # model
128
+ temp_model = Dkron.const_get(type).new
129
+ temp_model.build_from_hash(value)
130
+ end
131
+ end
132
+
133
+ # Returns the string representation of the object
134
+ # @return [String] String presentation of the object
135
+ def to_s
136
+ to_hash.to_s
137
+ end
138
+
139
+ # to_body is an alias to to_hash (backward compatibility)
140
+ # @return [Hash] Returns the object in the form of hash
141
+ def to_body
142
+ to_hash
143
+ end
144
+
145
+ # Returns the object in the form of hash
146
+ # @return [Hash] Returns the object in the form of hash
147
+ def to_hash
148
+ hash = {}
149
+ self.class.attribute_map.each_pair do |attr, param|
150
+ value = self.send(attr)
151
+ next if value.nil?
152
+ hash[param] = _to_hash(value)
153
+ end
154
+ hash
155
+ end
156
+
157
+ # Outputs non-array value in the form of hash
158
+ # For object, use to_hash. Otherwise, just return the value
159
+ # @param [Object] value Any valid value
160
+ # @return [Hash] Returns the value in the form of hash
161
+ def _to_hash(value)
162
+ if value.is_a?(Array)
163
+ value.compact.map { |v| _to_hash(v) }
164
+ elsif value.is_a?(Hash)
165
+ {}.tap do |hash|
166
+ value.each { |k, v| hash[k] = _to_hash(v) }
167
+ end
168
+ elsif value.respond_to? :to_hash
169
+ value.to_hash
170
+ else
171
+ value
172
+ end
173
+ end
174
+
175
+ end
176
+ end
@@ -0,0 +1,206 @@
1
+ =begin
2
+ #Dkron REST API
3
+
4
+ #You can communicate with Dkron using a RESTful JSON API over HTTP. Dkron nodes usually listen on port `8080` for API requests. All examples in this section assume that you've found a running leader at `localhost:8080`. Dkron implements a RESTful JSON API over HTTP to communicate with software clients. Dkron listens in port `8080` by default. All examples in this section assume that you're using the default port. Default API responses are unformatted JSON add the `pretty=true` param to format the response.
5
+
6
+ OpenAPI spec version: 2.2
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.13
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Dkron
16
+ # Status represents details about the node.
17
+ class Status
18
+ # Node basic details
19
+ attr_accessor :agent
20
+
21
+ # Serf status
22
+ attr_accessor :serf
23
+
24
+ # Tags asociated with this node
25
+ attr_accessor :tags
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'agent' => :'agent',
31
+ :'serf' => :'serf',
32
+ :'tags' => :'tags'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.swagger_types
38
+ {
39
+ :'agent' => :'Object',
40
+ :'serf' => :'Object',
41
+ :'tags' => :'Object'
42
+ }
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ return unless attributes.is_a?(Hash)
49
+
50
+ # convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
52
+
53
+ if attributes.has_key?(:'agent')
54
+ self.agent = attributes[:'agent']
55
+ end
56
+
57
+ if attributes.has_key?(:'serf')
58
+ self.serf = attributes[:'serf']
59
+ end
60
+
61
+ if attributes.has_key?(:'tags')
62
+ self.tags = attributes[:'tags']
63
+ end
64
+ end
65
+
66
+ # Show invalid properties with the reasons. Usually used together with valid?
67
+ # @return Array for valid properties with the reasons
68
+ def list_invalid_properties
69
+ invalid_properties = Array.new
70
+ invalid_properties
71
+ end
72
+
73
+ # Check to see if the all the properties in the model are valid
74
+ # @return true if the model is valid
75
+ def valid?
76
+ true
77
+ end
78
+
79
+ # Checks equality by comparing each attribute.
80
+ # @param [Object] Object to be compared
81
+ def ==(o)
82
+ return true if self.equal?(o)
83
+ self.class == o.class &&
84
+ agent == o.agent &&
85
+ serf == o.serf &&
86
+ tags == o.tags
87
+ end
88
+
89
+ # @see the `==` method
90
+ # @param [Object] Object to be compared
91
+ def eql?(o)
92
+ self == o
93
+ end
94
+
95
+ # Calculates hash code according to all attributes.
96
+ # @return [Fixnum] Hash code
97
+ def hash
98
+ [agent, serf, tags].hash
99
+ end
100
+
101
+ # Builds the object from hash
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ # @return [Object] Returns the model itself
104
+ def build_from_hash(attributes)
105
+ return nil unless attributes.is_a?(Hash)
106
+ self.class.swagger_types.each_pair do |key, type|
107
+ if type =~ /\AArray<(.*)>/i
108
+ # check to ensure the input is an array given that the attribute
109
+ # is documented as an array but the input is not
110
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
111
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
112
+ end
113
+ elsif !attributes[self.class.attribute_map[key]].nil?
114
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
115
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
116
+ end
117
+
118
+ self
119
+ end
120
+
121
+ # Deserializes the data based on type
122
+ # @param string type Data type
123
+ # @param string value Value to be deserialized
124
+ # @return [Object] Deserialized data
125
+ def _deserialize(type, value)
126
+ case type.to_sym
127
+ when :DateTime
128
+ DateTime.parse(value)
129
+ when :Date
130
+ Date.parse(value)
131
+ when :String
132
+ value.to_s
133
+ when :Integer
134
+ value.to_i
135
+ when :Float
136
+ value.to_f
137
+ when :BOOLEAN
138
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
139
+ true
140
+ else
141
+ false
142
+ end
143
+ when :Object
144
+ # generic object (usually a Hash), return directly
145
+ value
146
+ when /\AArray<(?<inner_type>.+)>\z/
147
+ inner_type = Regexp.last_match[:inner_type]
148
+ value.map { |v| _deserialize(inner_type, v) }
149
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
150
+ k_type = Regexp.last_match[:k_type]
151
+ v_type = Regexp.last_match[:v_type]
152
+ {}.tap do |hash|
153
+ value.each do |k, v|
154
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
155
+ end
156
+ end
157
+ else # model
158
+ temp_model = Dkron.const_get(type).new
159
+ temp_model.build_from_hash(value)
160
+ end
161
+ end
162
+
163
+ # Returns the string representation of the object
164
+ # @return [String] String presentation of the object
165
+ def to_s
166
+ to_hash.to_s
167
+ end
168
+
169
+ # to_body is an alias to to_hash (backward compatibility)
170
+ # @return [Hash] Returns the object in the form of hash
171
+ def to_body
172
+ to_hash
173
+ end
174
+
175
+ # Returns the object in the form of hash
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_hash
178
+ hash = {}
179
+ self.class.attribute_map.each_pair do |attr, param|
180
+ value = self.send(attr)
181
+ next if value.nil?
182
+ hash[param] = _to_hash(value)
183
+ end
184
+ hash
185
+ end
186
+
187
+ # Outputs non-array value in the form of hash
188
+ # For object, use to_hash. Otherwise, just return the value
189
+ # @param [Object] value Any valid value
190
+ # @return [Hash] Returns the value in the form of hash
191
+ def _to_hash(value)
192
+ if value.is_a?(Array)
193
+ value.compact.map { |v| _to_hash(v) }
194
+ elsif value.is_a?(Hash)
195
+ {}.tap do |hash|
196
+ value.each { |k, v| hash[k] = _to_hash(v) }
197
+ end
198
+ elsif value.respond_to? :to_hash
199
+ value.to_hash
200
+ else
201
+ value
202
+ end
203
+ end
204
+
205
+ end
206
+ end
@@ -0,0 +1,15 @@
1
+ =begin
2
+ #Dkron REST API
3
+
4
+ #You can communicate with Dkron using a RESTful JSON API over HTTP. Dkron nodes usually listen on port `8080` for API requests. All examples in this section assume that you've found a running leader at `localhost:8080`. Dkron implements a RESTful JSON API over HTTP to communicate with software clients. Dkron listens in port `8080` by default. All examples in this section assume that you're using the default port. Default API responses are unformatted JSON add the `pretty=true` param to format the response.
5
+
6
+ OpenAPI spec version: 2.2
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.13
10
+
11
+ =end
12
+
13
+ module Dkron
14
+ VERSION = '1.0.0'
15
+ end
@@ -0,0 +1,65 @@
1
+ =begin
2
+ #Dkron REST API
3
+
4
+ #You can communicate with Dkron using a RESTful JSON API over HTTP. Dkron nodes usually listen on port `8080` for API requests. All examples in this section assume that you've found a running leader at `localhost:8080`. Dkron implements a RESTful JSON API over HTTP to communicate with software clients. Dkron listens in port `8080` by default. All examples in this section assume that you're using the default port. Default API responses are unformatted JSON add the `pretty=true` param to format the response.
5
+
6
+ OpenAPI spec version: 2.2
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.13
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for Dkron::DefaultApi
17
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
+ # Please update as you see appropriate
19
+ describe 'DefaultApi' do
20
+ before do
21
+ # run before each test
22
+ @instance = Dkron::DefaultApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of DefaultApi' do
30
+ it 'should create an instance of DefaultApi' do
31
+ expect(@instance).to be_instance_of(Dkron::DefaultApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for get_leader
36
+ # List leader of cluster.
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Member]
39
+ describe 'get_leader test' do
40
+ it 'should work' do
41
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
42
+ end
43
+ end
44
+
45
+ # unit tests for leave
46
+ # Force the node to leave the cluster.
47
+ # @param [Hash] opts the optional parameters
48
+ # @return [Array<Member>]
49
+ describe 'leave test' do
50
+ it 'should work' do
51
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
52
+ end
53
+ end
54
+
55
+ # unit tests for status
56
+ # Gets &#x60;Status&#x60; object.
57
+ # @param [Hash] opts the optional parameters
58
+ # @return [Status]
59
+ describe 'status test' do
60
+ it 'should work' do
61
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
62
+ end
63
+ end
64
+
65
+ end