ifttt_push 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 +1 -0
- data/.rspec +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +38 -0
- data/README.md +3 -0
- data/ifttt_push.gemspec +13 -0
- data/lib/ifttt_push.rb +27 -0
- data/lib/ifttt_push/configuration.rb +9 -0
- data/spec/ifttt_push/configuration_spec.rb +10 -0
- data/spec/ifttt_push_spec.rb +37 -0
- data/spec/spec_helper.rb +15 -0
- metadata +55 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 8c1601125f7b91fe4d74d96e8444ddcdfecaa33c64a21c8f369fc85bba0e2640
|
|
4
|
+
data.tar.gz: d2c11a204f5c6cd44c8d6622fc91009f27e59a9e604c231a03ae14efb0710347
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 67b1afcc8ea6e0072d543478d1e9d92fae9f169c64df748f78f958306c6eaf22561dfc9b25f5dd92a911b04b1e14b4c2bacf96299fa2c4836a9f343c52bf40fa
|
|
7
|
+
data.tar.gz: a120d7aab0516a658405865504dcd18c586b1715c921baaad5b0395c4ca960e0f7d6f83951383cacf2897c85e2beeafd23f2c3086f5a3df1a051ec69d63045c2
|
data/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*.gem
|
data/.rspec
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--require spec_helper
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
GEM
|
|
2
|
+
remote: https://rubygems.org/
|
|
3
|
+
specs:
|
|
4
|
+
addressable (2.5.2)
|
|
5
|
+
public_suffix (>= 2.0.2, < 4.0)
|
|
6
|
+
crack (0.4.3)
|
|
7
|
+
safe_yaml (~> 1.0.0)
|
|
8
|
+
diff-lcs (1.3)
|
|
9
|
+
hashdiff (0.3.7)
|
|
10
|
+
public_suffix (3.0.2)
|
|
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
|
+
safe_yaml (1.0.4)
|
|
25
|
+
webmock (3.4.1)
|
|
26
|
+
addressable (>= 2.3.6)
|
|
27
|
+
crack (>= 0.3.2)
|
|
28
|
+
hashdiff
|
|
29
|
+
|
|
30
|
+
PLATFORMS
|
|
31
|
+
ruby
|
|
32
|
+
|
|
33
|
+
DEPENDENCIES
|
|
34
|
+
rspec
|
|
35
|
+
webmock
|
|
36
|
+
|
|
37
|
+
BUNDLED WITH
|
|
38
|
+
1.16.1
|
data/README.md
ADDED
data/ifttt_push.gemspec
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Gem::Specification.new do |s|
|
|
2
|
+
s.name = 'ifttt_push'
|
|
3
|
+
s.version = '0.1.0'
|
|
4
|
+
s.date = '2018-05-07'
|
|
5
|
+
s.summary = "A simple wrapper for my own push notification service using ifttt.com"
|
|
6
|
+
s.description = "This provides a common interface for a simple push notification using ifttt.com. You will have to sign up there and get a key."
|
|
7
|
+
s.authors = ["Nicolas Heinig"]
|
|
8
|
+
s.email = 'nheinig@gmx.net'
|
|
9
|
+
s.files = `git ls-files`.split("\n")
|
|
10
|
+
s.homepage =
|
|
11
|
+
'http://rubygems.org/gems/ifttt_push'
|
|
12
|
+
s.license = 'MIT'
|
|
13
|
+
end
|
data/lib/ifttt_push.rb
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require 'ifttt_push/configuration'
|
|
2
|
+
require 'net/http'
|
|
3
|
+
require 'json'
|
|
4
|
+
|
|
5
|
+
module IftttPush
|
|
6
|
+
class << self
|
|
7
|
+
attr_accessor :configuration
|
|
8
|
+
|
|
9
|
+
def configure
|
|
10
|
+
self.configuration ||= Configuration.new
|
|
11
|
+
yield(configuration)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def notify(title:, message:, link_url:)
|
|
15
|
+
body = {
|
|
16
|
+
value1: title,
|
|
17
|
+
value2: message,
|
|
18
|
+
value3: link_url
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
uri = URI.parse('https://maker.ifttt.com:80/trigger/push_notification/with/key/' + self.configuration.key)
|
|
22
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
23
|
+
|
|
24
|
+
http.post(uri.path, body.to_json, "Content-Type" => "application/json")
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe IftttPush do
|
|
4
|
+
describe "#configure" do
|
|
5
|
+
before do
|
|
6
|
+
IftttPush.configure do |config|
|
|
7
|
+
config.key = 'mytestapikey'
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it 'stores the configuration' do
|
|
12
|
+
expect(IftttPush.configuration.key).to eq('mytestapikey')
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
describe '#notify' do
|
|
17
|
+
before do
|
|
18
|
+
stub_request(:post, %r{http://maker.ifttt.com})
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
subject do
|
|
22
|
+
IftttPush.notify(
|
|
23
|
+
title: 'Something happens!',
|
|
24
|
+
message: 'Hey look at this, maybe it is imporant',
|
|
25
|
+
link_url: 'http://example.com/'
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it 'makes the request' do
|
|
30
|
+
subject
|
|
31
|
+
|
|
32
|
+
expect(
|
|
33
|
+
a_request(:post, %{http://maker.ifttt.com/trigger/push_notification/with/key/mytestapikey})
|
|
34
|
+
).to have_been_made
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'ifttt_push'
|
|
2
|
+
|
|
3
|
+
require 'webmock/rspec'
|
|
4
|
+
|
|
5
|
+
RSpec.configure do |config|
|
|
6
|
+
config.expect_with :rspec do |expectations|
|
|
7
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
config.mock_with :rspec do |mocks|
|
|
11
|
+
mocks.verify_partial_doubles = true
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
|
15
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: ifttt_push
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Nicolas Heinig
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2018-05-07 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: This provides a common interface for a simple push notification using
|
|
14
|
+
ifttt.com. You will have to sign up there and get a key.
|
|
15
|
+
email: nheinig@gmx.net
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- ".gitignore"
|
|
21
|
+
- ".rspec"
|
|
22
|
+
- Gemfile
|
|
23
|
+
- Gemfile.lock
|
|
24
|
+
- README.md
|
|
25
|
+
- ifttt_push.gemspec
|
|
26
|
+
- lib/ifttt_push.rb
|
|
27
|
+
- lib/ifttt_push/configuration.rb
|
|
28
|
+
- spec/ifttt_push/configuration_spec.rb
|
|
29
|
+
- spec/ifttt_push_spec.rb
|
|
30
|
+
- spec/spec_helper.rb
|
|
31
|
+
homepage: http://rubygems.org/gems/ifttt_push
|
|
32
|
+
licenses:
|
|
33
|
+
- MIT
|
|
34
|
+
metadata: {}
|
|
35
|
+
post_install_message:
|
|
36
|
+
rdoc_options: []
|
|
37
|
+
require_paths:
|
|
38
|
+
- lib
|
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
40
|
+
requirements:
|
|
41
|
+
- - ">="
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: '0'
|
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
45
|
+
requirements:
|
|
46
|
+
- - ">="
|
|
47
|
+
- !ruby/object:Gem::Version
|
|
48
|
+
version: '0'
|
|
49
|
+
requirements: []
|
|
50
|
+
rubyforge_project:
|
|
51
|
+
rubygems_version: 2.7.6
|
|
52
|
+
signing_key:
|
|
53
|
+
specification_version: 4
|
|
54
|
+
summary: A simple wrapper for my own push notification service using ifttt.com
|
|
55
|
+
test_files: []
|