nexmo 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,7 +20,7 @@ module Nexmo
20
20
  def send_message(data)
21
21
  response = @http.post('/sms/json', encode(data), headers)
22
22
 
23
- if response.code.to_i == 200 && response['Content-Type'] == 'application/json'
23
+ if response.code.to_i == 200 && response['Content-Type'].sub(/;.*/, '') == 'application/json'
24
24
  object = JSON.parse(response.body)['messages'].first
25
25
 
26
26
  status = object['status'].to_i
@@ -28,7 +28,7 @@ module Nexmo
28
28
  if status == 0
29
29
  Success.new(object['message-id'])
30
30
  else
31
- Failure.new(Error.new("#{object['error-text']} (status=#{status})"), response)
31
+ Failure.new(Error.new("#{object['error-text']} (status=#{status})"), response, status)
32
32
  end
33
33
  else
34
34
  Failure.new(Error.new("Unexpected HTTP response (code=#{response.code})"), response)
@@ -52,7 +52,7 @@ module Nexmo
52
52
  end
53
53
  end
54
54
 
55
- class Failure < Struct.new(:error, :http)
55
+ class Failure < Struct.new(:error, :http, :status)
56
56
  def success?
57
57
  false
58
58
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'nexmo'
3
- s.version = '0.3.0'
3
+ s.version = '0.3.1'
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.authors = ['Tim Craft']
6
6
  s.email = ['mail@timcraft.com']
@@ -28,7 +28,7 @@ describe Nexmo::Client do
28
28
 
29
29
  it 'should make the correct http call and return a success object if the first message status equals 0' do
30
30
  http_response = stub(:code => '200', :body => '{"messages":[{"status":0,"message-id":"id"}]}')
31
- http_response.expects(:[]).with('Content-Type').returns('application/json')
31
+ http_response.expects(:[]).with('Content-Type').returns('application/json;charset=utf-8')
32
32
 
33
33
  data = 'from=ruby&to=number&text=Hey%21&username=key&password=secret'
34
34
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nexmo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-27 00:00:00.000000000 Z
12
+ date: 2012-05-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &3132970 !ruby/object:Gem::Requirement
16
+ requirement: &3095740 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '1.5'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *3132970
24
+ version_requirements: *3095740
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: mocha
27
- requirement: &3132770 !ruby/object:Gem::Requirement
27
+ requirement: &3095540 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *3132770
35
+ version_requirements: *3095540
36
36
  description: A simple wrapper for the Nexmo API
37
37
  email:
38
38
  - mail@timcraft.com