cachet_api 1.0.0.pre → 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.
- checksums.yaml +13 -5
- data/.travis.yml +11 -4
- data/README.md +51 -40
- data/Rakefile +2 -7
- data/bin/console.rb +55 -0
- data/cachet_api.gemspec +6 -10
- data/lib/cachet.rb +24 -28
- data/lib/cachet/rb/version.rb +1 -1
- metadata +24 -83
- data/bin/console +0 -7
- data/bin/console_load.rb +0 -40
checksums.yaml
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
|
|
2
|
+
!binary "U0hBMQ==":
|
|
3
|
+
metadata.gz: !binary |-
|
|
4
|
+
MGEwZDNlNDRhMTIzOGEzNTAyNzZiMDg0ODkwOGNjNzhhZWQ2YWU4Ng==
|
|
5
|
+
data.tar.gz: !binary |-
|
|
6
|
+
ZDJiMjlkOTU4MTBlYmYyMDM2MGExNzMyOTg3NGVlNTAyM2YwNDk2Ng==
|
|
5
7
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
|
|
8
|
+
metadata.gz: !binary |-
|
|
9
|
+
NTcxYzVhNTJhYjkzZDcxYWZkNTkxN2NlMzIyMDZjMjY0NDFhYzJiYjkzMWM0
|
|
10
|
+
MDBiYWI0MzRlZWNjNWJkM2NjZjc1YjVhMTA2NDRkMTE2NWZkZTgzNjMzNWI0
|
|
11
|
+
ZWU0MDNiOTFjYzcwODlmNjA0ZWQwZjY2MTM1NmE1YmRkMzI2MmQ=
|
|
12
|
+
data.tar.gz: !binary |-
|
|
13
|
+
NmNlOWU5ZDk0NTU4YjNlYzM4Zjc4NTJlYTFkM2ZlNmNkZDFkOWMwMzVlZTk3
|
|
14
|
+
OWU4N2ZlMTQxZGFiMjFkMGMzMmI2MzcyMjkxNzFmMGI2MTU0MjVkMTVlMzli
|
|
15
|
+
MDRjMDI5MjdlN2MxNGMzOWM1NWU0MWYxYmFiMmM0NzZkNTVjODk=
|
data/.travis.yml
CHANGED
|
@@ -6,8 +6,15 @@ rvm:
|
|
|
6
6
|
- 2.1.8
|
|
7
7
|
- 2.1.2
|
|
8
8
|
script:
|
|
9
|
-
|
|
10
|
-
- bundle exec rake yard
|
|
9
|
+
- bundle exec rake all
|
|
11
10
|
addons:
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
code_climate:
|
|
12
|
+
repo_token: ddaffc1830a7f175bcca559e29619daee62aa145360e2dfbc9dd8e9ac5ce14fb
|
|
13
|
+
deploy:
|
|
14
|
+
provider: rubygems
|
|
15
|
+
api_key:
|
|
16
|
+
secure: ZhHcvZniDq4wF7lz0kRHfu53yXJIIobQtqgpAGO7QP6HW36t0aSBczWwDKdbWRtzsIVNPS/5ixuq99yYFUtCC1ewb2/FMKk+SPMbtvOVMni7PuT/EKak7Qphafcq3r2a2F1zvu7D2+Jpe4PHPk26piLReZcCkCHkF3eVY/ndYAasJ99JP8Othb7YTwcFUVRM4nJvSbFOr1AenzBPEAc7DokZ44qtzPbMvMYIpmOn0/uqtbHcQbUEwx2x25Tb1Ma30nXPsjRskFVzWFTKLerJE5Nho5XM7Vw/ReKflgzSX/KshBPdDCNfJ6DFN+zdaVG8CdAajVbdpYQjC6pezzcLBd32O/LFdS5v0v4JpPdts6XxS2yOHLCKUiMo23ibe7mrKTR3WfhvaNG9Lbi6gPOaD29/bx3S+k6HdWqaHrvEPbMR+GpCKDLYP1LrVO7MWacge47Jl57G/2Ml2XdWWowNfbNRfL/XEaGp5fGRlkiA7BcydGlChHWHvb92Vs6c4Vg0FgRgJALqMQIwiBzjhC53qRi2fw9Hxz4Uyo0A5YlG/vh6gQYjFtRnrYBnfveBY5WV3x6wKHsvUxonMKUrhCZF//6jJkbqu9annkIAWW1Mnw+dqptdgVElXQeyx/PxD06AmjEscO5KYS5L7LoYWxMt4ndI/uXHBDqJUoCmRF2uK20=
|
|
17
|
+
gem: cachet_api
|
|
18
|
+
on:
|
|
19
|
+
tags: true
|
|
20
|
+
repo: TheFynx/cachet_api
|
data/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Cachet API Library Wrapper
|
|
2
|
-
[](https://travis-ci.org/TheFynx/cachet_api) [](https://codeclimate.com/github/TheFynx/cachet_api) [](https://codeclimate.com/github/TheFynx/cachet_api/coverage) [](https://codeclimate.com/github/TheFynx/cachet_api) [](http://inch-ci.org/github/thefynx/cachet_api)
|
|
2
|
+
[](https://travis-ci.org/TheFynx/cachet_api) [](https://codeclimate.com/github/TheFynx/cachet_api) [](https://codeclimate.com/github/TheFynx/cachet_api/coverage) [](https://codeclimate.com/github/TheFynx/cachet_api) [](http://inch-ci.org/github/thefynx/cachet_api) [](https://rubygems.org/gems/cachet_api) [](https://rubygems.org/gems/cachet_api)
|
|
3
3
|
|
|
4
4
|
Ruby library wrapper for [CachetHQ.io](https://cachethq.io)
|
|
5
5
|
|
|
@@ -37,58 +37,69 @@ CachetSubscribers = CachetSubscribers.new(api_key, base_url)
|
|
|
37
37
|
View the last release API documentation at: [https://docs.cachethq.io/](https://docs.cachethq.io/)
|
|
38
38
|
|
|
39
39
|
## Library to API Quick Reference
|
|
40
|
+
See [RubyDoc](http://www.rubydoc.info/github/TheFynx/cachet_api) for more in-depth documentation
|
|
41
|
+
|
|
40
42
|
### Ping
|
|
41
43
|
|
|
42
|
-
Cachet API | Ruby Library
|
|
43
|
-
:--------- | :----------------
|
|
44
|
-
get/ping | CachetClient.ping
|
|
44
|
+
Cachet API | Ruby Library | Options/Params
|
|
45
|
+
:--------- | :---------------- | :-------------
|
|
46
|
+
get/ping | CachetClient.ping | N/A |
|
|
45
47
|
|
|
46
48
|
### Components
|
|
47
49
|
|
|
48
|
-
Cachet API | Ruby Library
|
|
49
|
-
:--------------------------- | :------------------------------
|
|
50
|
-
get/components | CachetComponents.list
|
|
51
|
-
get/components/:id | CachetComponents.list_id
|
|
52
|
-
post/components | CachetComponents.create
|
|
53
|
-
put/components/:id | CachetComponents.update
|
|
54
|
-
delete/components/:id | CachetComponents.delete
|
|
55
|
-
get/components/groups | CachetComponents.groups_list
|
|
56
|
-
get/components/groups/:id | CachetComponents.groups_list_id
|
|
57
|
-
post/components/groups | CachetComponents.groups_create
|
|
58
|
-
put/components/groups/:id | CachetComponents.groups_update
|
|
59
|
-
delete/components/groups/:id | CachetComponents.groups_delete
|
|
50
|
+
Cachet API | Ruby Library | Options/Params (R) == Required
|
|
51
|
+
:--------------------------- | :------------------------------ | :-------------------------------------------------------------------------------
|
|
52
|
+
get/components | CachetComponents.list | N/A |
|
|
53
|
+
get/components/:id | CachetComponents.list_id | Options (hash) : id |
|
|
54
|
+
post/components | CachetComponents.create | Options (hash) : name(R), status(R), description, link, order, group_id, enabled |
|
|
55
|
+
put/components/:id | CachetComponents.update | Options (hash) : id(R), status(R), name(R), link, order, group_id, enabled |
|
|
56
|
+
delete/components/:id | CachetComponents.delete | Options (hash) : id(R) |
|
|
57
|
+
get/components/groups | CachetComponents.groups_list | N/A |
|
|
58
|
+
get/components/groups/:id | CachetComponents.groups_list_id | Options (hash) : id(R) |
|
|
59
|
+
post/components/groups | CachetComponents.groups_create | Options (hash) : name(R), order, collapsed(R) |
|
|
60
|
+
put/components/groups/:id | CachetComponents.groups_update | Options (hash) : id(R), name, order, collapsed |
|
|
61
|
+
delete/components/groups/:id | CachetComponents.groups_delete | Options (hash) : id(R) |
|
|
60
62
|
|
|
61
63
|
### Incidents
|
|
62
64
|
|
|
63
|
-
Cachet API | Ruby Library
|
|
64
|
-
:------------------- | :----------------------
|
|
65
|
-
get/incidents | CachetIncidents.list
|
|
66
|
-
get/incidents/:id | CachetIncidents.list_id
|
|
67
|
-
post/incidents | CachetIncidents.create
|
|
68
|
-
put/incidents/:id | CachetIncidents.update
|
|
69
|
-
delete/incidents/:id | CachetIncidents.delete
|
|
65
|
+
Cachet API | Ruby Library | Options/Params (R) == Required
|
|
66
|
+
:------------------- | :---------------------- | :--------------------------------------------------------------------------------------------------
|
|
67
|
+
get/incidents | CachetIncidents.list | N/A |
|
|
68
|
+
get/incidents/:id | CachetIncidents.list_id | Options (hash) : id |
|
|
69
|
+
post/incidents | CachetIncidents.create | Options (hash) : name(R), message(R), status(R), visible(R), component_id, component_status, notify |
|
|
70
|
+
put/incidents/:id | CachetIncidents.update | Options (hash) : id(R), name, message, status, visible, component_id, component_status, notify |
|
|
71
|
+
delete/incidents/:id | CachetIncidents.delete | Options (hash) : id |
|
|
70
72
|
|
|
71
73
|
### Metrics
|
|
72
74
|
|
|
73
|
-
Cachet API | Ruby Library
|
|
74
|
-
:---------------------------------- | :-------------------------
|
|
75
|
-
get/metrics | CachetMetrics.list
|
|
76
|
-
post/metrics | CachetMetrics.create
|
|
77
|
-
get/metrics/:id | CachetMetrics.list_id
|
|
78
|
-
delete/metrics/:id | CachetMetrics.delete
|
|
79
|
-
get/metrics/:id/points | CachetMetrics.point_list
|
|
80
|
-
post/metrics/:id/points | CachetMetrics.point_add
|
|
81
|
-
delete/metrics/:id/points/:point_id | CachetMetrics.point_delete
|
|
75
|
+
Cachet API | Ruby Library | Options/Params (R) == Required
|
|
76
|
+
:---------------------------------- | :------------------------- | :--------------------------------------------------------------------------------------
|
|
77
|
+
get/metrics | CachetMetrics.list | N/A |
|
|
78
|
+
post/metrics | CachetMetrics.create | Options (hash) : name(R), suffix(R), description(R), default_value(R), display_chart(R) |
|
|
79
|
+
get/metrics/:id | CachetMetrics.list_id | Options (hash) : id(R) |
|
|
80
|
+
delete/metrics/:id | CachetMetrics.delete | Options (hash) : id(R) |
|
|
81
|
+
get/metrics/:id/points | CachetMetrics.point_list | Options (hash) : id (R) |
|
|
82
|
+
post/metrics/:id/points | CachetMetrics.point_add | Options (hash) : id(R), value(R), timestamp |
|
|
83
|
+
delete/metrics/:id/points/:point_id | CachetMetrics.point_delete | Options (hash) : id(R), point_id(R) |
|
|
82
84
|
|
|
83
85
|
### Subscribers
|
|
84
86
|
|
|
85
|
-
Cachet API | Ruby Library
|
|
86
|
-
:--------------------- | :-----------------------
|
|
87
|
-
get/subscribers | CachetSubscribers.list
|
|
88
|
-
post/subscribers | CachetSubscribers.create
|
|
89
|
-
delete/subscribers/:id | CachetSubscribers.delete
|
|
87
|
+
Cachet API | Ruby Library | Options/Params (R) == Required
|
|
88
|
+
:--------------------- | :----------------------- | :--------------------------------
|
|
89
|
+
get/subscribers | CachetSubscribers.list | N/A |
|
|
90
|
+
post/subscribers | CachetSubscribers.create | Options (hash) : email(R), verify |
|
|
91
|
+
delete/subscribers/:id | CachetSubscribers.delete | Options (hash) : id(R) |
|
|
90
92
|
|
|
91
93
|
## Development
|
|
92
|
-
After checking out the repo
|
|
93
|
-
|
|
94
|
-
To
|
|
94
|
+
After checking out the repo
|
|
95
|
+
- Run `bin/setup`
|
|
96
|
+
- To run IRB with quick configuration, `rake console`
|
|
97
|
+
- To install this gem onto your local machine, run `bundle exec rake install`
|
|
98
|
+
|
|
99
|
+
## Contribute
|
|
100
|
+
Fork this repo
|
|
101
|
+
- Make your changes
|
|
102
|
+
- Create/Update RSPEC Tests
|
|
103
|
+
- Document changes inline (if needed, aka new options)
|
|
104
|
+
- Document readme with changes
|
|
105
|
+
- Submit pull request
|
data/Rakefile
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
require 'bundler/gem_tasks'
|
|
2
2
|
require 'rake/testtask'
|
|
3
|
-
require 'yard'
|
|
4
3
|
require 'rspec'
|
|
5
4
|
require 'rspec/core/rake_task'
|
|
6
5
|
|
|
@@ -13,16 +12,12 @@ RSpec::Core::RakeTask.new(:spec) do |t|
|
|
|
13
12
|
t.pattern = Dir.glob('spec/*_spec.rb')
|
|
14
13
|
end
|
|
15
14
|
|
|
16
|
-
YARD::Rake::YardocTask.new do |t|
|
|
17
|
-
t.options = ['--markup-provider=redcarpet', '--markup=markdown']
|
|
18
|
-
end
|
|
19
|
-
|
|
20
15
|
desc 'Open an irb session preloaded with this library'
|
|
21
16
|
task :console do
|
|
22
|
-
sh '
|
|
17
|
+
sh 'ruby -I lib ./bin/console.rb'
|
|
23
18
|
end
|
|
24
19
|
|
|
25
20
|
desc 'Common task'
|
|
26
21
|
task all: [:test, :spec]
|
|
27
22
|
|
|
28
|
-
task :
|
|
23
|
+
task default: :test
|
data/bin/console.rb
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
|
+
require 'irb'
|
|
4
|
+
require 'cachet.rb'
|
|
5
|
+
|
|
6
|
+
module IRB
|
|
7
|
+
def self.start_session(binding)
|
|
8
|
+
IRB.setup(nil)
|
|
9
|
+
|
|
10
|
+
workspace = WorkSpace.new(binding)
|
|
11
|
+
|
|
12
|
+
if @CONF[:SCRIPT]
|
|
13
|
+
irb = Irb.new(workspace, @CONF[:SCRIPT])
|
|
14
|
+
else
|
|
15
|
+
irb = Irb.new(workspace)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
@CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC]
|
|
19
|
+
@CONF[:MAIN_CONTEXT] = irb.context
|
|
20
|
+
|
|
21
|
+
trap('SIGINT') do
|
|
22
|
+
irb.signal_handle
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
catch(:IRB_EXIT) do
|
|
26
|
+
irb.eval_input
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
api = '9yMHsdioQosnyVK4iCVR'
|
|
32
|
+
base_url = 'https://demo.cachethq.io/api/v1/'
|
|
33
|
+
|
|
34
|
+
# we want to manipulate this in IRB
|
|
35
|
+
CachetClient = CachetClient.new(api, base_url)
|
|
36
|
+
CachetComponents = CachetComponents.new(api, base_url)
|
|
37
|
+
CachetIncidents = CachetIncidents.new(api, base_url)
|
|
38
|
+
CachetMetrics = CachetMetrics.new(api, base_url)
|
|
39
|
+
CachetSubscribers = CachetSubscribers.new(api, base_url)
|
|
40
|
+
|
|
41
|
+
componentoptions = {}
|
|
42
|
+
componentoptions['status'] = 1
|
|
43
|
+
|
|
44
|
+
incidentoptions = {}
|
|
45
|
+
incidentoptions['id'] = 1
|
|
46
|
+
|
|
47
|
+
metricoptions = {}
|
|
48
|
+
metricoptions['id'] = 1
|
|
49
|
+
|
|
50
|
+
subscribeoptions = {}
|
|
51
|
+
subscribeoptions['id'] = 3
|
|
52
|
+
subscribeoptions['email'] = 'test@testing.com'
|
|
53
|
+
subscribeoptions['verify'] = '0'
|
|
54
|
+
|
|
55
|
+
IRB.start_session(Kernel.binding)
|
data/cachet_api.gemspec
CHANGED
|
@@ -14,18 +14,14 @@ Gem::Specification.new do |spec|
|
|
|
14
14
|
spec.description = 'Ruby library wrapper for CachetHQ.io - Beautiful & simple service statuses - The open source status page system, for everyone'
|
|
15
15
|
spec.homepage = 'https://github.com/TheFynx/cachet_api'
|
|
16
16
|
|
|
17
|
-
spec.license =
|
|
17
|
+
spec.license = 'MIT'
|
|
18
18
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
19
19
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
20
20
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
21
|
-
spec.require_paths = [
|
|
21
|
+
spec.require_paths = ['lib']
|
|
22
22
|
|
|
23
|
-
spec.add_development_dependency
|
|
24
|
-
spec.add_development_dependency
|
|
25
|
-
spec.add_development_dependency
|
|
26
|
-
spec.
|
|
27
|
-
spec.add_development_dependency "pry"
|
|
28
|
-
spec.add_dependency "rest-client"
|
|
29
|
-
spec.add_dependency "yard"
|
|
30
|
-
spec.add_dependency "redcarpet"
|
|
23
|
+
spec.add_development_dependency 'codeclimate-test-reporter', '~> 0.4.8'
|
|
24
|
+
spec.add_development_dependency 'rake', '~> 10.5'
|
|
25
|
+
spec.add_development_dependency 'rspec', '~> 3.4'
|
|
26
|
+
spec.add_dependency 'rest-client', '~> 1.8'
|
|
31
27
|
end
|
data/lib/cachet.rb
CHANGED
|
@@ -33,7 +33,7 @@ class CachetClient
|
|
|
33
33
|
INCIDENT_INVESTIGATING = 1
|
|
34
34
|
##
|
|
35
35
|
# Constant to utilize for Incident Status Identified
|
|
36
|
-
INCIDENT_IDENTIFIED =
|
|
36
|
+
INCIDENT_IDENTIFIED = 2
|
|
37
37
|
##
|
|
38
38
|
# Constant to utilize for Incident Status Watching
|
|
39
39
|
INCIDENT_WATCHING = 3
|
|
@@ -58,11 +58,11 @@ class CachetClient
|
|
|
58
58
|
|
|
59
59
|
##
|
|
60
60
|
# Posts token, url, headers, and any payloads to rest-client all params are passed by methods
|
|
61
|
-
# @param
|
|
62
|
-
# @param
|
|
63
|
-
# @param
|
|
64
|
-
# @param
|
|
65
|
-
# @param
|
|
61
|
+
# @param params [string] :api_key Your cachet API Token/Key
|
|
62
|
+
# @param params [string] :url Your complete cachet api url, built by methods
|
|
63
|
+
# @param params [string] :method Get, Post, Put, and Delete
|
|
64
|
+
# @param params [hash] :options Set of options provided by the Cachet methods
|
|
65
|
+
# @param params [hash] :headers provides by initialize methods
|
|
66
66
|
# @return object
|
|
67
67
|
|
|
68
68
|
def request(params)
|
|
@@ -73,7 +73,7 @@ class CachetClient
|
|
|
73
73
|
body = JSON.parse(response.body)
|
|
74
74
|
return body
|
|
75
75
|
elsif response.code == 204
|
|
76
|
-
return code
|
|
76
|
+
return { 'data' => code }
|
|
77
77
|
else
|
|
78
78
|
fail Net::HTTPError, response.inspect
|
|
79
79
|
end
|
|
@@ -108,11 +108,10 @@ class CachetComponents < CachetClient
|
|
|
108
108
|
# List Component by ID.
|
|
109
109
|
# @option options [string] :id Numeric component id
|
|
110
110
|
# @return object
|
|
111
|
-
# id
|
|
112
111
|
|
|
113
112
|
def list_id(options)
|
|
114
113
|
request method: :get,
|
|
115
|
-
url: @base_url + 'components/' + options['id']
|
|
114
|
+
url: @base_url + 'components/' + options['id'].to_s
|
|
116
115
|
end
|
|
117
116
|
|
|
118
117
|
##
|
|
@@ -147,7 +146,7 @@ class CachetComponents < CachetClient
|
|
|
147
146
|
|
|
148
147
|
def update(options)
|
|
149
148
|
request method: :put,
|
|
150
|
-
url: @base_url + 'components/' + options['id'],
|
|
149
|
+
url: @base_url + 'components/' + options['id'].to_s,
|
|
151
150
|
payload: options
|
|
152
151
|
end
|
|
153
152
|
|
|
@@ -159,7 +158,7 @@ class CachetComponents < CachetClient
|
|
|
159
158
|
|
|
160
159
|
def delete(options)
|
|
161
160
|
request method: :delete,
|
|
162
|
-
url: @base_url + 'components/' + options['id']
|
|
161
|
+
url: @base_url + 'components/' + options['id'].to_s
|
|
163
162
|
end
|
|
164
163
|
|
|
165
164
|
##
|
|
@@ -180,7 +179,7 @@ class CachetComponents < CachetClient
|
|
|
180
179
|
|
|
181
180
|
def groups_list_id(options)
|
|
182
181
|
request method: :get,
|
|
183
|
-
url: @base_url + 'components/groups/' + options['id']
|
|
182
|
+
url: @base_url + 'components/groups/' + options['id'].to_s
|
|
184
183
|
end
|
|
185
184
|
|
|
186
185
|
##
|
|
@@ -188,7 +187,7 @@ class CachetComponents < CachetClient
|
|
|
188
187
|
#
|
|
189
188
|
# @option options [string] :name **Required** Component group name
|
|
190
189
|
# @option options [int] :order Numeric order of the component group
|
|
191
|
-
# @option options [
|
|
190
|
+
# @option options [int] :collapsed Whether to collapse the group by default
|
|
192
191
|
# @return object
|
|
193
192
|
|
|
194
193
|
def groups_create(options)
|
|
@@ -208,7 +207,7 @@ class CachetComponents < CachetClient
|
|
|
208
207
|
|
|
209
208
|
def groups_update(options)
|
|
210
209
|
request method: :put,
|
|
211
|
-
url: @base_url + 'components/groups',
|
|
210
|
+
url: @base_url + 'components/groups/' + options['id'].to_s,
|
|
212
211
|
payload: options
|
|
213
212
|
end
|
|
214
213
|
|
|
@@ -219,11 +218,8 @@ class CachetComponents < CachetClient
|
|
|
219
218
|
# @return object
|
|
220
219
|
|
|
221
220
|
def groups_delete(options)
|
|
222
|
-
options['id'].each_pair do |_k, v|
|
|
223
|
-
options['id'] = v.to_s
|
|
224
|
-
end
|
|
225
221
|
request method: :delete,
|
|
226
|
-
url: @base_url + 'components/groups/' + options['id']
|
|
222
|
+
url: @base_url + 'components/groups/' + options['id'].to_s
|
|
227
223
|
end
|
|
228
224
|
end
|
|
229
225
|
|
|
@@ -249,7 +245,7 @@ class CachetIncidents < CachetClient
|
|
|
249
245
|
|
|
250
246
|
def list_id(options)
|
|
251
247
|
request method: :get,
|
|
252
|
-
url: @base_url + 'incidents/' + options['id']
|
|
248
|
+
url: @base_url + 'incidents/' + options['id'].to_s
|
|
253
249
|
end
|
|
254
250
|
|
|
255
251
|
##
|
|
@@ -285,7 +281,7 @@ class CachetIncidents < CachetClient
|
|
|
285
281
|
|
|
286
282
|
def update(options)
|
|
287
283
|
request method: :put,
|
|
288
|
-
url: @base_url + 'incidents/' + options['id'],
|
|
284
|
+
url: @base_url + 'incidents/' + options['id'].to_s,
|
|
289
285
|
payload: options
|
|
290
286
|
end
|
|
291
287
|
|
|
@@ -297,7 +293,7 @@ class CachetIncidents < CachetClient
|
|
|
297
293
|
|
|
298
294
|
def delete(options)
|
|
299
295
|
request method: :delete,
|
|
300
|
-
url: @base_url + 'incidents/' + options['id']
|
|
296
|
+
url: @base_url + 'incidents/' + options['id'].to_s
|
|
301
297
|
end
|
|
302
298
|
end
|
|
303
299
|
|
|
@@ -322,7 +318,7 @@ class CachetMetrics < CachetClient
|
|
|
322
318
|
# @option options [string] :suffix **Required** Measurments in
|
|
323
319
|
# @option options [string] :description **Required** Description of what is measured
|
|
324
320
|
# @option options [int] :default_value **Required** The default value for points
|
|
325
|
-
# @option options [int] :display_chart Whether to display the chart on the status page
|
|
321
|
+
# @option options [int] :display_chart **Required** Whether to display the chart on the status page
|
|
326
322
|
# @return object
|
|
327
323
|
|
|
328
324
|
def create(options)
|
|
@@ -339,7 +335,7 @@ class CachetMetrics < CachetClient
|
|
|
339
335
|
|
|
340
336
|
def list_id(options)
|
|
341
337
|
request method: :get,
|
|
342
|
-
url: @base_url + 'metrics/' + options['id']
|
|
338
|
+
url: @base_url + 'metrics/' + options['id'].to_s
|
|
343
339
|
end
|
|
344
340
|
|
|
345
341
|
##
|
|
@@ -350,7 +346,7 @@ class CachetMetrics < CachetClient
|
|
|
350
346
|
|
|
351
347
|
def delete(options)
|
|
352
348
|
request method: :delete,
|
|
353
|
-
url: @base_url + 'metrics/' + options['id']
|
|
349
|
+
url: @base_url + 'metrics/' + options['id'].to_s
|
|
354
350
|
end
|
|
355
351
|
|
|
356
352
|
##
|
|
@@ -361,7 +357,7 @@ class CachetMetrics < CachetClient
|
|
|
361
357
|
|
|
362
358
|
def point_list(options)
|
|
363
359
|
request method: :get,
|
|
364
|
-
url: @base_url + 'metrics/' + options['id'] + '/points'
|
|
360
|
+
url: @base_url + 'metrics/' + options['id'].to_s + '/points'
|
|
365
361
|
end
|
|
366
362
|
|
|
367
363
|
##
|
|
@@ -374,7 +370,7 @@ class CachetMetrics < CachetClient
|
|
|
374
370
|
|
|
375
371
|
def point_add(options)
|
|
376
372
|
request method: :post,
|
|
377
|
-
url: @base_url + 'metrics/' + options['id'] + '/points',
|
|
373
|
+
url: @base_url + 'metrics/' + options['id'].to_s + '/points',
|
|
378
374
|
payload: options
|
|
379
375
|
end
|
|
380
376
|
|
|
@@ -387,7 +383,7 @@ class CachetMetrics < CachetClient
|
|
|
387
383
|
|
|
388
384
|
def point_delete(options)
|
|
389
385
|
request method: :delete,
|
|
390
|
-
url: @base_url + 'metrics/' + options['id'] + '/points/' + options['point_id'],
|
|
386
|
+
url: @base_url + 'metrics/' + options['id'].to_s + '/points/' + options['point_id'].to_s,
|
|
391
387
|
payload: options
|
|
392
388
|
end
|
|
393
389
|
end
|
|
@@ -427,6 +423,6 @@ class CachetSubscribers < CachetClient
|
|
|
427
423
|
|
|
428
424
|
def delete(options)
|
|
429
425
|
request method: :delete,
|
|
430
|
-
url: @base_url + 'subscribers/' + options['id']
|
|
426
|
+
url: @base_url + 'subscribers/' + options['id'].to_s
|
|
431
427
|
end
|
|
432
428
|
end
|
data/lib/cachet/rb/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,134 +1,77 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cachet_api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.0
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- TheFynx
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-03-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: codeclimate-test-reporter
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- -
|
|
17
|
+
- - ~>
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 0.4.8
|
|
20
20
|
type: :development
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- -
|
|
24
|
+
- - ~>
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
26
|
+
version: 0.4.8
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: rake
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
|
-
- -
|
|
31
|
+
- - ~>
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
33
|
+
version: '10.5'
|
|
34
34
|
type: :development
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
|
-
- -
|
|
38
|
+
- - ~>
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
40
|
+
version: '10.5'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: rspec
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
|
-
- -
|
|
45
|
+
- - ~>
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
47
|
+
version: '3.4'
|
|
48
48
|
type: :development
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
|
-
- -
|
|
52
|
+
- - ~>
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
55
|
-
- !ruby/object:Gem::Dependency
|
|
56
|
-
name: httparty
|
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
|
58
|
-
requirements:
|
|
59
|
-
- - '>='
|
|
60
|
-
- !ruby/object:Gem::Version
|
|
61
|
-
version: '0'
|
|
62
|
-
type: :development
|
|
63
|
-
prerelease: false
|
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
-
requirements:
|
|
66
|
-
- - '>='
|
|
67
|
-
- !ruby/object:Gem::Version
|
|
68
|
-
version: '0'
|
|
69
|
-
- !ruby/object:Gem::Dependency
|
|
70
|
-
name: pry
|
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
|
72
|
-
requirements:
|
|
73
|
-
- - '>='
|
|
74
|
-
- !ruby/object:Gem::Version
|
|
75
|
-
version: '0'
|
|
76
|
-
type: :development
|
|
77
|
-
prerelease: false
|
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
-
requirements:
|
|
80
|
-
- - '>='
|
|
81
|
-
- !ruby/object:Gem::Version
|
|
82
|
-
version: '0'
|
|
54
|
+
version: '3.4'
|
|
83
55
|
- !ruby/object:Gem::Dependency
|
|
84
56
|
name: rest-client
|
|
85
57
|
requirement: !ruby/object:Gem::Requirement
|
|
86
58
|
requirements:
|
|
87
|
-
- -
|
|
59
|
+
- - ~>
|
|
88
60
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: '
|
|
61
|
+
version: '1.8'
|
|
90
62
|
type: :runtime
|
|
91
63
|
prerelease: false
|
|
92
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
65
|
requirements:
|
|
94
|
-
- -
|
|
66
|
+
- - ~>
|
|
95
67
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: '
|
|
97
|
-
- !ruby/object:Gem::Dependency
|
|
98
|
-
name: yard
|
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
|
100
|
-
requirements:
|
|
101
|
-
- - '>='
|
|
102
|
-
- !ruby/object:Gem::Version
|
|
103
|
-
version: '0'
|
|
104
|
-
type: :runtime
|
|
105
|
-
prerelease: false
|
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
-
requirements:
|
|
108
|
-
- - '>='
|
|
109
|
-
- !ruby/object:Gem::Version
|
|
110
|
-
version: '0'
|
|
111
|
-
- !ruby/object:Gem::Dependency
|
|
112
|
-
name: redcarpet
|
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
|
114
|
-
requirements:
|
|
115
|
-
- - '>='
|
|
116
|
-
- !ruby/object:Gem::Version
|
|
117
|
-
version: '0'
|
|
118
|
-
type: :runtime
|
|
119
|
-
prerelease: false
|
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
-
requirements:
|
|
122
|
-
- - '>='
|
|
123
|
-
- !ruby/object:Gem::Version
|
|
124
|
-
version: '0'
|
|
68
|
+
version: '1.8'
|
|
125
69
|
description: Ruby library wrapper for CachetHQ.io - Beautiful & simple service statuses
|
|
126
70
|
- The open source status page system, for everyone
|
|
127
71
|
email:
|
|
128
72
|
- levi@fynx.me
|
|
129
73
|
executables:
|
|
130
|
-
- console
|
|
131
|
-
- console_load.rb
|
|
74
|
+
- console.rb
|
|
132
75
|
- setup
|
|
133
76
|
extensions: []
|
|
134
77
|
extra_rdoc_files: []
|
|
@@ -140,8 +83,7 @@ files:
|
|
|
140
83
|
- LICENSE
|
|
141
84
|
- README.md
|
|
142
85
|
- Rakefile
|
|
143
|
-
- bin/console
|
|
144
|
-
- bin/console_load.rb
|
|
86
|
+
- bin/console.rb
|
|
145
87
|
- bin/setup
|
|
146
88
|
- cachet_api.gemspec
|
|
147
89
|
- lib/cachet.rb
|
|
@@ -156,19 +98,18 @@ require_paths:
|
|
|
156
98
|
- lib
|
|
157
99
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
158
100
|
requirements:
|
|
159
|
-
- - '>='
|
|
101
|
+
- - ! '>='
|
|
160
102
|
- !ruby/object:Gem::Version
|
|
161
103
|
version: '0'
|
|
162
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
105
|
requirements:
|
|
164
|
-
- - '
|
|
106
|
+
- - ! '>='
|
|
165
107
|
- !ruby/object:Gem::Version
|
|
166
|
-
version:
|
|
108
|
+
version: '0'
|
|
167
109
|
requirements: []
|
|
168
110
|
rubyforge_project:
|
|
169
|
-
rubygems_version: 2.
|
|
111
|
+
rubygems_version: 2.4.5
|
|
170
112
|
signing_key:
|
|
171
113
|
specification_version: 4
|
|
172
114
|
summary: Ruby library wrapper for Cachet API
|
|
173
115
|
test_files: []
|
|
174
|
-
has_rdoc:
|
data/bin/console
DELETED
data/bin/console_load.rb
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
lib = File.expand_path('../lib', __FILE__)
|
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
|
-
require 'irb'
|
|
4
|
-
require 'cachet.rb'
|
|
5
|
-
|
|
6
|
-
module IRB
|
|
7
|
-
def self.start_session(binding)
|
|
8
|
-
IRB.setup(nil)
|
|
9
|
-
|
|
10
|
-
workspace = WorkSpace.new(binding)
|
|
11
|
-
|
|
12
|
-
if @CONF[:SCRIPT]
|
|
13
|
-
irb = Irb.new(workspace, @CONF[:SCRIPT])
|
|
14
|
-
else
|
|
15
|
-
irb = Irb.new(workspace)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
@CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC]
|
|
19
|
-
@CONF[:MAIN_CONTEXT] = irb.context
|
|
20
|
-
|
|
21
|
-
trap("SIGINT") do
|
|
22
|
-
irb.signal_handle
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
catch(:IRB_EXIT) do
|
|
26
|
-
irb.eval_input
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
# we want to manipulate this in IRB
|
|
32
|
-
CachetComponents = CachetComponents.new('9yMHsdioQosnyVK4iCVR', 'https://demo.cachethq.io/api/v1/')
|
|
33
|
-
CachetIncidents = CachetIncidents.new('9yMHsdioQosnyVK4iCVR', 'https://demo.cachethq.io/api/v1/')
|
|
34
|
-
CachetMetrics = CachetMetrics.new('9yMHsdioQosnyVK4iCVR', 'https://demo.cachethq.io/api/v1/')
|
|
35
|
-
options = {}
|
|
36
|
-
options['id'] = '1'
|
|
37
|
-
options['name'] = 'API'
|
|
38
|
-
options['status'] = '1'
|
|
39
|
-
|
|
40
|
-
IRB.start_session(Kernel.binding)
|