messagemedia-soap 0.6.4 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzlmOTNhYjdhNmNkNThhODdjY2Q3YTA5M2Q1NzdjM2UwNjg0OTM0NA==
4
+ MDg4Y2JhNzk4OTM1MWMwZWM0NDdkMmRkNWNhM2NmNmVlYzg4NGMyNQ==
5
5
  data.tar.gz: !binary |-
6
- MWRhN2IwMzhlOTI3YmQ2MDhhNzQ3YjExZjI4OGQ0ZmQ1Y2NlOGM0Mg==
6
+ N2QxOGQ1OWI1MWNlZWI2NzlmNzZlMDBmOTUwY2E5YTVhYmZkZjYzMw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MmJlNmY5ZGRkMmNiMjYzMWNiYjM2NzY2YWQ5OGUzOWNlNTY1YWRiOTU1NTI4
10
- NzZiM2YxZTE4YjI2ZjJiMmQyMGM2YTExNDZjYmQ0ZWI3MzJkZjMxOTRmMGFm
11
- NTA3Zjc1ODc5OThmM2NjYTcyZTNjNWMxNGZmMDcwYjYyOGNmZGY=
9
+ ZDg3M2ViNDJlNmNiNGFmNTNkNGFkN2VhMjUzZDYwNGRhZDZlOTI2ZmMyMzM3
10
+ NDIxMDNiNzFlYmQ3NGI2MTQxNGU1NDQ1YjUwYTNlZTBmZjk4MWYwYzcxNzU2
11
+ MTFmNzg5NDk0NjQyZTE3ZDAxZWRmMGRlMDMyYTUzYzkwYTY2M2M=
12
12
  data.tar.gz: !binary |-
13
- NTk0MDEzMTUyN2IwNjcyYWU4MjdlMjM5YTZhZDg5NTRlYWJiNWMwOTI0N2Yy
14
- NmE0YWE0MWI0MWQwMmU2NzExYWU0Y2I4MGZjMTk5YmI5MTVhMzhlODUyMTFk
15
- Yjc0NTJhZWI1MWQ5MzExMDgyN2NjYTg2YTQ4ODZmMTQ0YTEzN2I=
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' => @recipients.map { |r| r.to_api_hash }
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
@@ -2,7 +2,7 @@ module Messagemedia
2
2
 
3
3
  module SOAP
4
4
 
5
- VERSION = "0.6.4"
5
+ VERSION = "0.6.5"
6
6
 
7
7
  end
8
8
 
@@ -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
- :'api:recipient' => recipient_1,
29
- :'attributes!' => {
30
- :'api:recipient' => {
31
- 'uid' => message_id_1
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
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-06 00:00:00.000000000 Z
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
@@ -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