outbox-bandwidth 0.1.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 795ddc3b92fe3d399e8628c635e202a8d8d004ee23a830386450aa7c1ac4d224
4
- data.tar.gz: 908e1f5e20edae4ec276a8464ab8820d3a7fc8ab9784b3c02c52708dbf0933fd
3
+ metadata.gz: 9540fc2230928fe1912747fc6e8796a1ac9084d4ce3d97bc6fab09f052b45055
4
+ data.tar.gz: 66fcd4093260919f202b67376423a31a239e37473a70ad020fc6178f9ae5dbe6
5
5
  SHA512:
6
- metadata.gz: 738d34f68f434df58f3c62d10407e3ba87231fa53001bd0568ca245fa6f14734cb9e761b2d587cb585dcc49a5c331707e261787228b1fae30c88d76945d3e942
7
- data.tar.gz: 2a5775769b1c4bc79ff3e3dc92aff28c7a10cf08ff34152bd4ee47f0acf38dbfc23fb8e017ff26153f384de9f0379f82fd7c061b1354c9fc5fcfb1b3e84e7ed4
6
+ metadata.gz: f68281caf5333c8065e56b75fdd26504234db41be3fea62f0a8c0241fa8b676e22273fab72f382a18dda28240b6ee436b30af39bba35b3befa69a93c1d6a53ba
7
+ data.tar.gz: 97feaa0e94177e3a5b9b40f786be39c36b161159c10b13d0a32cfbb0f3736cfa54770481d4258f79b21ed1ccf8d304cb5712261d5735833738e8af479a831be3
@@ -32,16 +32,12 @@ module Outbox
32
32
  messaging_basic_auth_password: options[:secret]
33
33
  )
34
34
  @account_id = options[:subaccount_id] || options[:account_id]
35
+ @application_id = options[:application_id]
35
36
  end
36
37
 
37
38
  def deliver(sms)
38
39
  messaging_client = @api_client.messaging_client.client
39
- body = ::Bandwidth::MessageRequest.new
40
- body.application_id = sms[:application_id]
41
- body.to = sms.to
42
- body.from = sms.from
43
- body.text = sms.body
44
- body.media = [sms[:media_url]] unless sms[:media_url].nil?
40
+ body = create_message_body(sms)
45
41
  messaging_client.create_message(account_id(sms), body: body)
46
42
  end
47
43
 
@@ -51,6 +47,16 @@ module Outbox
51
47
  return sms[:account_id] unless sms[:account_id].nil?
52
48
  @account_id
53
49
  end
50
+
51
+ def create_message_body(sms)
52
+ body = ::Bandwidth::MessageRequest.new
53
+ body.application_id = sms[:application_id] || @application_id
54
+ body.to = sms.to.is_a?(Array) ? sms.to : [sms.to]
55
+ body.from = sms.from
56
+ body.text = sms.body
57
+ body.media = [sms[:media_url]] unless sms[:media_url].nil?
58
+ body
59
+ end
54
60
  end
55
61
  end
56
62
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Outbox
4
4
  module Bandwidth
5
- VERSION = '0.1.0'
5
+ VERSION = '0.2.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: outbox-bandwidth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Browne
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-09-21 00:00:00.000000000 Z
12
+ date: 2020-10-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bandwidth-sdk