smsified 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,7 +30,7 @@ puts result.data.inspect
30
30
  puts result.http.inspect
31
31
 
32
32
  # Get some of your sent SMS details
33
- result = smsified.search_sms 'startDate=2011-02-14&endDate=2011-02-15'
33
+ result = smsified.search_sms 'start=2011-02-14&end=2011-02-15'
34
34
  puts result.data.inspect
35
35
  puts result.data.inspect
36
36
 
@@ -1,6 +1,6 @@
1
1
  module Smsified
2
2
  SMSIFIED_ONEAPI_PUBLIC_URI = 'https://api.smsified.com/v1'
3
- SMSIFIED_HTTP_HEADERS = { 'Content-Type' => 'application/x-www-form-urlencoded' }
3
+ SMSIFIED_HTTP_HEADERS = { 'Content-Type' => 'application/x-www-form-urlencoded','Accept'=>'application/json' }
4
4
 
5
5
  class OneAPI
6
6
  include Helpers
@@ -44,7 +44,7 @@ module Smsified
44
44
 
45
45
  options[:sender_address] = options[:sender_address] || @sender_address
46
46
 
47
- Response.new self.class.get("/smsmessaging/outbound/#{options[:sender_address]}/requests/#{options[:request_id]}/deliveryInfos", :basic_auth => @auth)
47
+ Response.new self.class.get("/smsmessaging/outbound/#{options[:sender_address]}/requests/#{options[:request_id]}/deliveryInfos", :basic_auth => @auth, :headers => SMSIFIED_HTTP_HEADERS)
48
48
  end
49
49
 
50
50
  ##
@@ -55,7 +55,7 @@ module Smsified
55
55
  # @example
56
56
  # reporting.retrieve_sms '74ae6147f915eabf87b35b9ea30c5916'
57
57
  def retrieve_sms(message_id)
58
- Response.new self.class.get("/messages/#{message_id}", :basic_auth => @auth)
58
+ Response.new self.class.get("/messages/#{message_id}", :basic_auth => @auth, :headers => SMSIFIED_HTTP_HEADERS)
59
59
  end
60
60
 
61
61
  ##
@@ -64,9 +64,9 @@ module Smsified
64
64
  # @param [required, String] query_string to search SMS messages for
65
65
  # @return [Object] A Response Object with http and data instance methods
66
66
  # @example
67
- # reporting.search_sms 'startDate=2011-02-14&endDate=2011-02-15'
67
+ # reporting.search_sms 'start=2011-02-14&end=2011-02-15'
68
68
  def search_sms(query_string)
69
- Response.new self.class.get("/messages?#{query_string}", :basic_auth => @auth)
69
+ Response.new self.class.get("/messages?#{query_string}", :basic_auth => @auth, :headers => SMSIFIED_HTTP_HEADERS)
70
70
  end
71
71
  end
72
72
  end
@@ -48,7 +48,10 @@ module Smsified
48
48
 
49
49
  Response.new self.class.post("/smsmessaging/inbound/subscriptions",
50
50
  :basic_auth => @auth,
51
- :body => camelcase_keys(query))
51
+ :body => camelcase_keys(query),
52
+ :headers => SMSIFIED_HTTP_HEADERS
53
+ )
54
+
52
55
  end
53
56
 
54
57
  ##
@@ -64,7 +67,9 @@ module Smsified
64
67
  def create_outbound_subscription(sender_address, options)
65
68
  Response.new self.class.post("/smsmessaging/outbound/#{sender_address}/subscriptions",
66
69
  :basic_auth => @auth,
67
- :body => build_query_string(options))
70
+ :body => build_query_string(options),
71
+ :headers => SMSIFIED_HTTP_HEADERS
72
+ )
68
73
  end
69
74
 
70
75
  ##
@@ -75,7 +80,7 @@ module Smsified
75
80
  # @example
76
81
  # subscriptions.delete_inbound_subscription('89edd71c1c7f3d349f9a3a4d5d2d410c')
77
82
  def delete_inbound_subscription(subscription_id)
78
- Response.new self.class.delete("/smsmessaging/inbound/subscriptions/#{subscription_id}", :basic_auth => @auth)
83
+ Response.new self.class.delete("/smsmessaging/inbound/subscriptions/#{subscription_id}", :basic_auth => @auth, :headers => SMSIFIED_HTTP_HEADERS)
79
84
  end
80
85
 
81
86
  ##
@@ -86,7 +91,7 @@ module Smsified
86
91
  # @example
87
92
  # subscriptions.delete_outbound_subscription('89edd71c1c7f3d349f9a3a4d5d2d410c')
88
93
  def delete_outbound_subscription(sender_address)
89
- Response.new self.class.delete("/smsmessaging/outbound/subscriptions/#{sender_address}", :basic_auth => @auth)
94
+ Response.new self.class.delete("/smsmessaging/outbound/subscriptions/#{sender_address}", :basic_auth => @auth, :headers => SMSIFIED_HTTP_HEADERS)
90
95
  end
91
96
 
92
97
  ##
@@ -97,7 +102,7 @@ module Smsified
97
102
  # @example
98
103
  # subscriptions.inbound_subscriptions('tel:+14155551212')
99
104
  def inbound_subscriptions(destination_address)
100
- Response.new self.class.get("/smsmessaging/inbound/subscriptions?destinationAddress=#{destination_address}", :basic_auth => @auth)
105
+ Response.new self.class.get("/smsmessaging/inbound/subscriptions?destinationAddress=#{destination_address}", :basic_auth => @auth, :headers => SMSIFIED_HTTP_HEADERS)
101
106
  end
102
107
 
103
108
  ##
@@ -108,7 +113,7 @@ module Smsified
108
113
  # @example
109
114
  # subscriptions.outbound_subscriptions('tel:+14155551212')
110
115
  def outbound_subscriptions(sender_address)
111
- Response.new self.class.get("/smsmessaging/outbound/subscriptions?senderAddress=#{sender_address}", :basic_auth => @auth)
116
+ Response.new self.class.get("/smsmessaging/outbound/subscriptions?senderAddress=#{sender_address}", :basic_auth => @auth, :headers => SMSIFIED_HTTP_HEADERS)
112
117
  end
113
118
 
114
119
  ##
@@ -125,7 +130,9 @@ module Smsified
125
130
  def update_inbound_subscription(subscription_id, options)
126
131
  Response.new self.class.post("/smsmessaging/inbound/subscriptions/#{subscription_id}",
127
132
  :basic_auth => @auth,
128
- :body => build_query_string(options))
133
+ :body => build_query_string(options),
134
+ :headers => SMSIFIED_HTTP_HEADERS
135
+ )
129
136
  end
130
137
 
131
138
  ##
@@ -142,7 +149,9 @@ module Smsified
142
149
  def update_outbound_subscription(sender_address, options)
143
150
  Response.new self.class.post("/smsmessaging/outbound/#{sender_address}/subscriptions",
144
151
  :basic_auth => @auth,
145
- :body => build_query_string(options))
152
+ :body => build_query_string(options),
153
+ :headers => SMSIFIED_HTTP_HEADERS
154
+ )
146
155
  end
147
156
  end
148
157
  end
@@ -118,7 +118,7 @@ describe "Smsified" do
118
118
  it "Should send an SMS" do
119
119
  response = @one_api.send_sms(:address => @address, :message => 'Hola from RSpec!', :sender_address => @sender_address)
120
120
  response.data.should eql @message_sent
121
- FakeWeb.last_request.body.should eql "message=Hola+from+RSpec%21&address=14155551212"
121
+ FakeWeb.last_request.body.should eql "address=14155551212&message=Hola+from+RSpec%21"
122
122
  end
123
123
 
124
124
  it "Should send an SMS to multiple destinations" do
@@ -126,7 +126,7 @@ describe "Smsified" do
126
126
  :message => 'Hola from RSpec!',
127
127
  :sender_address => @sender_address)
128
128
  response.data.should eql @message_sent
129
- FakeWeb.last_request.body.should eql "message=Hola+from+RSpec%21&address=14155551212&address=13035551212"
129
+ FakeWeb.last_request.body.should eql "address=14155551212&address=13035551212&message=Hola+from+RSpec%21"
130
130
  end
131
131
 
132
132
  it "Should raise an error if you pass an unknown method name" do
@@ -403,8 +403,9 @@ describe "Smsified" do
403
403
  :body => @message.to_json)
404
404
 
405
405
  FakeWeb.register_uri(:get,
406
- "https://#{@username}:#{@password}@api.smsified.com/v1/messages?startDate=2011-05-12&endDate=2011-05-12",
406
+ "https://#{@username}:#{@password}@api.smsified.com/v1/messages?start=2011-05-12&end=2011-05-12",
407
407
  :status => ["200", "OK"],
408
+ :content_type=>"application/json",
408
409
  :body => @message_range.to_json)
409
410
 
410
411
  FakeWeb.register_uri(:get,
@@ -438,6 +439,11 @@ describe "Smsified" do
438
439
  end
439
440
  end
440
441
 
442
+ it "should get json by default" do
443
+ response = @reporting.search_sms 'start=2011-05-12&end=2011-05-12'
444
+ response.http.content_type.should eql "application/json"
445
+ end
446
+
441
447
  it "Should raise an error if no :sender_address specified" do
442
448
  begin
443
449
  @reporting.delivery_status('foobar')
@@ -464,7 +470,7 @@ describe "Smsified" do
464
470
  end
465
471
 
466
472
  it "Should retrieve SMS messages based on a query string" do
467
- response = @reporting.search_sms 'startDate=2011-05-12&endDate=2011-05-12'
473
+ response = @reporting.search_sms 'start=2011-05-12&end=2011-05-12'
468
474
  response.data.should eql @message_range
469
475
  end
470
476
 
metadata CHANGED
@@ -1,167 +1,126 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: smsified
3
- version: !ruby/object:Gem::Version
4
- hash: 23
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.7
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 6
10
- version: 0.1.6
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Jason Goecke
9
+ - John Dyer
14
10
  autorequire:
15
11
  bindir: bin
16
12
  cert_chain: []
17
-
18
- date: 2011-07-05 00:00:00 -07:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- prerelease: false
23
- type: :development
24
- requirement: &id001 !ruby/object:Gem::Requirement
13
+ date: 2011-08-30 00:00:00.000000000Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rspec
17
+ requirement: &70254480066540 !ruby/object:Gem::Requirement
25
18
  none: false
26
- requirements:
19
+ requirements:
27
20
  - - ~>
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 2
32
- - 3
33
- - 0
21
+ - !ruby/object:Gem::Version
34
22
  version: 2.3.0
35
- version_requirements: *id001
36
- name: rspec
37
- - !ruby/object:Gem::Dependency
38
- prerelease: false
39
23
  type: :development
40
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ prerelease: false
25
+ version_requirements: *70254480066540
26
+ - !ruby/object:Gem::Dependency
27
+ name: yard
28
+ requirement: &70254480066020 !ruby/object:Gem::Requirement
41
29
  none: false
42
- requirements:
30
+ requirements:
43
31
  - - ~>
44
- - !ruby/object:Gem::Version
45
- hash: 7
46
- segments:
47
- - 0
48
- - 6
49
- - 0
32
+ - !ruby/object:Gem::Version
50
33
  version: 0.6.0
51
- version_requirements: *id002
52
- name: yard
53
- - !ruby/object:Gem::Dependency
54
- prerelease: false
55
34
  type: :development
56
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ prerelease: false
36
+ version_requirements: *70254480066020
37
+ - !ruby/object:Gem::Dependency
38
+ name: bundler
39
+ requirement: &70254480065540 !ruby/object:Gem::Requirement
57
40
  none: false
58
- requirements:
41
+ requirements:
59
42
  - - ~>
60
- - !ruby/object:Gem::Version
61
- hash: 23
62
- segments:
63
- - 1
64
- - 0
65
- - 0
43
+ - !ruby/object:Gem::Version
66
44
  version: 1.0.0
67
- version_requirements: *id003
68
- name: bundler
69
- - !ruby/object:Gem::Dependency
70
- prerelease: false
71
45
  type: :development
72
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ prerelease: false
47
+ version_requirements: *70254480065540
48
+ - !ruby/object:Gem::Dependency
49
+ name: jeweler
50
+ requirement: &70254480065060 !ruby/object:Gem::Requirement
73
51
  none: false
74
- requirements:
52
+ requirements:
75
53
  - - ~>
76
- - !ruby/object:Gem::Version
77
- hash: 7
78
- segments:
79
- - 1
80
- - 5
81
- - 2
54
+ - !ruby/object:Gem::Version
82
55
  version: 1.5.2
83
- version_requirements: *id004
84
- name: jeweler
85
- - !ruby/object:Gem::Dependency
86
- prerelease: false
87
56
  type: :development
88
- requirement: &id005 !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- hash: 3
94
- segments:
95
- - 0
96
- version: "0"
97
- version_requirements: *id005
98
- name: rcov
99
- - !ruby/object:Gem::Dependency
100
57
  prerelease: false
101
- type: :development
102
- requirement: &id006 !ruby/object:Gem::Requirement
58
+ version_requirements: *70254480065060
59
+ - !ruby/object:Gem::Dependency
60
+ name: rcov
61
+ requirement: &70254480064560 !ruby/object:Gem::Requirement
103
62
  none: false
104
- requirements:
105
- - - ">="
106
- - !ruby/object:Gem::Version
107
- hash: 3
108
- segments:
109
- - 0
110
- version: "0"
111
- version_requirements: *id006
112
- name: fakeweb
113
- - !ruby/object:Gem::Dependency
114
- prerelease: false
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
115
67
  type: :development
116
- requirement: &id007 !ruby/object:Gem::Requirement
117
- none: false
118
- requirements:
119
- - - ">="
120
- - !ruby/object:Gem::Version
121
- hash: 3
122
- segments:
123
- - 0
124
- version: "0"
125
- version_requirements: *id007
126
- name: awesome_print
127
- - !ruby/object:Gem::Dependency
128
68
  prerelease: false
69
+ version_requirements: *70254480064560
70
+ - !ruby/object:Gem::Dependency
71
+ name: fakeweb
72
+ requirement: &70254480064080 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
129
78
  type: :development
130
- requirement: &id008 !ruby/object:Gem::Requirement
79
+ prerelease: false
80
+ version_requirements: *70254480064080
81
+ - !ruby/object:Gem::Dependency
82
+ name: awesome_print
83
+ requirement: &70254480063600 !ruby/object:Gem::Requirement
131
84
  none: false
132
- requirements:
133
- - - ">="
134
- - !ruby/object:Gem::Version
135
- hash: 3
136
- segments:
137
- - 0
138
- version: "0"
139
- version_requirements: *id008
140
- name: json
141
- - !ruby/object:Gem::Dependency
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ type: :development
142
90
  prerelease: false
143
- type: :runtime
144
- requirement: &id009 !ruby/object:Gem::Requirement
91
+ version_requirements: *70254480063600
92
+ - !ruby/object:Gem::Dependency
93
+ name: json
94
+ requirement: &70254480063100 !ruby/object:Gem::Requirement
145
95
  none: false
146
- requirements:
147
- - - ">="
148
- - !ruby/object:Gem::Version
149
- hash: 3
150
- segments:
151
- - 0
152
- version: "0"
153
- version_requirements: *id009
96
+ requirements:
97
+ - - ! '>='
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ type: :development
101
+ prerelease: false
102
+ version_requirements: *70254480063100
103
+ - !ruby/object:Gem::Dependency
154
104
  name: httparty
105
+ requirement: &70254480062560 !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ type: :runtime
112
+ prerelease: false
113
+ version_requirements: *70254480062560
155
114
  description: Gem for consuming the SMSified OneAPI
156
- email: jsgoecke@voxeo.com
115
+ email:
116
+ - jsgoecke@voxeo.com
117
+ - jdyer@voxeo.com
157
118
  executables: []
158
-
159
119
  extensions: []
160
-
161
- extra_rdoc_files:
120
+ extra_rdoc_files:
162
121
  - LICENSE.txt
163
122
  - README.md
164
- files:
123
+ files:
165
124
  - README.md
166
125
  - lib/smsified.rb
167
126
  - lib/smsified/helpers.rb
@@ -174,41 +133,35 @@ files:
174
133
  - examples/sending_and_subscribing.rb
175
134
  - spec/smsified_spec.rb
176
135
  - spec/spec_helper.rb
177
- has_rdoc: true
178
136
  homepage: http://github.com/tropo/smsified-oneapi
179
- licenses:
137
+ licenses:
180
138
  - MIT
181
139
  post_install_message:
182
140
  rdoc_options: []
183
-
184
- require_paths:
141
+ require_paths:
185
142
  - lib
186
- required_ruby_version: !ruby/object:Gem::Requirement
143
+ required_ruby_version: !ruby/object:Gem::Requirement
187
144
  none: false
188
- requirements:
189
- - - ">="
190
- - !ruby/object:Gem::Version
191
- hash: 3
192
- segments:
145
+ requirements:
146
+ - - ! '>='
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ segments:
193
150
  - 0
194
- version: "0"
195
- required_rubygems_version: !ruby/object:Gem::Requirement
151
+ hash: 3692374572593381168
152
+ required_rubygems_version: !ruby/object:Gem::Requirement
196
153
  none: false
197
- requirements:
198
- - - ">="
199
- - !ruby/object:Gem::Version
200
- hash: 3
201
- segments:
202
- - 0
203
- version: "0"
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
204
158
  requirements: []
205
-
206
159
  rubyforge_project:
207
- rubygems_version: 1.5.0
160
+ rubygems_version: 1.8.6
208
161
  signing_key:
209
162
  specification_version: 3
210
163
  summary: Gem for consuming the SMSified OneAPI
211
- test_files:
164
+ test_files:
212
165
  - examples/sending_and_subscribing.rb
213
166
  - spec/smsified_spec.rb
214
167
  - spec/spec_helper.rb