statuspageio 0.1.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 +7 -0
- data/.gitignore +8 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +24 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/statuspageio.rb +28 -0
- data/lib/statuspageio/client.rb +19 -0
- data/lib/statuspageio/client/incident.rb +18 -0
- data/lib/statuspageio/configuration.rb +35 -0
- data/lib/statuspageio/request.rb +30 -0
- data/lib/statuspageio/version.rb +3 -0
- data/statuspageio.gemspec +36 -0
- metadata +101 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f6c5f3b88b51922a823a8098105da0ac76171d7e
|
4
|
+
data.tar.gz: b4d64b0d6290ba38df5f1ef58c53e23462515805
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: aba28ae7059a72c42478408d8d2717e2f273e8322c713906ad9b1d0e62a731336c91d2a1c9f0908be76db157ce84a51e73d6b89087e734355940639bcb4eb67a
|
7
|
+
data.tar.gz: 0ec4ea553d5a3b6dd1c896672a7b864500095464bba07c277763fb45dc77e6bf889b5e44a257a2dba17bee073abbd0d16a022813aa97139674ffa39200c90277
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
statuspageio (0.1.0)
|
5
|
+
httparty (~> 0.15.6)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
httparty (0.15.6)
|
11
|
+
multi_xml (>= 0.5.2)
|
12
|
+
multi_xml (0.6.0)
|
13
|
+
rake (10.5.0)
|
14
|
+
|
15
|
+
PLATFORMS
|
16
|
+
ruby
|
17
|
+
|
18
|
+
DEPENDENCIES
|
19
|
+
bundler (~> 1.16)
|
20
|
+
rake (~> 10.0)
|
21
|
+
statuspageio!
|
22
|
+
|
23
|
+
BUNDLED WITH
|
24
|
+
1.16.0
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Chris Nixon
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Statuspageio
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/statuspageio`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'statuspageio'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install statuspageio
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/statuspageio.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "statuspageio"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/statuspageio.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'statuspageio/client'
|
2
|
+
require 'statuspageio/configuration'
|
3
|
+
|
4
|
+
module Statuspageio
|
5
|
+
extend Configuration
|
6
|
+
class << self
|
7
|
+
# Alias for Statuspageio::Client.new
|
8
|
+
#
|
9
|
+
# @return [Statuspageio::Client]
|
10
|
+
def new(options = {})
|
11
|
+
Statuspageio::Client.new(options)
|
12
|
+
end
|
13
|
+
|
14
|
+
# Delegate to Gems::Client
|
15
|
+
def method_missing(method, *args, &block)
|
16
|
+
return super unless new.respond_to?(method)
|
17
|
+
new.send(method, *args, &block)
|
18
|
+
end
|
19
|
+
|
20
|
+
def respond_to?(method_name, include_private = false)
|
21
|
+
new.respond_to?(method_name, include_private) || super(method_name, include_private)
|
22
|
+
end
|
23
|
+
|
24
|
+
def respond_to_missing?(method_name, include_private = false)
|
25
|
+
new.respond_to?(method_name, include_private) || super(method_name, include_private)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'statuspageio/configuration'
|
2
|
+
require 'statuspageio/request'
|
3
|
+
|
4
|
+
module Statuspageio
|
5
|
+
class Client
|
6
|
+
require 'statuspageio/client/incident'
|
7
|
+
|
8
|
+
include Statuspageio::Request
|
9
|
+
include Statuspageio::Client::Incident
|
10
|
+
|
11
|
+
attr_accessor(*Configuration::VALID_OPTIONS_KEYS)
|
12
|
+
|
13
|
+
def initialize(options = {})
|
14
|
+
options = Statuspageio.options.merge(options)
|
15
|
+
Configuration::VALID_OPTIONS_KEYS.each do |key|
|
16
|
+
send("#{key}=", options[key])
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Statuspageio
|
2
|
+
class Client
|
3
|
+
module Incident
|
4
|
+
def incidents(scope = :all)
|
5
|
+
case scope
|
6
|
+
when :all
|
7
|
+
get("/pages/#{self.page_id}/incidents")
|
8
|
+
when :unresolved
|
9
|
+
get("/pages/#{self.page_id}/incidents/unresolved")
|
10
|
+
when :scheduled
|
11
|
+
get("/pages/#{self.page_id}/incidents/scheduled")
|
12
|
+
else
|
13
|
+
get("/pages/#{self.page_id}/incidents")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Statuspageio
|
2
|
+
module Configuration
|
3
|
+
# An array of valid keys in the options hash when configuring a {Gems::Client}
|
4
|
+
VALID_OPTIONS_KEYS = [
|
5
|
+
:api_key,
|
6
|
+
:page_id
|
7
|
+
].freeze
|
8
|
+
|
9
|
+
attr_accessor(*VALID_OPTIONS_KEYS)
|
10
|
+
|
11
|
+
# When this module is extended, set all configuration options to their default values
|
12
|
+
def self.extended(base)
|
13
|
+
base.reset
|
14
|
+
end
|
15
|
+
|
16
|
+
# Convenience method to allow configuration options to be set in a block
|
17
|
+
def configure
|
18
|
+
yield self
|
19
|
+
end
|
20
|
+
|
21
|
+
# Create a hash of options and their values
|
22
|
+
def options
|
23
|
+
options = {}
|
24
|
+
VALID_OPTIONS_KEYS.each { |k| options[k] = send(k) }
|
25
|
+
options
|
26
|
+
end
|
27
|
+
|
28
|
+
# Reset all configuration options to defaults
|
29
|
+
def reset
|
30
|
+
self.api_key = nil
|
31
|
+
self.page_id = nil
|
32
|
+
self
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
|
3
|
+
module Statuspageio
|
4
|
+
module Request
|
5
|
+
include HTTParty
|
6
|
+
base_uri 'api.statuspage.io/v1'
|
7
|
+
|
8
|
+
def delete(path, data = {})
|
9
|
+
self.class.delete("#{path}.json", data, headers: headers)
|
10
|
+
end
|
11
|
+
|
12
|
+
def get(path, data = {})
|
13
|
+
self.class.get("#{path}.json", data, headers: headers)
|
14
|
+
end
|
15
|
+
|
16
|
+
def post(path, data = {})
|
17
|
+
self.class.post("#{path}.json", data, headers: headers)
|
18
|
+
end
|
19
|
+
|
20
|
+
def put(path, data = {})
|
21
|
+
self.class.put("#{path}.json", data, headers: headers)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def headers
|
27
|
+
{ Authorization: "OAuth #{self.api_key}" }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "statuspageio/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "statuspageio"
|
8
|
+
spec.version = Statuspageio::VERSION
|
9
|
+
spec.authors = ["Chris Nixon"]
|
10
|
+
spec.email = ["chris.d.nixon@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Ruby API wrapper for Statuspage.io.}
|
13
|
+
spec.homepage = "https://github.com/dasnixon/statuspageio"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
+
# if spec.respond_to?(:metadata)
|
19
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
20
|
+
# else
|
21
|
+
# raise "RubyGems 2.0 or newer is required to protect against " \
|
22
|
+
# "public gem pushes."
|
23
|
+
# end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
26
|
+
f.match(%r{^(test|spec|features)/})
|
27
|
+
end
|
28
|
+
spec.bindir = "exe"
|
29
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ["lib"]
|
31
|
+
|
32
|
+
spec.add_dependency "httparty", "~> 0.15.6"
|
33
|
+
|
34
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
35
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: statuspageio
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chris Nixon
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-11-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.15.6
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.15.6
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.16'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.16'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- chris.d.nixon@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- Gemfile
|
64
|
+
- Gemfile.lock
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- bin/console
|
69
|
+
- bin/setup
|
70
|
+
- lib/statuspageio.rb
|
71
|
+
- lib/statuspageio/client.rb
|
72
|
+
- lib/statuspageio/client/incident.rb
|
73
|
+
- lib/statuspageio/configuration.rb
|
74
|
+
- lib/statuspageio/request.rb
|
75
|
+
- lib/statuspageio/version.rb
|
76
|
+
- statuspageio.gemspec
|
77
|
+
homepage: https://github.com/dasnixon/statuspageio
|
78
|
+
licenses:
|
79
|
+
- MIT
|
80
|
+
metadata: {}
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options: []
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
requirements: []
|
96
|
+
rubyforge_project:
|
97
|
+
rubygems_version: 2.4.5.1
|
98
|
+
signing_key:
|
99
|
+
specification_version: 4
|
100
|
+
summary: Ruby API wrapper for Statuspage.io.
|
101
|
+
test_files: []
|