revily 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5e18b3b6189eef1e7f6364aeeb10898c5e6a7101
4
+ data.tar.gz: 2bcedee5ecf27e5826c24a3b7e4287ac8fec1bdf
5
+ SHA512:
6
+ metadata.gz: 899c0e955fbe7524725e4057def7b602dbf4b1dcb3f89ad6f52800e0e13d13d142f2801e7503c2c9edb1896d5be1db990b7da6bd08c021e1a2fb148e0b2152b9
7
+ data.tar.gz: 2e5cad9a7a6625cc3a87dc5aeaa75dc4ec02956ad192577038a9d15989201983de05fab54de6bbee52ce7d74e02730ef0159ef25e74688ef4d464534552f9f1a
@@ -3,3 +3,7 @@
3
3
  3. Commit your changes (`git commit -am 'Add some feature'`)
4
4
  4. Push to the branch (`git push origin my-new-feature`)
5
5
  5. Create new Pull Request
6
+
7
+ ## Getting Started
8
+
9
+ To get started, execute ./script/bootstrap to run Bundler and setup other necessary components to the development of this library.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Revily
1
+ # Revily::CLI
2
2
 
3
3
  TODO: Write a gem description
4
4
 
@@ -18,4 +18,4 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- incidents
21
+ TODO: Write usage instructions here
@@ -0,0 +1,7 @@
1
+ require "revily/cli/version"
2
+
3
+ module Revily
4
+ module CLI
5
+ # Your code goes here...
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ module Revily
2
+ module Command
3
+ autoload :Base, 'revily/command/base'
4
+ autoload :Service, 'revily/command/service'
5
+
6
+ def self.run(*args)
7
+ Base.run(*args)
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,33 @@
1
+ require 'clamp'
2
+ require 'cabin'
3
+
4
+ module Revily
5
+ module Command
6
+ class Base < Clamp::Command
7
+
8
+ attr_accessor :logger
9
+
10
+ def initialize(*args)
11
+ @logger = Cabin::Channel.get
12
+ @logger.subscribe(STDOUT)
13
+
14
+ super(*args)
15
+ end
16
+
17
+ option [ '-v', '--version' ], :flag, 'print version and exit' do
18
+ puts Revily::VERSION
19
+ exit 0
20
+ end
21
+
22
+ option [ '-l', '--log-level' ], 'LOG_LEVEL', 'log level', default: 'warn' do |log_level|
23
+ @logger.level = log_level
24
+ end
25
+
26
+ def execute
27
+ end
28
+
29
+ subcommand 'service', 'service commands', Revily::Command::Service
30
+ end
31
+ end
32
+
33
+ end
@@ -0,0 +1,18 @@
1
+ module Revily
2
+ module Command
3
+ class Service < Base
4
+
5
+ self.default_subcommand = 'list'
6
+
7
+ # def ex
8
+ subcommand 'list', 'list all services' do
9
+ def execute
10
+ super
11
+ puts self.inspect
12
+ logger.info "listing services"
13
+ end
14
+ end
15
+
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,5 @@
1
+ module Revily
2
+ module CLI
3
+ VERSION = "0.0.2"
4
+ end
5
+ end
@@ -1,30 +1,35 @@
1
- require 'rspec'
2
- require 'webmock/rspec'
3
-
4
- RSpec.configure do |config|
5
- config.mock_with :rspec
6
- config.use_transactional_fixtures = false
7
- config.infer_base_class_for_anonymous_controllers = false
8
- config.treat_symbols_as_metadata_keys_with_true_values = true
9
- config.order = "random"
10
- config.run_all_when_everything_filtered = true
11
- config.filter_run focus: true
12
- config.filter_run_excluding external: true
1
+ unless ENV['CI']
2
+ require 'spork'
13
3
  end
14
4
 
15
- def fixture_path
16
- File.expand_path("../support/fixtures", __FILE__)
5
+ def configure
6
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
7
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
8
+ require 'revily/cli'
9
+
10
+ require 'rspec'
11
+ require 'webmock/rspec'
12
+
13
+ RSpec.configure do |config|
14
+ config.mock_with :rspec
15
+ config.use_transactional_fixtures = false
16
+ config.infer_base_class_for_anonymous_controllers = false
17
+ config.treat_symbols_as_metadata_keys_with_true_values = true
18
+ config.order = 'random'
19
+ config.run_all_when_everything_filtered = true
20
+ config.filter_run focus: true
21
+ config.filter_run_excluding external: true
22
+ end
17
23
  end
18
24
 
19
- def fixture
20
- File.new(fixture_path + '/' + file)
25
+ def run
26
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
21
27
  end
22
28
 
23
- def json_response(file)
24
- {
25
- body: fixture(file),
26
- headers: {
27
- content_type: 'application/json; charset=utf-8'
28
- }
29
- }
30
- end
29
+ if defined?(Spork)
30
+ Spork.prefork { configure }
31
+ Spork.each_run { run }
32
+ else
33
+ configure
34
+ run
35
+ end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: revily
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Dan Ryan
@@ -11,106 +10,37 @@ bindir: bin
11
10
  cert_chain: []
12
11
  date: 2013-07-28 00:00:00.000000000 Z
13
12
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: cabin
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: '0.6'
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ~>
28
- - !ruby/object:Gem::Version
29
- version: '0.6'
30
13
  - !ruby/object:Gem::Dependency
31
14
  name: clamp
32
15
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ~>
36
- - !ruby/object:Gem::Version
37
- version: '0.6'
38
- type: :runtime
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ~>
44
- - !ruby/object:Gem::Version
45
- version: '0.6'
46
- - !ruby/object:Gem::Dependency
47
- name: faraday
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ~>
52
- - !ruby/object:Gem::Version
53
- version: '0.8'
54
- type: :runtime
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ~>
60
- - !ruby/object:Gem::Version
61
- version: '0.8'
62
- - !ruby/object:Gem::Dependency
63
- name: faraday_middleware
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ~>
68
- - !ruby/object:Gem::Version
69
- version: '0.9'
70
- type: :runtime
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ~>
76
- - !ruby/object:Gem::Version
77
- version: '0.9'
78
- - !ruby/object:Gem::Dependency
79
- name: hashie
80
- requirement: !ruby/object:Gem::Requirement
81
- none: false
82
16
  requirements:
83
- - - ~>
17
+ - - '>='
84
18
  - !ruby/object:Gem::Version
85
- version: '2.0'
19
+ version: '0'
86
20
  type: :runtime
87
21
  prerelease: false
88
22
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
23
  requirements:
91
- - - ~>
24
+ - - '>='
92
25
  - !ruby/object:Gem::Version
93
- version: '2.0'
26
+ version: '0'
94
27
  - !ruby/object:Gem::Dependency
95
- name: multi_json
28
+ name: revily-client
96
29
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
30
  requirements:
99
- - - ~>
31
+ - - '>='
100
32
  - !ruby/object:Gem::Version
101
- version: '1.7'
33
+ version: '0'
102
34
  type: :runtime
103
35
  prerelease: false
104
36
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
37
  requirements:
107
- - - ~>
38
+ - - '>='
108
39
  - !ruby/object:Gem::Version
109
- version: '1.7'
40
+ version: '0'
110
41
  - !ruby/object:Gem::Dependency
111
42
  name: bundler
112
43
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
44
  requirements:
115
45
  - - ~>
116
46
  - !ruby/object:Gem::Version
@@ -118,7 +48,6 @@ dependencies:
118
48
  type: :development
119
49
  prerelease: false
120
50
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
51
  requirements:
123
52
  - - ~>
124
53
  - !ruby/object:Gem::Version
@@ -126,219 +55,183 @@ dependencies:
126
55
  - !ruby/object:Gem::Dependency
127
56
  name: guard-rspec
128
57
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
58
  requirements:
131
- - - ! '>='
59
+ - - '>='
132
60
  - !ruby/object:Gem::Version
133
61
  version: 3.0.2
134
62
  type: :development
135
63
  prerelease: false
136
64
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
65
  requirements:
139
- - - ! '>='
66
+ - - '>='
140
67
  - !ruby/object:Gem::Version
141
68
  version: 3.0.2
142
69
  - !ruby/object:Gem::Dependency
143
70
  name: guard-spork
144
71
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
72
  requirements:
147
- - - ! '>='
73
+ - - '>='
148
74
  - !ruby/object:Gem::Version
149
75
  version: '0'
150
76
  type: :development
151
77
  prerelease: false
152
78
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
79
  requirements:
155
- - - ! '>='
80
+ - - '>='
156
81
  - !ruby/object:Gem::Version
157
82
  version: '0'
158
83
  - !ruby/object:Gem::Dependency
159
84
  name: libnotify
160
85
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
86
  requirements:
163
- - - ! '>='
87
+ - - '>='
164
88
  - !ruby/object:Gem::Version
165
89
  version: '0'
166
90
  type: :development
167
91
  prerelease: false
168
92
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
93
  requirements:
171
- - - ! '>='
94
+ - - '>='
172
95
  - !ruby/object:Gem::Version
173
96
  version: '0'
174
97
  - !ruby/object:Gem::Dependency
175
98
  name: pry
176
99
  requirement: !ruby/object:Gem::Requirement
177
- none: false
178
100
  requirements:
179
- - - ! '>='
101
+ - - '>='
180
102
  - !ruby/object:Gem::Version
181
103
  version: '0'
182
104
  type: :development
183
105
  prerelease: false
184
106
  version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
107
  requirements:
187
- - - ! '>='
108
+ - - '>='
188
109
  - !ruby/object:Gem::Version
189
110
  version: '0'
190
111
  - !ruby/object:Gem::Dependency
191
112
  name: rake
192
113
  requirement: !ruby/object:Gem::Requirement
193
- none: false
194
114
  requirements:
195
- - - ! '>='
115
+ - - '>='
196
116
  - !ruby/object:Gem::Version
197
117
  version: '0'
198
118
  type: :development
199
119
  prerelease: false
200
120
  version_requirements: !ruby/object:Gem::Requirement
201
- none: false
202
121
  requirements:
203
- - - ! '>='
122
+ - - '>='
204
123
  - !ruby/object:Gem::Version
205
124
  version: '0'
206
125
  - !ruby/object:Gem::Dependency
207
126
  name: rb-fsevent
208
127
  requirement: !ruby/object:Gem::Requirement
209
- none: false
210
128
  requirements:
211
- - - ! '>='
129
+ - - '>='
212
130
  - !ruby/object:Gem::Version
213
131
  version: '0'
214
132
  type: :development
215
133
  prerelease: false
216
134
  version_requirements: !ruby/object:Gem::Requirement
217
- none: false
218
135
  requirements:
219
- - - ! '>='
136
+ - - '>='
220
137
  - !ruby/object:Gem::Version
221
138
  version: '0'
222
139
  - !ruby/object:Gem::Dependency
223
140
  name: rb-inotify
224
141
  requirement: !ruby/object:Gem::Requirement
225
- none: false
226
142
  requirements:
227
- - - ! '>='
143
+ - - '>='
228
144
  - !ruby/object:Gem::Version
229
145
  version: '0'
230
146
  type: :development
231
147
  prerelease: false
232
148
  version_requirements: !ruby/object:Gem::Requirement
233
- none: false
234
149
  requirements:
235
- - - ! '>='
150
+ - - '>='
236
151
  - !ruby/object:Gem::Version
237
152
  version: '0'
238
153
  - !ruby/object:Gem::Dependency
239
154
  name: rspec
240
155
  requirement: !ruby/object:Gem::Requirement
241
- none: false
242
156
  requirements:
243
- - - ! '>='
157
+ - - '>='
244
158
  - !ruby/object:Gem::Version
245
159
  version: 2.13.0
246
160
  type: :development
247
161
  prerelease: false
248
162
  version_requirements: !ruby/object:Gem::Requirement
249
- none: false
250
163
  requirements:
251
- - - ! '>='
164
+ - - '>='
252
165
  - !ruby/object:Gem::Version
253
166
  version: 2.13.0
254
167
  - !ruby/object:Gem::Dependency
255
168
  name: ruby_gntp
256
169
  requirement: !ruby/object:Gem::Requirement
257
- none: false
258
170
  requirements:
259
- - - ! '>='
171
+ - - '>='
260
172
  - !ruby/object:Gem::Version
261
173
  version: '0'
262
174
  type: :development
263
175
  prerelease: false
264
176
  version_requirements: !ruby/object:Gem::Requirement
265
- none: false
266
177
  requirements:
267
- - - ! '>='
178
+ - - '>='
268
179
  - !ruby/object:Gem::Version
269
180
  version: '0'
270
181
  - !ruby/object:Gem::Dependency
271
182
  name: webmock
272
183
  requirement: !ruby/object:Gem::Requirement
273
- none: false
274
184
  requirements:
275
- - - ! '>='
185
+ - - '>='
276
186
  - !ruby/object:Gem::Version
277
187
  version: 1.13.0
278
188
  type: :development
279
189
  prerelease: false
280
190
  version_requirements: !ruby/object:Gem::Requirement
281
- none: false
282
191
  requirements:
283
- - - ! '>='
192
+ - - '>='
284
193
  - !ruby/object:Gem::Version
285
194
  version: 1.13.0
286
- description: A library for communicating with the revi.ly service or self-hosted Revily
287
- setup.
195
+ description: Revily command-line utility
288
196
  email:
289
197
  - hi@revi.ly
290
198
  executables: []
291
199
  extensions: []
292
200
  extra_rdoc_files: []
293
201
  files:
294
- - CHANGELOG.md
295
202
  - CONTRIBUTING
296
203
  - LICENSE
297
204
  - README.md
298
- - lib/revily/client.rb
299
- - lib/revily/client/config.rb
300
- - lib/revily/client/connection.rb
301
- - lib/revily/client/incidents.rb
302
- - lib/revily/client/integration.rb
303
- - lib/revily/client/policies.rb
304
- - lib/revily/client/policy_rules.rb
305
- - lib/revily/client/request.rb
306
- - lib/revily/client/schedule_layers.rb
307
- - lib/revily/client/schedules.rb
308
- - lib/revily/client/services.rb
309
- - lib/revily/client/users.rb
310
- - lib/revily/client/version.rb
311
- - lib/revily/client/webhooks.rb
312
- - spec/revily/command_spec.rb
313
- - spec/revily_spec.rb
205
+ - lib/revily/cli.rb
206
+ - lib/revily/cli/command.rb
207
+ - lib/revily/cli/command/base.rb
208
+ - lib/revily/cli/command/service.rb
209
+ - lib/revily/cli/version.rb
314
210
  - spec/spec_helper.rb
315
211
  homepage: https://revi.ly
316
212
  licenses:
317
213
  - MIT
214
+ metadata: {}
318
215
  post_install_message:
319
216
  rdoc_options: []
320
217
  require_paths:
321
218
  - lib
322
219
  required_ruby_version: !ruby/object:Gem::Requirement
323
- none: false
324
220
  requirements:
325
- - - ! '>='
221
+ - - '>='
326
222
  - !ruby/object:Gem::Version
327
223
  version: 1.9.3
328
224
  required_rubygems_version: !ruby/object:Gem::Requirement
329
- none: false
330
225
  requirements:
331
- - - ! '>='
226
+ - - '>='
332
227
  - !ruby/object:Gem::Version
333
228
  version: 1.3.6
334
229
  requirements: []
335
230
  rubyforge_project:
336
- rubygems_version: 1.8.23
231
+ rubygems_version: 2.0.3
337
232
  signing_key:
338
- specification_version: 3
339
- summary: A library for communicating with the revi.ly service or self-hosted Revily
340
- setup.
233
+ specification_version: 4
234
+ summary: A command-line application to interact with the revi.ly service or self-hosted
235
+ Revily setup.
341
236
  test_files:
342
- - spec/revily/command_spec.rb
343
- - spec/revily_spec.rb
344
237
  - spec/spec_helper.rb
File without changes
@@ -1,61 +0,0 @@
1
- module Revily
2
- module Client
3
-
4
- end
5
- end
6
- # require 'revily/authentication'
7
- # require 'revily/connection'
8
- # require 'revily/request'
9
-
10
- # require 'revily/clients/incidents'
11
- # require 'revily/clients/policies'
12
- # require 'revily/clients/policy_rules'
13
- # require 'revily/clients/schedule_layers'
14
- # require 'revily/clients/schedules'
15
- # require 'revily/clients/services'
16
- # require 'revily/clients/users'
17
-
18
- # module Revily
19
- # class Client
20
- # attr_accessor(*Config::VALID_OPTIONS_KEYS)
21
-
22
- # def initialize(options={})
23
- # options = Revily.options.merge(options)
24
- # Config::VALID_OPTIONS_KEYS.each do |key|
25
- # send("#{key}=", options[key])
26
- # end
27
- # end
28
-
29
- # include Revily::Authentication
30
- # include Revily::Connection
31
- # include Revily::Request
32
-
33
- # include Revily::Client::Incidents
34
- # include Revily::Client::Integration
35
- # include Revily::Client::Policies
36
- # include Revily::Client::PolicyRules
37
- # include Revily::Client::ScheduleLayers
38
- # include Revily::Client::Schedules
39
- # include Revily::Client::Services
40
- # include Revily::Client::Users
41
- # include Revily::Client::Webhooks
42
- # end
43
- # end
44
-
45
- # extend Config
46
-
47
- # class << self
48
-
49
- # def new(options={})
50
- # Revily::Client.new(options)
51
- # end
52
-
53
- # def method_missing(method, *args, &block)
54
- # return super unless new.respond_to?(method)
55
- # new.send(method, *args, &block)
56
- # end
57
-
58
- # def respond_to?(method, include_private=false)
59
- # new.respond_to?(method, include_private) || super(method, include_private)
60
- # end
61
- # end
@@ -1,52 +0,0 @@
1
- require 'faraday'
2
- require 'revily/version'
3
-
4
- module Revily
5
- module Config
6
- VALID_OPTION_KEYS = [
7
- :adapter,
8
- :api_version,
9
- :api_endpoint,
10
- :auth_token,
11
- :faraday_config_block,
12
- :user_agent
13
- ]
14
-
15
- DEFAULT_ADAPTER = Faraday.default_adapter
16
- DEFAULT_API_VERSION = 1
17
- DEFAULT_API_ENDPOINT = ENV['REVEILLE_API_ENDPOINT'] || 'https://api.revily.io/'
18
- DEFAULT_USER_AGENT = "Revily Ruby Client v#{Revily::VERSION}"
19
-
20
- attr_accessor(*VALID_OPTION_KEYS)
21
-
22
- def self.extended(base)
23
- base.reset
24
- end
25
-
26
- def configure
27
- yield self
28
- end
29
-
30
- def options
31
- VALID_OPTION_KEYS.inject({}) { |opts, key| opts.merge!(key => send(key) }
32
- end
33
-
34
- def api_endpoint=(value)
35
- @api_endpoint = File.join(value, "")
36
- end
37
-
38
- def faraday_config(&block)
39
- @faraday_config_block = block
40
- end
41
-
42
- def reset
43
- self.adapter = DEFAULT_ADAPTER
44
- self.api_version = DEFAULT_API_VERSION
45
- self.api_endpoint = DEFAULT_API_ENDPOINT
46
- self.user_agent = DEFAULT_USER_AGENT
47
- self.auth_token = nil
48
- end
49
-
50
-
51
- end
52
- end
@@ -1,26 +0,0 @@
1
-
2
- module Revily
3
- module Connection
4
- def connection(options={})
5
- options = {
6
- authenticate: true,
7
- raw: false
8
- }.merge(options)
9
-
10
- connection = Faraday.new(options) do |builder|
11
-
12
- builder.use FaradayMiddleware::FollowRedirects
13
- builder.use FaradayMiddleware::Mashify
14
- builder.use FaradayMiddleware::ParseJson, content_type: /\bjson$/
15
-
16
- faraday_config_block.call(builder) if faraday_config_block
17
-
18
- builder.adapter *adapter
19
- end
20
-
21
- connection.headers[:user_agent] = user_agent
22
-
23
- connection
24
- end
25
- end
26
- end
@@ -1,23 +0,0 @@
1
- module Revily
2
- class Client
3
- module Incidents
4
-
5
- def incidents(service_id=nil, options={})
6
- service_id ? get "services/#{service_id}/incidents", options : get "incidents", options
7
- end
8
- alias :list_incidents :incidents
9
-
10
- def incident(id, options={})
11
- get "incidents/#{id}", options
12
- end
13
-
14
- def acknowledge_incident(id, options={})
15
- get "incidents/#{id}/acknowledge", options
16
- end
17
-
18
- def resolve_incident(id, options={})
19
- get "incidents/#{id}/resolve", options
20
- end
21
- end
22
- end
23
- end
@@ -1,27 +0,0 @@
1
- module Revily
2
- class Client
3
- module Integration
4
-
5
- def service_trigger_incident(key, message=nil, description=nil, options={})
6
- incident = {
7
- message: message,
8
- description: description,
9
- key: key
10
- }
11
- put "trigger", options.merge(incident)
12
- end
13
- alias :service_trigger :service_trigger_incident
14
-
15
- def service_acknowledge_incident(key, options={})
16
- put "acknowledge", options.merge(key: key)
17
- end
18
- alias :service_acknowledge :service_acknowledge_incident
19
-
20
- def service_resolve_incident(key, options={})
21
- put "resolve", options.merge(key: key)
22
- end
23
- alias :service_resolve :service_resolve_incident
24
-
25
- end
26
- end
27
- end
@@ -1,28 +0,0 @@
1
- module Revily
2
- class Client
3
- module Policies
4
-
5
- def policies(options={})
6
- get "policies", options
7
- end
8
- alias :list_policies :policies
9
-
10
- def policy(id, options={})
11
- get "policies/#{id}", options
12
- end
13
-
14
- def create_policy(name, loop_limit, options={})
15
- post "policies", options.merge({name: name, loop_limit: loop_limit})
16
- end
17
-
18
- def update_policy(id, options={})
19
- patch "policies/#{id}", options
20
- end
21
-
22
- def delete_policy(id, options={})
23
- delete "policies/#{id}", options
24
- end
25
-
26
- end
27
- end
28
- end
@@ -1,32 +0,0 @@
1
- module Revily
2
- class Client
3
- module PolicyRules
4
- def policy_rules(policy_id, options={})
5
- get "policies/#{policy_id}/rules", options
6
- end
7
- alias :list_policy_rules :policy_rules
8
- alias :list_rules :policy_rules
9
-
10
- def policy_rule(policy_id, id, options={})
11
- get "policies/#{policy_id}/rules/#{id}", options
12
- end
13
- alias :rule :policy_rule
14
-
15
- def create_policy_rule(assignment_id, loop_limit, options={})
16
- post "policies", options.merge({name: name, loop_limit: loop_limit})
17
- end
18
- alias :create_rule :create_policy_rule
19
-
20
- def update_policy_rule(policy_id, id, options={})
21
- patch "policies/#{policy_id}/rules/#{id}", options
22
- end
23
- alias :update_rule :update_policy_rule
24
-
25
- def delete_policy_rule(policy_id, id, options={})
26
- delete "policies/#{policy_id}/rules/#{id}", options
27
- end
28
- alias :delete_rule :delete_policy_rule
29
-
30
- end
31
- end
32
- end
@@ -1,62 +0,0 @@
1
- require 'multi_json'
2
-
3
- module Revily
4
- module Request
5
-
6
- def delete(path, options={})
7
- request(:delete, path, options).body
8
- end
9
-
10
- def get(path, options={})
11
- response = request(:get, path, options)
12
- body = response.body
13
-
14
- body
15
- end
16
-
17
- def patch(path, options={})
18
- request(:patch, path, options).body
19
- end
20
-
21
- def post(path, options={})
22
- request(:post, path, options).body
23
- end
24
-
25
- def put(path, options={})
26
- request(:put, path, options).body
27
- end
28
-
29
- private
30
-
31
- def request(method, path, options={})
32
-
33
- end path = URI.encode path
34
-
35
- token = options.delete(:auth_token) || options.delete(:access_token)
36
-
37
- url = options.delete(:endpoint) || api_endpoint
38
-
39
- conn_options = {
40
- :url => url
41
- }
42
-
43
- response = connection(conn_options).send(method) do |request|
44
- request.headers['Accept'] = options.delete(:accept) || "application/vnd.revily.v#{DEFAULT_API_VERSION}+json"
45
-
46
- request.headers['Authorization'] = "token #{token}" if token
47
-
48
- case method
49
- when :get
50
- request.url(path, options)
51
- when :delete, :head
52
- request.url(path, options)
53
- when :patch, :post, :put
54
- request.path = path
55
- request.body = MultiJson.dump(options) unless options.empty?
56
- end
57
- end
58
-
59
- response
60
- end
61
-
62
- end
@@ -1,7 +0,0 @@
1
- module Revily
2
- class Client
3
- module ScheduleLayers
4
-
5
- end
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- module Revily
2
- class Client
3
- module Schedules
4
-
5
- end
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- module Revily
2
- class Client
3
- module Services
4
-
5
- end
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- module Revily
2
- class Client
3
- module Users
4
-
5
- end
6
- end
7
- end
@@ -1,5 +0,0 @@
1
- module Revily
2
- module Client
3
- VERSION = "0.0.1"
4
- end
5
- end
@@ -1,7 +0,0 @@
1
- module Revily
2
- class Client
3
- module Webhooks
4
-
5
- end
6
- end
7
- end
File without changes
File without changes