twilito 0.2.1 → 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b5ea5151af59aa05b717c6462657b1f03899187e69146df8eb8ead13676bba0
4
- data.tar.gz: d44c9f193a733dc5d5d7425f28c56dbd3b13f80c0317a60b26b58c1b4be11211
3
+ metadata.gz: 2dcd1b8e536bbbea68b629b9b8d61c767dd9fba389fbaa8c47ae1f9a3d32fc4c
4
+ data.tar.gz: 2b54a9064e4ac99c9b0609f1a48ab5147007fa0d988d5d7fc073476a2fdc2349
5
5
  SHA512:
6
- metadata.gz: 7f0394f453a6d1d41321b9256f49363986fd34cc193cb2a1c9a048d68b64e26ef1babb9853421a0bb4687f53945c4abd0ce48a3b092b7c7e961d5dddb9d5689e
7
- data.tar.gz: 3c74d66e30551222a04da3e2837b818704d417218275800533ac82e568d1e2e9e1113aabaf30e381187535639949f230749ad7a217835948c5f2b8a2a91baf30
6
+ metadata.gz: 01a8a88dd16eb2cdc4c226bbd51a1d6f74f563d713616144eb74a372eb83650f19bc57a31c52239747bce0080bd2625c975cce20fa76821cf7e2374a13e70f6b
7
+ data.tar.gz: 60bceaf8bd2779ecf996e4de2b5ae6d5dfff56f489eda670911d5c2b9a184169dca0d5dc7a6502d32ead29feb2df5aba7d97771b0bc3149d6d8a600404b1c998
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- twilito (0.2.1)
4
+ twilito (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -18,7 +18,7 @@ GEM
18
18
  coderay (~> 1.1.0)
19
19
  method_source (~> 0.9.0)
20
20
  public_suffix (3.0.3)
21
- rake (10.5.0)
21
+ rake (13.0.1)
22
22
  safe_yaml (1.0.5)
23
23
  webmock (3.5.1)
24
24
  addressable (>= 2.3.6)
@@ -32,7 +32,7 @@ DEPENDENCIES
32
32
  bundler (~> 2.0)
33
33
  minitest (~> 5.11)
34
34
  pry
35
- rake (~> 10.0)
35
+ rake (~> 13.0)
36
36
  twilito!
37
37
  webmock (~> 3)
38
38
 
data/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # Twilito
2
2
 
3
- A tiny, zero dependency helper for sending text messages with Twilio. Just enough of a wrapper to abstract away Twilio's REST API for sending messages, without *anything* else.
3
+ A tiny, zero dependency helper for sending text messages with Twilio. Just enough of a wrapper to abstract away Twilio's REST API for sending messages, without _anything_ else.
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/twilito.svg)](https://badge.fury.io/rb/twilito) [![Actions Status](https://github.com/alexford/twilito/workflows/CI/badge.svg)](https://github.com/alexford/twilito/actions)
6
6
 
7
7
  ## Why
8
8
 
9
- Twilio's [full Ruby library](https://github.com/twilio/twilio-ruby) does a *lot*, and has a large memory footprint to go with it—too large for just sending a message. It's also more difficult to mock and verify in tests than I'd like.
9
+ Twilio's [full Ruby library](https://github.com/twilio/twilio-ruby) does a _lot_, and has a large memory footprint to go with it—too large for just sending a message. It's also more difficult to mock and verify in tests than I'd like.
10
10
 
11
11
  Using [Twilio's REST API](https://www.twilio.com/docs/usage/api) directly is fine, but can be cumbersome.
12
12
 
@@ -27,15 +27,16 @@ gem 'twilito'
27
27
  #### Simplest case
28
28
 
29
29
  ```ruby
30
- # All options are required (but can be defaulted, see below)
30
+ # All of these arguments are required, but can be defaulted (see below)
31
31
  result = Twilito.send_sms(
32
32
  to: '+15555555555',
33
33
  from: '+15554444444',
34
- content: 'This is my content'
34
+ content: 'This is my content',
35
35
  account_sid: '...', # Twilio Credentials
36
36
  auth_token: '...'
37
37
  )
38
38
 
39
+
39
40
  # Returns Twilito::Result struct
40
41
 
41
42
  result.success? # => boolean
@@ -84,6 +85,20 @@ Twilito.send_sms!(to: '+15555555555', body: 'Foo')
84
85
 
85
86
  **Everything can be defaulted, including the message body, so that a bare `Twilio.send_sms!` can work in your code**
86
87
 
88
+ #### Sending MMS
89
+
90
+ ```ruby
91
+ # Use the optional media_url argument, which is sent
92
+ # to Twilio as MediaUrl
93
+
94
+ result = Twilito.send_sms(
95
+ to: '+15555555555',
96
+ content: 'This is my content',
97
+ media_url: 'https://example.com/image.png',
98
+ )
99
+
100
+ ```
101
+
87
102
  ## Testing your code
88
103
 
89
104
  _TODO: Add examples of mocking and/or test helpers for asserting your code sends an SMS_
@@ -35,8 +35,9 @@ module Twilito
35
35
  {
36
36
  'To' => args[:to],
37
37
  'From' => args[:from],
38
- 'Body' => args[:body]
39
- }
38
+ 'Body' => args[:body],
39
+ 'MediaUrl' => args[:media_url]
40
+ }.compact
40
41
  end
41
42
 
42
43
  def user_agent
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Twilito
4
- VERSION = "0.2.1"
4
+ VERSION = "0.3.0"
5
5
  end
@@ -25,6 +25,6 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "bundler", "~> 2.0"
26
26
  spec.add_development_dependency "minitest", "~> 5.11"
27
27
  spec.add_development_dependency "pry"
28
- spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "rake", "~> 13.0"
29
29
  spec.add_development_dependency "webmock", "~> 3"
30
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twilito
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Ford
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-28 00:00:00.000000000 Z
11
+ date: 2020-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: '13.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: '13.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: webmock
71
71
  requirement: !ruby/object:Gem::Requirement