rufbit 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f1a9062bfa1ffa17acd60338bf1e3fe442c711f7
4
+ data.tar.gz: 12282a96f70a4a85b4020480b0192970fd00f524
5
+ SHA512:
6
+ metadata.gz: 1664c34bbd3b4ea84588d3658cb22cc5e2ec4f51b51be6760d7debeb4e38262326cb64e549ced389bbe07339b68cf3488617211fdb9b9972e120ef5fea6774ef
7
+ data.tar.gz: e5ba01e02234851eb65c1975e678a0475f2455a76c29055a6f2ead0e3c7f2b0198c69f72402d6855572900f16ff830bb9146276cfa3f2604126346c7738dbcef
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rspec_status ADDED
@@ -0,0 +1,6 @@
1
+ example_id | status | run_time |
2
+ -------------------------- | ------ | --------------- |
3
+ ./spec/rufbit_spec.rb[1:1] | passed | 0.00253 seconds |
4
+ ./spec/rufbit_spec.rb[1:2] | passed | 0.0025 seconds |
5
+ ./spec/rufbit_spec.rb[1:3] | passed | 2.07 seconds |
6
+ ./spec/rufbit_spec.rb[1:4] | passed | 0.23663 seconds |
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.3
5
+ before_install: gem install bundler -v 1.16.1
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in rufbit.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,35 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rufbit (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.3)
10
+ rake (10.5.0)
11
+ rspec (3.7.0)
12
+ rspec-core (~> 3.7.0)
13
+ rspec-expectations (~> 3.7.0)
14
+ rspec-mocks (~> 3.7.0)
15
+ rspec-core (3.7.1)
16
+ rspec-support (~> 3.7.0)
17
+ rspec-expectations (3.7.0)
18
+ diff-lcs (>= 1.2.0, < 2.0)
19
+ rspec-support (~> 3.7.0)
20
+ rspec-mocks (3.7.0)
21
+ diff-lcs (>= 1.2.0, < 2.0)
22
+ rspec-support (~> 3.7.0)
23
+ rspec-support (3.7.1)
24
+
25
+ PLATFORMS
26
+ x86-mingw32
27
+
28
+ DEPENDENCIES
29
+ bundler (~> 1.16)
30
+ rake (~> 10.0)
31
+ rspec (~> 3.0)
32
+ rufbit!
33
+
34
+ BUNDLED WITH
35
+ 1.16.1
data/LICENSE.txt ADDED
@@ -0,0 +1,19 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 The authors permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Rufbit
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/rufbit`. 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 'rufbit'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install rufbit
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. Then, run `rake spec` to run the tests. 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]/rufbit. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
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
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rufbit"
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
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,28 @@
1
+ module Rufbit
2
+ # 400 Bad Request
3
+ class InvalidRequestError < StandardError
4
+ attr_reader :object
5
+
6
+ def initialize(object)
7
+ @object = object
8
+ end
9
+ end
10
+
11
+ # 401 Unauthorized
12
+ class AuthenticationError < StandardError
13
+ attr_reader :object
14
+
15
+ def initialize(object)
16
+ @object = object
17
+ end
18
+ end
19
+
20
+ # 500 Internal Server Error
21
+ class RufbitError < StandardError
22
+ attr_reader :object
23
+
24
+ def initialize(object)
25
+ @object = object
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,37 @@
1
+ require 'net/http'
2
+ require 'json'
3
+ require 'openssl'
4
+
5
+ module Rufbit
6
+ def self.send(title, data, state)
7
+ path = "/v1/notify"
8
+
9
+ body ={
10
+ "API_KEY" => Rufbit.API_KEY,
11
+ "title" => title,
12
+ "data" => data,
13
+ "state" => state
14
+ }.to_json
15
+
16
+ request = Net::HTTP::Post.new(path, initheader = {'Content-Type' =>'application/json'})
17
+ request.body = body
18
+ response = Net::HTTP.new(Rufbit.host, Rufbit.port)
19
+ response.ssl_version = :TLSv1
20
+ response.use_ssl = true
21
+ response.verify_mode = ::OpenSSL::SSL::VERIFY_NONE
22
+ response.start {|http| @res = http.request(request) }
23
+
24
+ #puts "Response #{@res.code} #{@res.message}: #{@res.body}"
25
+
26
+ case @res.code
27
+ when "400"
28
+ raise InvalidRequestError.new(@res), "The request could not be processed properly, often due to missing or invalid parameters"
29
+ when "401"
30
+ raise AuthenticationError.new(@res), "The provided API-Key is invalid or missing"
31
+ when "500"
32
+ raise RufbitError.new(@res), "Something went wrong on our end. Please contact us if you believe this wasn't supposed to happen."
33
+ end
34
+
35
+ return JSON::parse @res.body
36
+ end
37
+ end
@@ -0,0 +1,9 @@
1
+ module Rufbit
2
+ class State
3
+ SUCCESS = 0
4
+ ERROR = 1
5
+ WARNING = 2
6
+ INFO = 3
7
+ OTHER = 4
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module Rufbit
2
+ VERSION = "1.0.0"
3
+ end
data/lib/rufbit.rb ADDED
@@ -0,0 +1,26 @@
1
+ require "rufbit/version"
2
+ require "rufbit/notification"
3
+ require "rufbit/exceptions"
4
+ require "rufbit/states"
5
+
6
+ module Rufbit
7
+ @@API_KEY = ""
8
+ @@host = 'api.rufbit.com'
9
+ @@port = '443'
10
+
11
+ def self.API_KEY= (key)
12
+ @@API_KEY = key
13
+ end
14
+
15
+ def self.API_KEY
16
+ return @@API_KEY
17
+ end
18
+
19
+ def self.host
20
+ return @@host
21
+ end
22
+
23
+ def self.port
24
+ return @@port
25
+ end
26
+ end
Binary file
data/rufbit.gemspec ADDED
@@ -0,0 +1,34 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "rufbit/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rufbit"
8
+ spec.version = Rufbit::VERSION
9
+ spec.authors = ["rufbit"]
10
+ spec.email = ["rufbit@mbng.de"]
11
+
12
+ spec.summary = "Rufbit is a service that helps you to stay on top of what is going on in all of your projects at all times."
13
+ spec.description = "Rufbit is a service that helps you to stay on top of what is going on in all of your projects at all times."
14
+ spec.homepage = "https://rufbit.com"
15
+ spec.license = "MIT"
16
+
17
+ if spec.respond_to?(:metadata)
18
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
19
+ else
20
+ raise "RubyGems 2.0 or newer is required to protect against " \
21
+ "public gem pushes."
22
+ end
23
+
24
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
25
+ f.match(%r{^(test|spec|features)/})
26
+ end
27
+ spec.bindir = "exe"
28
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
+ spec.require_paths = ["lib"]
30
+
31
+ spec.add_development_dependency "bundler", "~> 1.16"
32
+ spec.add_development_dependency "rake", "~> 10.0"
33
+ spec.add_development_dependency "rspec", "~> 3.0"
34
+ end
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rufbit
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - rufbit
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-08-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: Rufbit is a service that helps you to stay on top of what is going on
56
+ in all of your projects at all times.
57
+ email:
58
+ - rufbit@mbng.de
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".rspec"
64
+ - ".rspec_status"
65
+ - ".travis.yml"
66
+ - Gemfile
67
+ - Gemfile.lock
68
+ - LICENSE.txt
69
+ - README.md
70
+ - Rakefile
71
+ - bin/console
72
+ - bin/setup
73
+ - lib/rufbit.rb
74
+ - lib/rufbit/exceptions.rb
75
+ - lib/rufbit/notification.rb
76
+ - lib/rufbit/states.rb
77
+ - lib/rufbit/version.rb
78
+ - pkg/rufbit-1.0.0.gem
79
+ - rufbit.gemspec
80
+ homepage: https://rufbit.com
81
+ licenses:
82
+ - MIT
83
+ metadata:
84
+ allowed_push_host: https://rubygems.org
85
+ post_install_message:
86
+ rdoc_options: []
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ requirements: []
100
+ rubyforge_project:
101
+ rubygems_version: 2.5.2
102
+ signing_key:
103
+ specification_version: 4
104
+ summary: Rufbit is a service that helps you to stay on top of what is going on in
105
+ all of your projects at all times.
106
+ test_files: []