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 +4 -4
- data/Gemfile.lock +3 -3
- data/README.md +19 -4
- data/lib/twilito/api.rb +3 -2
- data/lib/twilito/version.rb +1 -1
- data/twilito.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2dcd1b8e536bbbea68b629b9b8d61c767dd9fba389fbaa8c47ae1f9a3d32fc4c
|
4
|
+
data.tar.gz: 2b54a9064e4ac99c9b0609f1a48ab5147007fa0d988d5d7fc073476a2fdc2349
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01a8a88dd16eb2cdc4c226bbd51a1d6f74f563d713616144eb74a372eb83650f19bc57a31c52239747bce0080bd2625c975cce20fa76821cf7e2374a13e70f6b
|
7
|
+
data.tar.gz: 60bceaf8bd2779ecf996e4de2b5ae6d5dfff56f489eda670911d5c2b9a184169dca0d5dc7a6502d32ead29feb2df5aba7d97771b0bc3149d6d8a600404b1c998
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
twilito (0.
|
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 (
|
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 (~>
|
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
|
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
|
[](https://badge.fury.io/rb/twilito) [](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
|
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
|
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_
|
data/lib/twilito/api.rb
CHANGED
data/lib/twilito/version.rb
CHANGED
data/twilito.gemspec
CHANGED
@@ -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", "~>
|
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.
|
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-
|
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: '
|
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: '
|
68
|
+
version: '13.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: webmock
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|