minitel 0.2.0 β 0.3.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.travis.yml +0 -1
- data/Rakefile +3 -0
- data/Readme.md +18 -0
- data/changelog.txt +5 -0
- data/lib/minitel/client.rb +14 -2
- data/lib/minitel/version.rb +1 -1
- data/lib/minitel.rb +1 -0
- data/minitel.gemspec +3 -1
- data/spec/minitel/client_spec.rb +27 -0
- data.tar.gz.sig +0 -0
- metadata +30 -8
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65b9eb7da885c09645279a948daa4a61dfe74d7b
|
4
|
+
data.tar.gz: f9f45910ae96e042306d4d900ecb6a849802c3b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 874a4d581a8c49727c1f54fd480d609d8af262c643eac4883c3ddeba794ec3188e3887614db1c54993b6ecd7658a37e0514a6fd1d672bd4b4a0aa3dfa3ab22b6
|
7
|
+
data.tar.gz: bc4f9e8a874b86b7ca4199267ce1eaaad762d3d5c172b61e55ba80bb12055887bfc309f21b2bfbc313bddeac1458b00403625dd4be4ba9a76672053ad246cba4
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/.travis.yml
CHANGED
data/Rakefile
CHANGED
data/Readme.md
CHANGED
@@ -4,3 +4,21 @@ A ππΌππΌπ client
|
|
4
4
|
[](http://badge.fury.io/rb/minitel)
|
5
5
|
[](https://travis-ci.org/heroku/minitel)
|
6
6
|
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
``` ruby
|
10
|
+
require 'minitel'
|
11
|
+
# create a client
|
12
|
+
client = Minitel::Client.new("https://user:pass@telex.heroku.com")
|
13
|
+
|
14
|
+
# send a notifcation to the owner and collaborators of an app
|
15
|
+
client.notify_app(app_uuid: '...', title: 'Something happened', body: 'here are the details')
|
16
|
+
# => {"id"=>"uuid of message"}
|
17
|
+
|
18
|
+
# send a notifcation to a user
|
19
|
+
client.notify_user(user_uuid: '...', title: 'Something happened', body: 'here are the details')
|
20
|
+
# => {"id"=>"uuid of message"}
|
21
|
+
|
22
|
+
# add folloup to a previous notificaiton
|
23
|
+
client.notify_user(message_uuid: '...', body: 'here are even more details')
|
24
|
+
```
|
data/changelog.txt
CHANGED
data/lib/minitel/client.rb
CHANGED
@@ -26,6 +26,13 @@ module Minitel
|
|
26
26
|
post_message('user', args[:user_uuid], args[:title], args[:body])
|
27
27
|
end
|
28
28
|
|
29
|
+
def add_followup(args)
|
30
|
+
StrictArgs.enforce(args, [:message_uuid, :body], :message_uuid)
|
31
|
+
followup = { body: args[:body] }
|
32
|
+
|
33
|
+
post("/producer/messages/#{args[:message_uuid]}/followups", followup)
|
34
|
+
end
|
35
|
+
|
29
36
|
private
|
30
37
|
|
31
38
|
def post_message(type, id, title, body)
|
@@ -35,12 +42,17 @@ module Minitel
|
|
35
42
|
target: {type: type, id: id}
|
36
43
|
}
|
37
44
|
|
45
|
+
post("/producer/messages", message)
|
46
|
+
end
|
47
|
+
|
48
|
+
def post(path, body)
|
38
49
|
response = connection.post(
|
39
|
-
path:
|
40
|
-
body: MultiJson.dump(
|
50
|
+
path: path,
|
51
|
+
body: MultiJson.dump(body),
|
41
52
|
expects: 201)
|
42
53
|
|
43
54
|
MultiJson.load(response.body)
|
44
55
|
end
|
56
|
+
|
45
57
|
end
|
46
58
|
end
|
data/lib/minitel/version.rb
CHANGED
data/lib/minitel.rb
CHANGED
data/minitel.gemspec
CHANGED
@@ -17,8 +17,10 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.platform = Gem::Platform::RUBY
|
18
18
|
gem.license = "MIT"
|
19
19
|
|
20
|
-
gem.add_runtime_dependency 'excon', '~> 0
|
20
|
+
gem.add_runtime_dependency 'excon', '~> 0.20'
|
21
21
|
gem.add_runtime_dependency 'multi_json', '~> 1.0'
|
22
22
|
|
23
|
+
gem.add_development_dependency 'guard', '~> 2.6'
|
24
|
+
gem.add_development_dependency 'guard-rspec', '~> 4.3'
|
23
25
|
gem.add_development_dependency 'rspec', '~> 3.0'
|
24
26
|
end
|
data/spec/minitel/client_spec.rb
CHANGED
@@ -87,3 +87,30 @@ describe Minitel::Client, '#notify_user' do
|
|
87
87
|
expect(result['success']).to eq(true)
|
88
88
|
end
|
89
89
|
end
|
90
|
+
|
91
|
+
describe Minitel::Client, '#add_followup' do
|
92
|
+
let(:defaults) { {body: 'a body', message_uuid: SecureRandom.uuid} }
|
93
|
+
let(:client) { Minitel::Client.new('https://u:p@h.com') }
|
94
|
+
|
95
|
+
before do
|
96
|
+
request = {path: "/producer/messages/#{defaults[:message_uuid]}/followups", method: :post}
|
97
|
+
response = {status: 201, body: MultiJson.dump({'success' => true})}
|
98
|
+
body = MultiJson.dump({
|
99
|
+
body: 'a body',
|
100
|
+
})
|
101
|
+
|
102
|
+
Excon.stub(request.merge(body: body), response)
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'posts a proper json body to the producer messages endpoint' do
|
106
|
+
expect{ client.add_followup(defaults) }.to_not raise_error
|
107
|
+
|
108
|
+
unstubbed_body = defaults.merge({message_uuid: SecureRandom.uuid})
|
109
|
+
expect{ client.add_followup(unstubbed_body) }.to raise_error(Excon::Errors::StubNotFound)
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'returns a parsed json response' do
|
113
|
+
result = client.add_followup(defaults)
|
114
|
+
expect(result['success']).to eq(true)
|
115
|
+
end
|
116
|
+
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Will Leinweber
|
@@ -28,16 +28,13 @@ cert_chain:
|
|
28
28
|
5bkhRfJHSD/uX/cHbjmopLRbPlHrGbZTDIP4VEC5l0QLPiZ1nhKQnf3+U0+FSy2o
|
29
29
|
CCngcLCR6q+mLf+A4L54VxmyrtFpcBfmkU72QYyf3vJ9QipL3XbvJvbpPkWSn1DX
|
30
30
|
-----END CERTIFICATE-----
|
31
|
-
date: 2014-10-
|
31
|
+
date: 2014-10-21 00:00:00.000000000 Z
|
32
32
|
dependencies:
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: excon
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '0'
|
40
|
-
- - ">="
|
41
38
|
- !ruby/object:Gem::Version
|
42
39
|
version: '0.20'
|
43
40
|
type: :runtime
|
@@ -45,9 +42,6 @@ dependencies:
|
|
45
42
|
version_requirements: !ruby/object:Gem::Requirement
|
46
43
|
requirements:
|
47
44
|
- - "~>"
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '0'
|
50
|
-
- - ">="
|
51
45
|
- !ruby/object:Gem::Version
|
52
46
|
version: '0.20'
|
53
47
|
- !ruby/object:Gem::Dependency
|
@@ -64,6 +58,34 @@ dependencies:
|
|
64
58
|
- - "~>"
|
65
59
|
- !ruby/object:Gem::Version
|
66
60
|
version: '1.0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: guard
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '2.6'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '2.6'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: guard-rspec
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '4.3'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '4.3'
|
67
89
|
- !ruby/object:Gem::Dependency
|
68
90
|
name: rspec
|
69
91
|
requirement: !ruby/object:Gem::Requirement
|
metadata.gz.sig
CHANGED
Binary file
|