messagemedia-soap 0.6.4 → 0.6.5
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 +8 -8
- data/lib/messagemedia/soap/message.rb +8 -1
- data/lib/messagemedia/soap/recipient.rb +0 -23
- data/lib/messagemedia/soap/version.rb +1 -1
- data/test/test_message.rb +13 -11
- metadata +2 -4
- data/test/test_recipient.rb +0 -26
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDg4Y2JhNzk4OTM1MWMwZWM0NDdkMmRkNWNhM2NmNmVlYzg4NGMyNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
N2QxOGQ1OWI1MWNlZWI2NzlmNzZlMDBmOTUwY2E5YTVhYmZkZjYzMw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDg3M2ViNDJlNmNiNGFmNTNkNGFkN2VhMjUzZDYwNGRhZDZlOTI2ZmMyMzM3
|
10
|
+
NDIxMDNiNzFlYmQ3NGI2MTQxNGU1NDQ1YjUwYTNlZTBmZjk4MWYwYzcxNzU2
|
11
|
+
MTFmNzg5NDk0NjQyZTE3ZDAxZWRmMGRlMDMyYTUzYzkwYTY2M2M=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ODAxMWQ3NWY1NDkxNjIxODEyZDVjNmYwNDAxZjFkYjhkMzc2NmYxNWI4MGU4
|
14
|
+
NTM2OTVlMzVmMzhmYjA0ZTJhZDQ0ZDU0ZTdlYWZmOWEwNDU1N2FjMWRiM2Qz
|
15
|
+
YjhkMjczZGFjNmRlNTNhNDEyYTdkN2Y2NDk4ODk2YzZkODVjODY=
|
@@ -54,7 +54,14 @@ module Messagemedia
|
|
54
54
|
:'api:deliveryReport' => @delivery_report,
|
55
55
|
:'api:validityPeriod' => @validity_period,
|
56
56
|
:'api:content' => @content,
|
57
|
-
:'api:recipients' =>
|
57
|
+
:'api:recipients' => {
|
58
|
+
:'api:recipient' => @recipients.map { |r| r.destination_number },
|
59
|
+
:attributes! => {
|
60
|
+
:'api:recipient' => {
|
61
|
+
:uid => @recipients.map { |r| r.message_id }
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
58
65
|
}
|
59
66
|
|
60
67
|
if not @origin.nil? then
|
@@ -24,29 +24,6 @@ module Messagemedia
|
|
24
24
|
@destination_number = destination_number
|
25
25
|
end
|
26
26
|
|
27
|
-
#
|
28
|
-
# Return a hash that can be passed to the Savon SOAP library to
|
29
|
-
# represent a recipient. This will be converted to XML of the form:
|
30
|
-
#
|
31
|
-
# <api:recipient uid="1">+61422000000</api:recipient>
|
32
|
-
#
|
33
|
-
# If the recipient does not have a non-nil ID, then the 'uid'
|
34
|
-
# attribute will be omitted.
|
35
|
-
#
|
36
|
-
def to_api_hash
|
37
|
-
if @message_id.nil? then
|
38
|
-
{
|
39
|
-
:'api:recipient' => @destination_number
|
40
|
-
}
|
41
|
-
else
|
42
|
-
{
|
43
|
-
:'api:recipient' => @destination_number,
|
44
|
-
:'attributes!' => {
|
45
|
-
:'api:recipient' => { 'uid' => @message_id }
|
46
|
-
}
|
47
|
-
}
|
48
|
-
end
|
49
|
-
end
|
50
27
|
end
|
51
28
|
end
|
52
29
|
end
|
data/test/test_message.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'test/unit'
|
2
2
|
|
3
|
+
require_relative '../lib/messagemedia/soap/recipient'
|
3
4
|
require_relative '../lib/messagemedia/soap/message'
|
4
5
|
|
5
6
|
class TestMessage < Test::Unit::TestCase
|
@@ -23,19 +24,20 @@ class TestMessage < Test::Unit::TestCase
|
|
23
24
|
:'api:deliveryReport' => message.delivery_report,
|
24
25
|
:'api:validityPeriod' => message.validity_period,
|
25
26
|
:'api:content' => message.content,
|
26
|
-
:'api:recipients' =>
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
:'api:recipients' => {
|
28
|
+
:'api:recipient' => [
|
29
|
+
recipient_1,
|
30
|
+
recipient_2
|
31
|
+
],
|
32
|
+
:attributes! => {
|
33
|
+
:'api:recipient' => {
|
34
|
+
:uid => [
|
35
|
+
message_id_1,
|
36
|
+
nil
|
37
|
+
]
|
33
38
|
}
|
34
|
-
},
|
35
|
-
{
|
36
|
-
:'api:recipient' => recipient_2
|
37
39
|
}
|
38
|
-
|
40
|
+
}
|
39
41
|
}
|
40
42
|
|
41
43
|
assert_equal(expected_hash, message.to_api_hash)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: messagemedia-soap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Hawkins
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-01-
|
12
|
+
date: 2015-01-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -76,7 +76,6 @@ files:
|
|
76
76
|
- lib/messagemedia/soap/version.rb
|
77
77
|
- messagemedia-soap.gemspec
|
78
78
|
- test/test_message.rb
|
79
|
-
- test/test_recipient.rb
|
80
79
|
homepage: http://www.messagemedia.com/
|
81
80
|
licenses:
|
82
81
|
- Apache
|
@@ -103,4 +102,3 @@ specification_version: 4
|
|
103
102
|
summary: Simple Ruby interface for the MessageMedia SOAP API
|
104
103
|
test_files:
|
105
104
|
- test/test_message.rb
|
106
|
-
- test/test_recipient.rb
|
data/test/test_recipient.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
|
3
|
-
require_relative '../lib/messagemedia/soap/recipient'
|
4
|
-
|
5
|
-
class TestRecipient < Test::Unit::TestCase
|
6
|
-
|
7
|
-
def test_to_api_hash
|
8
|
-
|
9
|
-
# First test receipient, with a custom message ID
|
10
|
-
recipient = Messagemedia::SOAP::Recipient.new(123, 123456)
|
11
|
-
assert_equal({
|
12
|
-
:'api:recipient' => 123456,
|
13
|
-
:'attributes!' => {
|
14
|
-
:'api:recipient' => { 'uid' => 123 }
|
15
|
-
}
|
16
|
-
}, recipient.to_api_hash)
|
17
|
-
|
18
|
-
# Second test recipient, no message ID
|
19
|
-
recipient = Messagemedia::SOAP::Recipient.new(nil, 123456)
|
20
|
-
assert_equal({
|
21
|
-
:'api:recipient' => 123456
|
22
|
-
}, recipient.to_api_hash)
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|