esendex 0.2.3 → 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.
- data/app/controllers/esendex/application_controller.rb +4 -0
- data/app/controllers/esendex/inbound_messages_controller.rb +12 -0
- data/app/controllers/esendex/message_delivered_events_controller.rb +12 -0
- data/app/controllers/esendex/message_failed_events_controller.rb +12 -0
- data/app/controllers/esendex/push_notification_handler.rb +42 -0
- data/config/routes.rb +5 -0
- data/lib/esendex.rb +26 -10
- data/lib/esendex/engine.rb +5 -0
- data/lib/esendex/hash_serialisation.rb +24 -0
- data/lib/esendex/inbound_message.rb +31 -0
- data/lib/esendex/message_delivered_event.rb +30 -0
- data/lib/esendex/message_failed_event.rb +30 -0
- data/lib/esendex/version.rb +1 -1
- data/licence.txt +24 -0
- data/readme.md +101 -9
- data/spec/controllers/message_delivered_events_controller_spec.rb +30 -0
- data/spec/controllers/push_notification_handler_spec.rb +97 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +66 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/log/test.log +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/hash_serialisation_spec.rb +53 -0
- data/spec/inbound_message_spec.rb +43 -0
- data/spec/message_delivered_event_spec.rb +33 -0
- data/spec/message_failed_event_spec.rb +33 -0
- data/spec/spec_helper.rb +14 -3
- metadata +85 -6
- data/LICENSE.txt +0 -20
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe InboundMessage do
|
4
|
+
describe ".from_xml" do
|
5
|
+
let(:id) { random_string }
|
6
|
+
let(:message_id) { random_string }
|
7
|
+
let(:account_id) { random_string }
|
8
|
+
let(:message_text) { random_string }
|
9
|
+
let(:from) { random_mobile }
|
10
|
+
let(:to) { random_mobile }
|
11
|
+
let(:source) {
|
12
|
+
"<InboundMessage>
|
13
|
+
<Id>#{id}</Id>
|
14
|
+
<MessageId>#{message_id}</MessageId>
|
15
|
+
<AccountId>#{account_id}</AccountId>
|
16
|
+
<MessageText>#{message_text}</MessageText>
|
17
|
+
<From>#{from}</From>
|
18
|
+
<To>#{to}</To>
|
19
|
+
</InboundMessage>"
|
20
|
+
}
|
21
|
+
|
22
|
+
subject { InboundMessage.from_xml source }
|
23
|
+
|
24
|
+
it "should set the id" do
|
25
|
+
subject.id.should eq(id)
|
26
|
+
end
|
27
|
+
it "should set the message_id" do
|
28
|
+
subject.message_id.should eq(message_id)
|
29
|
+
end
|
30
|
+
it "should set the account_id" do
|
31
|
+
subject.account_id.should eq(account_id)
|
32
|
+
end
|
33
|
+
it "should set the message_text" do
|
34
|
+
subject.message_text.should eq(message_text)
|
35
|
+
end
|
36
|
+
it "should set the from" do
|
37
|
+
subject.from.should eq(from)
|
38
|
+
end
|
39
|
+
it "should set the to" do
|
40
|
+
subject.to.should eq(to)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MessageDeliveredEvent do
|
4
|
+
describe ".from_xml" do
|
5
|
+
let(:id) { random_string }
|
6
|
+
let(:message_id) { random_string }
|
7
|
+
let(:account_id) { random_string }
|
8
|
+
let(:occurred_at) { random_time.utc }
|
9
|
+
let(:source) {
|
10
|
+
"<MessageDelivered>
|
11
|
+
<Id>#{id}</Id>
|
12
|
+
<MessageId>#{message_id}</MessageId>
|
13
|
+
<AccountId>#{account_id}</AccountId>
|
14
|
+
<OccurredAt>#{occurred_at.strftime("%Y-%m-%dT%H:%M:%S")}</OccurredAt>
|
15
|
+
</MessageDelivered>"
|
16
|
+
}
|
17
|
+
|
18
|
+
subject { MessageDeliveredEvent.from_xml source }
|
19
|
+
|
20
|
+
it "should set the id" do
|
21
|
+
subject.id.should eq(id)
|
22
|
+
end
|
23
|
+
it "should set the message_id" do
|
24
|
+
subject.message_id.should eq(message_id)
|
25
|
+
end
|
26
|
+
it "should set the account_id" do
|
27
|
+
subject.account_id.should eq(account_id)
|
28
|
+
end
|
29
|
+
it "should set the occurred_at" do
|
30
|
+
subject.occurred_at.to_i.should eq(occurred_at.to_i)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MessageFailedEvent do
|
4
|
+
describe ".from_xml" do
|
5
|
+
let(:id) { random_string }
|
6
|
+
let(:message_id) { random_string }
|
7
|
+
let(:account_id) { random_string }
|
8
|
+
let(:occurred_at) { random_time.utc }
|
9
|
+
let(:source) {
|
10
|
+
"<MessageFailed>
|
11
|
+
<Id>#{id}</Id>
|
12
|
+
<MessageId>#{message_id}</MessageId>
|
13
|
+
<AccountId>#{account_id}</AccountId>
|
14
|
+
<OccurredAt>#{occurred_at.strftime("%Y-%m-%dT%H:%M:%S")}</OccurredAt>
|
15
|
+
</MessageFailed>"
|
16
|
+
}
|
17
|
+
|
18
|
+
subject { MessageFailedEvent.from_xml source }
|
19
|
+
|
20
|
+
it "should set the id" do
|
21
|
+
subject.id.should eq(id)
|
22
|
+
end
|
23
|
+
it "should set the message_id" do
|
24
|
+
subject.message_id.should eq(message_id)
|
25
|
+
end
|
26
|
+
it "should set the account_id" do
|
27
|
+
subject.account_id.should eq(account_id)
|
28
|
+
end
|
29
|
+
it "should set the occurred_at" do
|
30
|
+
subject.occurred_at.to_i.should eq(occurred_at.to_i)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,14 +1,21 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'rspec'
|
3
3
|
|
4
|
-
|
4
|
+
# Configure Rails Environment
|
5
|
+
ENV["RAILS_ENV"] = "test"
|
6
|
+
|
7
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
8
|
+
require 'rspec/rails'
|
9
|
+
|
10
|
+
Rails.backtrace_cleaner.remove_silencers!
|
11
|
+
|
12
|
+
require_relative "../lib/esendex"
|
13
|
+
include Esendex
|
5
14
|
|
6
15
|
RSpec.configure do |config|
|
7
16
|
config.color = true
|
8
17
|
end
|
9
18
|
|
10
|
-
include Esendex
|
11
|
-
|
12
19
|
def random_string
|
13
20
|
(0...24).map{ ('a'..'z').to_a[rand(26)] }.join
|
14
21
|
end
|
@@ -23,4 +30,8 @@ end
|
|
23
30
|
|
24
31
|
def random_mobile
|
25
32
|
"447#{"%09d" % rand(999999999)}"
|
33
|
+
end
|
34
|
+
|
35
|
+
def random_time
|
36
|
+
Time.now + rand(9999)
|
26
37
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: esendex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
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: 2013-
|
12
|
+
date: 2013-03-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nestful
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.0.
|
21
|
+
version: 0.0.7
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.0.
|
29
|
+
version: 0.0.7
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: nokogiri
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -49,23 +49,68 @@ email:
|
|
49
49
|
executables: []
|
50
50
|
extensions: []
|
51
51
|
extra_rdoc_files:
|
52
|
-
-
|
52
|
+
- licence.txt
|
53
53
|
- readme.md
|
54
54
|
files:
|
55
|
+
- app/controllers/esendex/application_controller.rb
|
56
|
+
- app/controllers/esendex/inbound_messages_controller.rb
|
57
|
+
- app/controllers/esendex/message_delivered_events_controller.rb
|
58
|
+
- app/controllers/esendex/message_failed_events_controller.rb
|
59
|
+
- app/controllers/esendex/push_notification_handler.rb
|
60
|
+
- config/routes.rb
|
55
61
|
- lib/esendex/account.rb
|
56
62
|
- lib/esendex/api_connection.rb
|
63
|
+
- lib/esendex/engine.rb
|
57
64
|
- lib/esendex/exceptions.rb
|
65
|
+
- lib/esendex/hash_serialisation.rb
|
66
|
+
- lib/esendex/inbound_message.rb
|
58
67
|
- lib/esendex/message.rb
|
59
68
|
- lib/esendex/message_batch_submission.rb
|
69
|
+
- lib/esendex/message_delivered_event.rb
|
70
|
+
- lib/esendex/message_failed_event.rb
|
60
71
|
- lib/esendex/railtie.rb
|
61
72
|
- lib/esendex/version.rb
|
62
73
|
- lib/esendex.rb
|
63
74
|
- lib/tasks/esendex.rake
|
64
|
-
-
|
75
|
+
- licence.txt
|
65
76
|
- readme.md
|
66
77
|
- spec/account_spec.rb
|
67
78
|
- spec/api_connection_spec.rb
|
79
|
+
- spec/controllers/message_delivered_events_controller_spec.rb
|
80
|
+
- spec/controllers/push_notification_handler_spec.rb
|
81
|
+
- spec/dummy/app/assets/javascripts/application.js
|
82
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
83
|
+
- spec/dummy/app/controllers/application_controller.rb
|
84
|
+
- spec/dummy/app/helpers/application_helper.rb
|
85
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
86
|
+
- spec/dummy/config/application.rb
|
87
|
+
- spec/dummy/config/boot.rb
|
88
|
+
- spec/dummy/config/environment.rb
|
89
|
+
- spec/dummy/config/environments/development.rb
|
90
|
+
- spec/dummy/config/environments/production.rb
|
91
|
+
- spec/dummy/config/environments/test.rb
|
92
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
93
|
+
- spec/dummy/config/initializers/inflections.rb
|
94
|
+
- spec/dummy/config/initializers/mime_types.rb
|
95
|
+
- spec/dummy/config/initializers/secret_token.rb
|
96
|
+
- spec/dummy/config/initializers/session_store.rb
|
97
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
98
|
+
- spec/dummy/config/locales/en.yml
|
99
|
+
- spec/dummy/config/routes.rb
|
100
|
+
- spec/dummy/config.ru
|
101
|
+
- spec/dummy/log/test.log
|
102
|
+
- spec/dummy/public/404.html
|
103
|
+
- spec/dummy/public/422.html
|
104
|
+
- spec/dummy/public/500.html
|
105
|
+
- spec/dummy/public/favicon.ico
|
106
|
+
- spec/dummy/Rakefile
|
107
|
+
- spec/dummy/README.rdoc
|
108
|
+
- spec/dummy/script/rails
|
109
|
+
- spec/hash_serialisation_spec.rb
|
110
|
+
- spec/inbound_message_spec.rb
|
68
111
|
- spec/message_batch_submission_spec.rb
|
112
|
+
- spec/message_delivered_event_spec.rb
|
113
|
+
- spec/message_failed_event_spec.rb
|
69
114
|
- spec/message_spec.rb
|
70
115
|
- spec/spec_helper.rb
|
71
116
|
homepage: http://developers.esendex.com
|
@@ -95,6 +140,40 @@ summary: Gem for interacting with the Esendex API
|
|
95
140
|
test_files:
|
96
141
|
- spec/account_spec.rb
|
97
142
|
- spec/api_connection_spec.rb
|
143
|
+
- spec/controllers/message_delivered_events_controller_spec.rb
|
144
|
+
- spec/controllers/push_notification_handler_spec.rb
|
145
|
+
- spec/dummy/app/assets/javascripts/application.js
|
146
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
147
|
+
- spec/dummy/app/controllers/application_controller.rb
|
148
|
+
- spec/dummy/app/helpers/application_helper.rb
|
149
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
150
|
+
- spec/dummy/config/application.rb
|
151
|
+
- spec/dummy/config/boot.rb
|
152
|
+
- spec/dummy/config/environment.rb
|
153
|
+
- spec/dummy/config/environments/development.rb
|
154
|
+
- spec/dummy/config/environments/production.rb
|
155
|
+
- spec/dummy/config/environments/test.rb
|
156
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
157
|
+
- spec/dummy/config/initializers/inflections.rb
|
158
|
+
- spec/dummy/config/initializers/mime_types.rb
|
159
|
+
- spec/dummy/config/initializers/secret_token.rb
|
160
|
+
- spec/dummy/config/initializers/session_store.rb
|
161
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
162
|
+
- spec/dummy/config/locales/en.yml
|
163
|
+
- spec/dummy/config/routes.rb
|
164
|
+
- spec/dummy/config.ru
|
165
|
+
- spec/dummy/log/test.log
|
166
|
+
- spec/dummy/public/404.html
|
167
|
+
- spec/dummy/public/422.html
|
168
|
+
- spec/dummy/public/500.html
|
169
|
+
- spec/dummy/public/favicon.ico
|
170
|
+
- spec/dummy/Rakefile
|
171
|
+
- spec/dummy/README.rdoc
|
172
|
+
- spec/dummy/script/rails
|
173
|
+
- spec/hash_serialisation_spec.rb
|
174
|
+
- spec/inbound_message_spec.rb
|
98
175
|
- spec/message_batch_submission_spec.rb
|
176
|
+
- spec/message_delivered_event_spec.rb
|
177
|
+
- spec/message_failed_event_spec.rb
|
99
178
|
- spec/message_spec.rb
|
100
179
|
- spec/spec_helper.rb
|
data/LICENSE.txt
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2011 Esendex
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|