twilito 0.2.0 → 0.2.1
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/.github/workflows/main.yml +24 -0
- data/Gemfile.lock +1 -1
- data/README.md +4 -2
- data/lib/twilito.rb +2 -2
- data/lib/twilito/api.rb +5 -1
- data/lib/twilito/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b5ea5151af59aa05b717c6462657b1f03899187e69146df8eb8ead13676bba0
|
4
|
+
data.tar.gz: d44c9f193a733dc5d5d7425f28c56dbd3b13f80c0317a60b26b58c1b4be11211
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f0394f453a6d1d41321b9256f49363986fd34cc193cb2a1c9a048d68b64e26ef1babb9853421a0bb4687f53945c4abd0ce48a3b092b7c7e961d5dddb9d5689e
|
7
|
+
data.tar.gz: 3c74d66e30551222a04da3e2837b818704d417218275800533ac82e568d1e2e9e1113aabaf30e381187535639949f230749ad7a217835948c5f2b8a2a91baf30
|
@@ -0,0 +1,24 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
strategy:
|
9
|
+
matrix:
|
10
|
+
ruby: [ '2.4.x', '2.5.x', '2.6.x', '2.7.x' ]
|
11
|
+
name: Run Tests (Ruby ${{ matrix.ruby }})
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@master
|
14
|
+
- name: Setup ruby
|
15
|
+
uses: actions/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: ${{ matrix.ruby }}
|
18
|
+
architecture: 'x64'
|
19
|
+
- name: Run tests
|
20
|
+
run: |
|
21
|
+
gem install bundler
|
22
|
+
bundle
|
23
|
+
rake
|
24
|
+
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# Twilito
|
2
2
|
|
3
|
-
[](https://travis-ci.org/alexford/twilito)
|
4
|
-
|
5
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.
|
6
4
|
|
5
|
+
[](https://badge.fury.io/rb/twilito) [](https://github.com/alexford/twilito/actions)
|
6
|
+
|
7
7
|
## Why
|
8
8
|
|
9
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.
|
@@ -16,6 +16,8 @@ If you use more of Twilio, consider [twilio-ruby](https://github.com/twilio/twil
|
|
16
16
|
|
17
17
|
## Usage
|
18
18
|
|
19
|
+
Twilito should work on Ruby 2.4 and up.
|
20
|
+
|
19
21
|
#### Install the gem
|
20
22
|
|
21
23
|
```
|
data/lib/twilito.rb
CHANGED
@@ -13,7 +13,7 @@ module Twilito
|
|
13
13
|
include API
|
14
14
|
|
15
15
|
def send_sms(**args)
|
16
|
-
response = send_sms!(args)
|
16
|
+
response = send_sms!(**args)
|
17
17
|
Result.success(
|
18
18
|
response: response,
|
19
19
|
sid: JSON.parse(response.read_body)['sid']
|
@@ -36,7 +36,7 @@ module Twilito
|
|
36
36
|
|
37
37
|
private
|
38
38
|
|
39
|
-
def merge_configuration(
|
39
|
+
def merge_configuration(args)
|
40
40
|
configuration.to_h.merge(args).tap do |merged|
|
41
41
|
missing_keys = merged.select { |_k, v| v.nil? }.keys
|
42
42
|
|
data/lib/twilito/api.rb
CHANGED
@@ -7,7 +7,7 @@ module Twilito
|
|
7
7
|
|
8
8
|
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
|
9
9
|
req = Net::HTTP::Post.new(uri)
|
10
|
-
req.initialize_http_header(
|
10
|
+
req.initialize_http_header('User-Agent' => user_agent)
|
11
11
|
req.basic_auth(args[:account_sid], args[:auth_token])
|
12
12
|
req.set_form_data(twilio_params(args))
|
13
13
|
|
@@ -38,5 +38,9 @@ module Twilito
|
|
38
38
|
'Body' => args[:body]
|
39
39
|
}
|
40
40
|
end
|
41
|
+
|
42
|
+
def user_agent
|
43
|
+
"Ruby Twilito/#{Twilito::VERSION}"
|
44
|
+
end
|
41
45
|
end
|
42
46
|
end
|
data/lib/twilito/version.rb
CHANGED
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.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Ford
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -87,6 +87,7 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
+
- ".github/workflows/main.yml"
|
90
91
|
- ".gitignore"
|
91
92
|
- ".rubocop.yml"
|
92
93
|
- ".travis.yml"
|