ermaker_ting 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/ting/pushover.rb +17 -0
- data/lib/ting/version.rb +1 -1
- data/spec/lib/ting/pushover_spec.rb +38 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30f01a879adb90ad153c5277aedf092fb049fc9f
|
4
|
+
data.tar.gz: 1709cee5122c79416c40aae25305bae9e192d4d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 880bba6fce0a939f08a13332ee3ae200c76e9022ed67cf90b1609e6fbf96dab10394d86c9e41eea98895b1cbd52bb8178886580cbf2d6974ff7ccdd8c45a2405
|
7
|
+
data.tar.gz: e10812392b823f85af45151799b363a90f9453736ea9f10392b8f24ea38e2f6fe28d303450d0a79ebad5babc53695d32dc403c59084bc10a1126b95a2f6f1b1e
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ermaker_ting (0.0.
|
4
|
+
ermaker_ting (0.0.2)
|
5
5
|
httparty
|
6
6
|
|
7
7
|
GEM
|
@@ -60,7 +60,7 @@ GEM
|
|
60
60
|
guard (~> 2.1)
|
61
61
|
rspec (>= 2.14, < 4.0)
|
62
62
|
hirb (0.7.1)
|
63
|
-
httparty (0.
|
63
|
+
httparty (0.13.0)
|
64
64
|
json (~> 1.8)
|
65
65
|
multi_xml (>= 0.5.2)
|
66
66
|
i18n (0.6.9)
|
data/lib/ting/pushover.rb
CHANGED
@@ -10,7 +10,24 @@ module Ting
|
|
10
10
|
|
11
11
|
def notify **options
|
12
12
|
options = @@options.merge options
|
13
|
+
options = manipulate options
|
13
14
|
HTTParty.post('https://api.pushover.net/1/messages.json', body: options)
|
14
15
|
end
|
16
|
+
|
17
|
+
def manipulate_detail **options
|
18
|
+
if options.has_key?(:detail) && options.has_key?(:detail_server)
|
19
|
+
options[:url] = HTTParty.post(
|
20
|
+
options[:detail_server],
|
21
|
+
body: {detail: options[:detail]}).body
|
22
|
+
end
|
23
|
+
options.delete :detail_server
|
24
|
+
options.delete:detail
|
25
|
+
options
|
26
|
+
end
|
27
|
+
|
28
|
+
def manipulate **options
|
29
|
+
options = manipulate_detail options
|
30
|
+
options
|
31
|
+
end
|
15
32
|
end
|
16
33
|
end
|
data/lib/ting/version.rb
CHANGED
@@ -14,17 +14,50 @@ describe Ting::Pushover do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'gets valid options' do
|
17
|
-
|
17
|
+
subject.notify
|
18
18
|
FakeWeb.last_request.body.should == ''
|
19
|
-
|
19
|
+
subject.notify(a:1)
|
20
20
|
FakeWeb.last_request.body.should == 'a=1'
|
21
21
|
Ting::Pushover.config(a:1)
|
22
|
-
|
22
|
+
subject.notify(a:1)
|
23
23
|
FakeWeb.last_request.body.should == 'a=1'
|
24
|
-
|
24
|
+
subject.notify(a:2)
|
25
25
|
FakeWeb.last_request.body.should == 'a=2'
|
26
|
-
|
26
|
+
subject.notify(b:2)
|
27
27
|
FakeWeb.last_request.body.should == 'a=1&b=2'
|
28
28
|
end
|
29
|
+
|
30
|
+
it 'calls #manipulate' do
|
31
|
+
subject.should_receive(:manipulate).once
|
32
|
+
subject.notify
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe '#manipulate' do
|
37
|
+
it 'calls #manipulate_detail' do
|
38
|
+
subject.should_receive(:manipulate_detail).once
|
39
|
+
subject.manipulate
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe '#manipulate_detail' do
|
44
|
+
before do
|
45
|
+
FakeWeb.allow_net_connect = false
|
46
|
+
FakeWeb.register_uri(
|
47
|
+
:post,
|
48
|
+
'http://detail.server.com/path',
|
49
|
+
body:'http://detail.server.com/path/1')
|
50
|
+
end
|
51
|
+
after do
|
52
|
+
FakeWeb.clean_registry
|
53
|
+
FakeWeb.allow_net_connect = true
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'works with detail related options' do
|
57
|
+
subject.manipulate(
|
58
|
+
detail_server: 'http://detail.server.com/path',
|
59
|
+
detail:'test',
|
60
|
+
).should == {url: 'http://detail.server.com/path/1'}
|
61
|
+
end
|
29
62
|
end
|
30
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ermaker_ting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Minwoo Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|