firebell 0.3.1 → 0.3.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e0ce73dc08231273237f29ec75a04cc4f6a38ad1
4
- data.tar.gz: 2f2740e33884c8f70934c21e35881f3055277170
2
+ SHA256:
3
+ metadata.gz: e19d89f9d93440ba3bf645efbee32f6b6d38eac1fc6d906ef5401ef248a7b498
4
+ data.tar.gz: 7f672ca351b30a5f881e2df5ae0ae7930b2766fe17bfe28dc7742ca54718f45a
5
5
  SHA512:
6
- metadata.gz: 14d30ffa5acc9c49f2e59b83a169bd1a62b370dd6c534b118afbd9256d809e2ae28bac2390fdd70e7ec55a1803fa88f5b143e19f41b5b10953c9cf84b0e3642e
7
- data.tar.gz: 1eef52678b42920b5f09d9bac95d4f4efd7cf00a186ee2565fdfb7a3653dfbc665d4931cf1fd0f8967ff0d68808071e076bc3022849dfb260e5e109798c9d38e
6
+ metadata.gz: b738e7d6ccdc58738f33e4bff9c107e012626e903d8e2a7cf4befc67dabb8136159fc0fb3c5e6d8349e3075fbf255693e4c3005bc65901319ef41344a6ce5fe0
7
+ data.tar.gz: 2254d8964e1ec02ea680059fb7a5b146542c5563317ca8315731116f6a2a4e877a35353ae47e268a2bb0d8ea81ff2596ef3eddd9730d15092620bcbe718e6794
@@ -0,0 +1,6 @@
1
+ steps:
2
+ - name: ":rspec:"
3
+ command: rspec --color spec
4
+ plugins:
5
+ docker-compose#v2.2.0:
6
+ run: app
data/.gitignore CHANGED
@@ -3,7 +3,6 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
- Gemfile.lock
7
6
  InstalledFiles
8
7
  _yardoc
9
8
  coverage
data/Dockerfile ADDED
@@ -0,0 +1,20 @@
1
+ FROM ruby:2.5.1
2
+ LABEL maintainer="x@rubynerd.net"
3
+
4
+ RUN bundle config --global frozen 1
5
+
6
+ WORKDIR /usr/src/app
7
+
8
+ COPY lib/firebell/version.rb lib/firebell/version.rb
9
+ COPY Gemfile Gemfile.lock firebell.gemspec ./
10
+ RUN pwd
11
+ RUN find .
12
+ RUN echo $PATH
13
+ RUN find /usr/local/bundle/bin
14
+ RUN bundle install --verbose
15
+
16
+ RUN find /usr/local/bundle/bin
17
+
18
+ COPY . .
19
+
20
+ CMD ['ruby']
data/Gemfile.lock ADDED
@@ -0,0 +1,39 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ firebell (0.3.2)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.3)
10
+ metaclass (0.0.4)
11
+ mocha (1.5.0)
12
+ metaclass (~> 0.0.1)
13
+ rake (12.3.1)
14
+ rspec (3.7.0)
15
+ rspec-core (~> 3.7.0)
16
+ rspec-expectations (~> 3.7.0)
17
+ rspec-mocks (~> 3.7.0)
18
+ rspec-core (3.7.1)
19
+ rspec-support (~> 3.7.0)
20
+ rspec-expectations (3.7.0)
21
+ diff-lcs (>= 1.2.0, < 2.0)
22
+ rspec-support (~> 3.7.0)
23
+ rspec-mocks (3.7.0)
24
+ diff-lcs (>= 1.2.0, < 2.0)
25
+ rspec-support (~> 3.7.0)
26
+ rspec-support (3.7.1)
27
+
28
+ PLATFORMS
29
+ ruby
30
+
31
+ DEPENDENCIES
32
+ bundler (~> 1.5)
33
+ firebell!
34
+ mocha
35
+ rake
36
+ rspec
37
+
38
+ BUNDLED WITH
39
+ 1.16.1
@@ -0,0 +1,2 @@
1
+ app:
2
+ build: .
data/firebell.gemspec CHANGED
@@ -1,12 +1,12 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'firebell/version'
2
+ # lib = File.expand_path('../lib', __FILE__)
3
+ # $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require './lib/firebell/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "firebell"
8
8
  spec.version = Firebell::VERSION
9
- spec.authors = ["Luke Carpenter"]
9
+ spec.authors = ["@rubynerd"]
10
10
  spec.email = ["x@rubynerd.net"]
11
11
  spec.summary = %q{Push notifications as a service}
12
12
  spec.description = %q{A ruby client for https://firebellapp.com - push notifications as a service}
@@ -8,17 +8,10 @@ class Firebell::Client
8
8
  @token = token
9
9
  end
10
10
 
11
- def notify(tag, body_or_params = nil, body = nil)
12
- if body_or_params
13
- if body_or_params.is_a?(Hash)
14
- attributes = { "tag" => tag, "parameters" => body_or_params }
15
- attributes.merge!("body" => body) if body
16
- else
17
- attributes = { "tag" => tag, "body" => body_or_params }
18
- end
19
- else
20
- attributes = { "tag" => tag }
21
- end
11
+ def notify(tag:, body: nil, params: {})
12
+ attributes = { tag: tag }
13
+ attributes.merge!(params: params) if params.any?
14
+ attributes.merge!(body: body) if body
22
15
 
23
16
  send_request attributes if requestable?
24
17
  end
@@ -26,12 +19,15 @@ class Firebell::Client
26
19
  private
27
20
  def send_request(attrs)
28
21
  if @token
29
- request = Net::HTTP::Post.new uri.request_uri, "Authorization" => "Token #{@token}"
22
+ request = Net::HTTP::Post.new uri.request_uri, "Authorization" => "Token #{@token}", "Content-Type" => "application/json"
30
23
  request.body = JSON.generate attrs
31
24
 
32
25
  response = http.request(request)
33
- if response.code.to_i == 201
26
+
27
+ if response['Content-Type'] == "application/json"
34
28
  JSON.parse response.body
29
+ else
30
+ response.body
35
31
  end
36
32
  else
37
33
  raise Firebell::NoTokenError
@@ -1,3 +1,3 @@
1
1
  module Firebell
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -16,35 +16,35 @@ describe Firebell::Client do
16
16
 
17
17
  context "with a tag and body" do
18
18
  it "makes a request" do
19
- Firebell::Client.any_instance.expects(:send_request).with("tag" => "test.subject", "body" => "hello")
20
- client.notify "test.subject", "hello"
19
+ Firebell::Client.any_instance.expects(:send_request).with(tag: "test.subject", body: "hello")
20
+ client.notify tag: "test.subject", body: "hello"
21
21
  end
22
22
  end
23
23
 
24
24
  context "with a tag and parameters" do
25
25
  it "makes a request" do
26
26
  Firebell::Client.any_instance.expects(:send_request)
27
- .with("tag" => "test.subject", "parameters" => { "p1" => 1 })
27
+ .with(tag: "test.subject", params: { "p1" => 1 })
28
28
 
29
- client.notify "test.subject", "p1" => 1
29
+ client.notify tag: "test.subject", params: { "p1" => 1 }
30
30
  end
31
31
  end
32
32
 
33
33
  context "with a tag, parameters, and body" do
34
34
  it "makes a request" do
35
35
  Firebell::Client.any_instance.expects(:send_request)
36
- .with("tag" => "test.subject", "parameters" => { "p1" => 1 }, "body" => "hello")
36
+ .with(tag: "test.subject", params: { "p1" => 1 }, body: "hello")
37
37
 
38
- client.notify "test.subject", { "p1" => 1 }, "hello"
38
+ client.notify tag: "test.subject", params: { "p1" => 1 }, body: "hello"
39
39
  end
40
40
  end
41
41
 
42
42
  context "with just a tag" do
43
43
  it "makes a request" do
44
44
  Firebell::Client.any_instance.expects(:send_request)
45
- .with("tag" => "test.subject")
45
+ .with(tag: "test.subject")
46
46
 
47
- client.notify "test.subject"
47
+ client.notify tag: "test.subject"
48
48
  end
49
49
  end
50
50
 
@@ -57,9 +57,9 @@ describe Firebell::Client do
57
57
 
58
58
  it "makes a request" do
59
59
  Firebell::Client.any_instance.expects(:send_request)
60
- .with("tag" => "test.subject")
60
+ .with(tag: "test.subject")
61
61
 
62
- client.notify "test.subject"
62
+ client.notify tag: "test.subject"
63
63
  end
64
64
  end
65
65
 
@@ -72,7 +72,7 @@ describe Firebell::Client do
72
72
  it "makes a request" do
73
73
  Firebell::Client.any_instance.expects(:send_request).never
74
74
 
75
- client.notify "test.subject"
75
+ client.notify tag: "test.subject"
76
76
  end
77
77
  end
78
78
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firebell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
- - Luke Carpenter
7
+ - "@rubynerd"
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-05 00:00:00.000000000 Z
11
+ date: 2018-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -73,12 +73,16 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
+ - ".buildkite/pipeline.yml"
76
77
  - ".gitignore"
77
78
  - ".rspec"
79
+ - Dockerfile
78
80
  - Gemfile
81
+ - Gemfile.lock
79
82
  - LICENSE.txt
80
83
  - README.md
81
84
  - Rakefile
85
+ - docker-compose.yml
82
86
  - env.rb
83
87
  - firebell.gemspec
84
88
  - lib/firebell.rb
@@ -108,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
112
  version: '0'
109
113
  requirements: []
110
114
  rubyforge_project:
111
- rubygems_version: 2.2.2
115
+ rubygems_version: 2.7.6
112
116
  signing_key:
113
117
  specification_version: 4
114
118
  summary: Push notifications as a service