ruby_fs 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # develop
2
2
 
3
+ # 1.0.2
4
+ * Bugfix: Interpret API responses correctly
5
+
3
6
  # 1.0.1
4
7
  * Bugfix: Bump celluloid dependency
5
8
 
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # RubyFS [![Build Status](https://secure.travis-ci.org/adhearsion/ruby_fs.png?branch=master)](http://travis-ci.org/adhearsion/ruby_fs)
2
2
  RubyFS is a FreeSWITCH EventSocket client library in Ruby and based on Celluloid actors with the sole purpose of providing a connection to the EventSocket API. RubyFS does not provide any features beyond connection management and protocol parsing. Actions are sent over the wire, and responses come back via callbacks. It's up to you to match these up into something useful. In this regard, RubyFS is very similar to [Blather](https://github.com/sprsquish/blather) for XMPP or [Punchblock](https://github.com/adhearsion/punchblock), the Ruby 3PCC library. In fact, Punchblock uses RubyFS under the covers for its FreeSWITCH implementation.
3
3
 
4
+ NB: If you're looking to develop an application on FreeSWITCH, you should take a look at the [Adhearsion](http://adhearsion.com) framework first. This library is much lower level.
5
+
4
6
  ## Installation
5
7
  gem install ruby_fs
6
8
 
@@ -152,11 +152,12 @@ module RubyFS
152
152
  end
153
153
 
154
154
  def receive_request(headers, content)
155
+ content.strip!
155
156
  case headers[:content_type]
156
157
  when 'text/event-json'
157
158
  fire_event Event.new(headers, json_content_2_hash(content))
158
- when 'command/reply'
159
- @command_callbacks.pop.call CommandReply.new(headers)
159
+ when 'command/reply', 'api/response'
160
+ @command_callbacks.pop.call CommandReply.new(headers, (content == '' ? nil : content))
160
161
  when 'auth/request'
161
162
  command "auth #{@secret}" do
162
163
  command! "event json ALL" if @events
@@ -1,3 +1,3 @@
1
1
  module RubyFS
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -165,12 +165,14 @@ foo-bar: doo_dah
165
165
  it "can send API commands and returns the response" do
166
166
  expect_connected_event
167
167
  expect_disconnected_event
168
- reply = CommandReply.new(:content_type => 'command/reply', :reply_text => '+OK accepted')
168
+ reply = CommandReply.new({:content_type => 'api/response', :content_length => '41'}, '+OK 396dd34a-10ba-11e2-b64a-37a9f8360f21')
169
169
  mocked_server(1, lambda { |server| @stream.api('foo').should == reply }) do |val, server|
170
170
  val.should == "api foo\n\n"
171
171
  server.send_data %Q(
172
- Content-Type: command/reply
173
- Reply-Text: +OK accepted
172
+ Content-Type: api/response
173
+ Content-Length: 41
174
+
175
+ +OK 396dd34a-10ba-11e2-b64a-37a9f8360f21
174
176
 
175
177
  )
176
178
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_fs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-05 00:00:00.000000000 Z
12
+ date: 2012-11-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: celluloid-io
@@ -247,7 +247,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
247
247
  version: '0'
248
248
  segments:
249
249
  - 0
250
- hash: -3554104999927593934
250
+ hash: 3964546558106237063
251
251
  required_rubygems_version: !ruby/object:Gem::Requirement
252
252
  none: false
253
253
  requirements:
@@ -256,7 +256,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
256
256
  version: '0'
257
257
  segments:
258
258
  - 0
259
- hash: -3554104999927593934
259
+ hash: 3964546558106237063
260
260
  requirements: []
261
261
  rubyforge_project: ruby_fs
262
262
  rubygems_version: 1.8.23