punchblock 2.3.0 → 2.3.1
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
- data/.travis.yml +1 -3
- data/CHANGELOG.md +4 -0
- data/Gemfile +0 -1
- data/lib/punchblock/command_node.rb +5 -0
- data/lib/punchblock/component/component_node.rb +3 -0
- data/lib/punchblock/connection/xmpp.rb +4 -4
- data/lib/punchblock/version.rb +1 -1
- data/lib/punchblock.rb +4 -0
- data/punchblock.gemspec +1 -1
- data/spec/punchblock/command_node_spec.rb +1 -0
- data/spec/punchblock/connection/xmpp_spec.rb +29 -6
- data/spec/spec_helper.rb +5 -0
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9e6afe18610ec58e92290615347d829d84df0f35
|
|
4
|
+
data.tar.gz: 67ab1a85edc0cb9603f47739e661a6cd5f13492e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 204717279e74f4f6c892c2a832e2e81ac947473011e2249a7b5fc3cf7847dc133ea3eb7dccf61523898a9c79ef3e913f96562414b48477c2e668d52b67b9b17e
|
|
7
|
+
data.tar.gz: a7465ef83df1050746b6eb1c6e47b04ca8d9f68fdf29a51ebc96958940e69b868410a9459535b6e961c4206277764f0fe9bc9cfa903fb7c3dc68f1934cf40c76
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# [develop](https://github.com/adhearsion/punchblock)
|
|
2
2
|
|
|
3
|
+
# [v2.3.1](https://github.com/adhearsion/punchblock/compare/v2.3.0...v2.3.1) - [2014-02-13](https://rubygems.org/gems/punchblock/versions/2.3.1)
|
|
4
|
+
* Bugfix: Ensure commands can be associated on the wire even before they're executed
|
|
5
|
+
* Bugfix: Ensure a command is always transitioned to is requested state prior to receiving a response
|
|
6
|
+
|
|
3
7
|
# [v2.3.0](https://github.com/adhearsion/punchblock/compare/v2.2.2...v2.3.0) - [2014-01-30](https://rubygems.org/gems/punchblock/versions/2.3.0)
|
|
4
8
|
* Feature: Add input-timers-started event
|
|
5
9
|
* Feature: Allow client to send XMPP messages through Blather
|
data/Gemfile
CHANGED
|
@@ -4,6 +4,8 @@ require 'state_machine'
|
|
|
4
4
|
module Punchblock
|
|
5
5
|
class CommandNode < RayoNode
|
|
6
6
|
|
|
7
|
+
attribute :request_id, String, default: ->(*) { Punchblock.new_request_id }
|
|
8
|
+
|
|
7
9
|
def initialize(*args)
|
|
8
10
|
super
|
|
9
11
|
@response = FutureResource.new
|
|
@@ -31,6 +33,9 @@ module Punchblock
|
|
|
31
33
|
return if @response.set_yet?
|
|
32
34
|
@response.resource = other
|
|
33
35
|
execute!
|
|
36
|
+
rescue StateMachine::InvalidTransition => e
|
|
37
|
+
e.message << " for command #{self}"
|
|
38
|
+
raise e
|
|
34
39
|
rescue FutureResource::ResourceAlreadySetException
|
|
35
40
|
end
|
|
36
41
|
end # CommandNode
|
|
@@ -45,6 +45,7 @@ module Punchblock
|
|
|
45
45
|
|
|
46
46
|
def write(command, options = {})
|
|
47
47
|
iq = prep_command_for_execution command, options
|
|
48
|
+
command.request!
|
|
48
49
|
client.write_with_handler iq do |response|
|
|
49
50
|
if response.result?
|
|
50
51
|
handle_iq_result response, command
|
|
@@ -52,7 +53,6 @@ module Punchblock
|
|
|
52
53
|
handle_error response, command
|
|
53
54
|
end
|
|
54
55
|
end
|
|
55
|
-
command.request!
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
def prep_command_for_execution(command, options = {})
|
|
@@ -64,7 +64,7 @@ module Punchblock
|
|
|
64
64
|
if command.is_a?(Command::Join) && command.mixer_name
|
|
65
65
|
@joined_mixers << command.mixer_name
|
|
66
66
|
end
|
|
67
|
-
create_iq(jid_for_command(command)).tap do |iq|
|
|
67
|
+
create_iq(jid_for_command(command), command.request_id).tap do |iq|
|
|
68
68
|
command.to_rayo(iq)
|
|
69
69
|
end
|
|
70
70
|
end
|
|
@@ -183,8 +183,8 @@ module Punchblock
|
|
|
183
183
|
end
|
|
184
184
|
end
|
|
185
185
|
|
|
186
|
-
def create_iq(jid
|
|
187
|
-
Blather::Stanza::Iq.new :set, jid
|
|
186
|
+
def create_iq(jid, id)
|
|
187
|
+
Blather::Stanza::Iq.new :set, jid, id
|
|
188
188
|
end
|
|
189
189
|
end
|
|
190
190
|
end
|
data/lib/punchblock/version.rb
CHANGED
data/lib/punchblock.rb
CHANGED
data/punchblock.gemspec
CHANGED
|
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
|
|
|
23
23
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.7") if s.respond_to? :required_rubygems_version=
|
|
24
24
|
|
|
25
25
|
s.add_runtime_dependency %q<nokogiri>, ["~> 1.5", ">= 1.5.6"]
|
|
26
|
-
s.add_runtime_dependency %q<blather>, ["
|
|
26
|
+
s.add_runtime_dependency %q<blather>, ["~> 1.0"]
|
|
27
27
|
s.add_runtime_dependency %q<activesupport>, [">= 3.0.0", "< 5.0.0"]
|
|
28
28
|
s.add_runtime_dependency %q<state_machine>, ["~> 1.0"]
|
|
29
29
|
s.add_runtime_dependency %q<future-resource>, ["~> 1.0"]
|
|
@@ -104,8 +104,35 @@ module Punchblock
|
|
|
104
104
|
output.component_id.should be == 'fgh4590'
|
|
105
105
|
end
|
|
106
106
|
|
|
107
|
+
let(:client) { connection.send :client }
|
|
108
|
+
before { client.stub :write }
|
|
109
|
+
|
|
110
|
+
describe "sending a command" do
|
|
111
|
+
let(:command) { Punchblock::Command::Answer.new request_id: 'fooobarrr', target_call_id: 'foo', domain: 'bar.com' }
|
|
112
|
+
|
|
113
|
+
it "should write an IQ containing the command to the socket" do
|
|
114
|
+
client.should_receive(:write).once.with do |stanza|
|
|
115
|
+
stanza.should be_a Blather::Stanza::Iq
|
|
116
|
+
stanza.to.should be == 'foo@bar.com'
|
|
117
|
+
stanza.type.should be == :set
|
|
118
|
+
end
|
|
119
|
+
connection.write command
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
it "should put the command in a requested state" do
|
|
123
|
+
connection.write command
|
|
124
|
+
command.should be_requested
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
it "should use the command's request_id as the ID id" do
|
|
128
|
+
client.should_receive(:write).once.with do |stanza|
|
|
129
|
+
stanza.id.should be == 'fooobarrr'
|
|
130
|
+
end
|
|
131
|
+
connection.write command
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
107
135
|
it 'should send a "Chat" presence when ready' do
|
|
108
|
-
client = connection.send :client
|
|
109
136
|
client.should_receive(:write).once.with do |stanza|
|
|
110
137
|
stanza.to.should be == 'rayo.net'
|
|
111
138
|
stanza.should be_a Blather::Stanza::Presence::Status
|
|
@@ -115,7 +142,6 @@ module Punchblock
|
|
|
115
142
|
end
|
|
116
143
|
|
|
117
144
|
it 'should send a "Do Not Disturb" presence when not_ready' do
|
|
118
|
-
client = connection.send :client
|
|
119
145
|
client.should_receive(:write).once.with do |stanza|
|
|
120
146
|
stanza.to.should be == 'rayo.net'
|
|
121
147
|
stanza.should be_a Blather::Stanza::Presence::Status
|
|
@@ -126,7 +152,6 @@ module Punchblock
|
|
|
126
152
|
|
|
127
153
|
describe '#send_message' do
|
|
128
154
|
it 'should send a "normal" message to the given user and domain' do
|
|
129
|
-
client = connection.send :client
|
|
130
155
|
client.should_receive(:write).once.with do |stanza|
|
|
131
156
|
stanza.to.should be == 'someone@example.org'
|
|
132
157
|
stanza.should be_a Blather::Stanza::Message
|
|
@@ -138,7 +163,6 @@ module Punchblock
|
|
|
138
163
|
end
|
|
139
164
|
|
|
140
165
|
it 'should default to the root domain' do
|
|
141
|
-
client = connection.send :client
|
|
142
166
|
client.should_receive(:write).once.with do |stanza|
|
|
143
167
|
stanza.to.should be == 'someone@rayo.net'
|
|
144
168
|
end
|
|
@@ -146,7 +170,6 @@ module Punchblock
|
|
|
146
170
|
end
|
|
147
171
|
|
|
148
172
|
it 'should send a message with the given subject' do
|
|
149
|
-
client = connection.send :client
|
|
150
173
|
client.should_receive(:write).once.with do |stanza|
|
|
151
174
|
stanza.subject.should be == "Important Message"
|
|
152
175
|
end
|
|
@@ -350,7 +373,7 @@ module Punchblock
|
|
|
350
373
|
describe "receiving events from a mixer" do
|
|
351
374
|
context "after joining the mixer" do
|
|
352
375
|
before do
|
|
353
|
-
|
|
376
|
+
client.should_receive :write_with_handler
|
|
354
377
|
subject.write Command::Join.new(:mixer_name => 'foomixer')
|
|
355
378
|
end
|
|
356
379
|
|
data/spec/spec_helper.rb
CHANGED
|
@@ -24,6 +24,11 @@ RSpec.configure do |config|
|
|
|
24
24
|
Punchblock.logger.define_singleton_method :trace, Punchblock.logger.method(:debug)
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
+
config.before do
|
|
28
|
+
@uuid = SecureRandom.uuid
|
|
29
|
+
Punchblock.stub new_request_id: @uuid
|
|
30
|
+
end
|
|
31
|
+
|
|
27
32
|
config.after :each do
|
|
28
33
|
if defined?(:Celluloid)
|
|
29
34
|
Celluloid.shutdown
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: punchblock
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.3.
|
|
4
|
+
version: 2.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jason Goecke
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2014-
|
|
13
|
+
date: 2014-02-13 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: nokogiri
|
|
@@ -36,16 +36,16 @@ dependencies:
|
|
|
36
36
|
name: blather
|
|
37
37
|
requirement: !ruby/object:Gem::Requirement
|
|
38
38
|
requirements:
|
|
39
|
-
- - "
|
|
39
|
+
- - "~>"
|
|
40
40
|
- !ruby/object:Gem::Version
|
|
41
|
-
version:
|
|
41
|
+
version: '1.0'
|
|
42
42
|
type: :runtime
|
|
43
43
|
prerelease: false
|
|
44
44
|
version_requirements: !ruby/object:Gem::Requirement
|
|
45
45
|
requirements:
|
|
46
|
-
- - "
|
|
46
|
+
- - "~>"
|
|
47
47
|
- !ruby/object:Gem::Version
|
|
48
|
-
version:
|
|
48
|
+
version: '1.0'
|
|
49
49
|
- !ruby/object:Gem::Dependency
|
|
50
50
|
name: activesupport
|
|
51
51
|
requirement: !ruby/object:Gem::Requirement
|