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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd03aab2f252c52edc3cfffe5d961c5c11969186
4
- data.tar.gz: 5628686bc64d830a1624f63a798f90f9374b6349
3
+ metadata.gz: 65b9eb7da885c09645279a948daa4a61dfe74d7b
4
+ data.tar.gz: f9f45910ae96e042306d4d900ecb6a849802c3b3
5
5
  SHA512:
6
- metadata.gz: 22c953d027651ba60ae09c5ec203131885fdc1aaf9fa95b4bcf1959244f7b4111f988d75e4945a211d241050b65800da82b6cca3dbdaa40918e39e0a8d8113e3
7
- data.tar.gz: 50e829ace42d49d3d2225900c23d7a13e21adbfc74bf8b546f9a92d96b79bfb8adf4040740706cfd85b7d87f773bc4fd3faf3058a56d9eacf050a52367e4a04e
6
+ metadata.gz: 874a4d581a8c49727c1f54fd480d609d8af262c643eac4883c3ddeba794ec3188e3887614db1c54993b6ecd7658a37e0514a6fd1d672bd4b4a0aa3dfa3ab22b6
7
+ data.tar.gz: bc4f9e8a874b86b7ca4199267ce1eaaad762d3d5c172b61e55ba80bb12055887bfc309f21b2bfbc313bddeac1458b00403625dd4be4ba9a76672053ad246cba4
checksums.yaml.gz.sig CHANGED
Binary file
data/.travis.yml CHANGED
@@ -7,7 +7,6 @@ rvm:
7
7
  - 2.1.0
8
8
  - 2.0.0
9
9
  - 1.9.3
10
- - 1.9.2
11
10
  - ruby-head
12
11
  script: bundle exec rspec
13
12
  notifications:
data/Rakefile CHANGED
@@ -1 +1,4 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+ RSpec::Core::RakeTask.new(:spec)
4
+ task default: :spec
data/Readme.md CHANGED
@@ -4,3 +4,21 @@ A 𝕋𝔼𝕃𝔼𝕏 client
4
4
  [![Gem Version](https://badge.fury.io/rb/minitel.svg)](http://badge.fury.io/rb/minitel)
5
5
  [![Build Status](https://travis-ci.org/heroku/minitel.svg?branch=master)](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
@@ -1,3 +1,8 @@
1
+ 0.3.0 2014-10-21
2
+ ================
3
+
4
+ Add Client#add_followup for adding followup to a previous notification
5
+
1
6
  0.2.0 2014-10-10
2
7
  ================
3
8
 
@@ -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: "/producer/messages",
40
- body: MultiJson.dump(message),
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
@@ -1,3 +1,3 @@
1
1
  module Minitel
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
data/lib/minitel.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'securerandom'
1
2
  require 'minitel/version'
2
3
  require 'minitel/client'
3
4
  require 'minitel/strict_args'
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', ">= 0.20"
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
@@ -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.2.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-10 00:00:00.000000000 Z
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