twilito 0.4.0 → 0.5.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: ac55859f2c24ea8da46a22d84d2b34473c586280bd4f2541d70fdbe5de044229
4
- data.tar.gz: 9301076c59a7372e51870b2b65c33fe793e3163333f6925e67646d8dd1f0c497
3
+ metadata.gz: 7735e0e748d2013a87e0184c5d6c233f3bf0c90ede19b62c6674e96b3f592d18
4
+ data.tar.gz: 1ec6957aa7b4efa692ab07716595debff865c11c54267befdee64d4cd84596a4
5
5
  SHA512:
6
- metadata.gz: d8528c27bcf15dffa8a1e844fd80cd5e648102ca6c7e20afb3af00edbbe7193ba23ff86f367771f901f4e92198ba1304afa730f757cb27964178b68cb3dd524b
7
- data.tar.gz: 9edd9bc5e5c52a872db0a4e45e0eba6b04a5fba0de98ef615ca2c1a5c8dbb5abf01f772cb6760a7c3e363cbfa98a6e9129a13f67a366bad746a0f57e7f09135c
6
+ metadata.gz: e91c012d2b04d4003d49344f6cf288c5e590ffe5ab3e531b277252ae823d1a1dabf8522133869f09c3ad4ae2627cf9376dc9e14e5624fc26bb359945a64a6e97
7
+ data.tar.gz: 024b225407ef5e759703186b13b9919a9c449363642b5bde09b4a6074251213f7a81092c3c806b430f5dbf49d935601ff6e52076a4fce53e34c4a605b93e0989
@@ -7,7 +7,7 @@ jobs:
7
7
  runs-on: ubuntu-latest
8
8
  strategy:
9
9
  matrix:
10
- ruby: ["2.4", "2.5", "2.6", "2.7", "3.0"]
10
+ ruby: ["3.0", "3.1", "3.2"]
11
11
  name: Run Tests (Ruby ${{ matrix.ruby }})
12
12
  steps:
13
13
  - uses: actions/checkout@master
data/.rubocop.yml CHANGED
@@ -2,6 +2,8 @@ AllCops:
2
2
  Exclude:
3
3
  - "bin/**/*"
4
4
  - "twilito.gemspec"
5
+ AllCops:
6
+ TargetRubyVersion: 3.2
5
7
 
6
8
  Metrics/BlockLength:
7
9
  Exclude:
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- ruby '>= 2.4.0'
3
+ ruby '>= 3.0.0'
4
4
 
5
5
  source "https://rubygems.org"
6
6
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- twilito (0.3.3)
4
+ twilito (0.4.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -9,18 +9,18 @@ GEM
9
9
  addressable (2.7.0)
10
10
  public_suffix (>= 2.0.2, < 5.0)
11
11
  ast (2.4.1)
12
- coderay (1.1.2)
12
+ coderay (1.1.3)
13
13
  crack (0.4.5)
14
14
  rexml
15
15
  hashdiff (1.0.1)
16
- method_source (0.9.2)
16
+ method_source (1.0.0)
17
17
  minitest (5.11.3)
18
18
  parallel (1.19.2)
19
19
  parser (2.7.1.3)
20
20
  ast (~> 2.4.0)
21
- pry (0.12.2)
22
- coderay (~> 1.1.0)
23
- method_source (~> 0.9.0)
21
+ pry (0.14.2)
22
+ coderay (~> 1.1)
23
+ method_source (~> 1.0)
24
24
  public_suffix (4.0.6)
25
25
  rainbow (3.0.0)
26
26
  rake (13.0.1)
@@ -51,7 +51,7 @@ PLATFORMS
51
51
  DEPENDENCIES
52
52
  bundler (~> 2.0)
53
53
  minitest (~> 5.11)
54
- pry
54
+ pry (~> 0.14)
55
55
  rake (~> 13.0)
56
56
  rubocop
57
57
  twilito!
@@ -59,7 +59,7 @@ DEPENDENCIES
59
59
  yard (~> 0.9)
60
60
 
61
61
  RUBY VERSION
62
- ruby 2.7.2p137
62
+ ruby 3.2.2p53
63
63
 
64
64
  BUNDLED WITH
65
- 2.2.15
65
+ 2.4.19
data/README.md CHANGED
@@ -16,7 +16,7 @@ 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. Unit tests [run in CI](https://github.com/alexford/twilito/actions) on 2.4, 2.5, 2.6, 2.7, and 3.0.
19
+ Twilito is designed for currently maintained Ruby versions. (3.0 and up as of 8/2023). Unit tests [run in CI](https://github.com/alexford/twilito/actions) on 3.0, 3.1, and 3.2
20
20
 
21
21
  #### Install the gem
22
22
 
@@ -30,7 +30,7 @@ gem 'twilito'
30
30
  # All of these arguments are required, but can be configured as defaults (see below)
31
31
  result = Twilito.send_sms(
32
32
  to: '+15555555555',
33
- from: '+15554444444',
33
+ from: '+15554444444', # or 'messaging_service_sid'
34
34
  body: 'This is my content',
35
35
  account_sid: '...', # Twilio Credentials
36
36
  auth_token: '...'
@@ -65,7 +65,7 @@ end
65
65
 
66
66
  ### Configuring Defaults For Required Arguments
67
67
 
68
- The five required arguments (`to`, `from`, `body`, `account_sid`, and `auth_token`) can be configured as defaults with `Twilito.configure`.
68
+ The five required arguments (`to`, `from` (or `messaging_service_sid`), `body`, `account_sid`, and `auth_token`) can be configured as defaults with `Twilito.configure`.
69
69
 
70
70
  ```ruby
71
71
  # In an initializer or something like that:
@@ -15,7 +15,7 @@ module Twilito
15
15
 
16
16
  class Configuration
17
17
  attr_accessor :account_sid, :auth_token, :from, :to, :body,
18
- :twilio_host, :twilio_version
18
+ :twilio_host, :twilio_version, :messaging_service_sid
19
19
 
20
20
  TWILIO_HOST = 'api.twilio.com'
21
21
  TWILIO_VERSION = '2010-04-01'
@@ -24,6 +24,7 @@ module Twilito
24
24
  {
25
25
  to: to,
26
26
  from: from,
27
+ messaging_service_sid: messaging_service_sid,
27
28
  body: body,
28
29
  account_sid: account_sid,
29
30
  auth_token: auth_token
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Twilito
4
- VERSION = "0.4.0"
4
+ VERSION = "0.5.0"
5
5
  end
data/lib/twilito.rb CHANGED
@@ -38,6 +38,13 @@ module Twilito
38
38
  configuration.to_h.merge(args).tap do |merged|
39
39
  missing_keys = merged.select { |_k, v| v.nil? }.keys
40
40
 
41
+ # Only one of :from or :messaging_service_sid must be set
42
+ missing_keys = [] if (missing_keys == [:from]) || (missing_keys == [:messaging_service_sid])
43
+ missing_keys = missing_keys.map do |key|
44
+ key == :from ? "from (or messaging_service_sid)" : key
45
+ end
46
+ missing_keys.delete(:messaging_service_sid)
47
+
41
48
  raise ArgumentError, "Missing argument(s): #{missing_keys.join(', ')}" if missing_keys.any?
42
49
  end
43
50
  end
data/twilito.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.version = Twilito::VERSION
11
11
  spec.authors = ["Alex Ford"]
12
12
  spec.email = ["alexford@hey.com"]
13
- spec.required_ruby_version = '>= 2.4.0'
13
+ spec.required_ruby_version = '>= 3.0'
14
14
 
15
15
  spec.summary = "A tiny, zero dependency, and easy to test helper for sending text messages with Twilio"
16
16
  spec.homepage = "https://github.com/alexford/twilito"
@@ -24,9 +24,9 @@ Gem::Specification.new do |spec|
24
24
 
25
25
  spec.add_development_dependency "bundler", "~> 2.0"
26
26
  spec.add_development_dependency "minitest", "~> 5.11"
27
- spec.add_development_dependency "pry"
27
+ spec.add_development_dependency "pry", "~> 0.14"
28
28
  spec.add_development_dependency "rake", "~> 13.0"
29
- spec.add_development_dependency "rubocop"
29
+ spec.add_development_dependency "rubocop", "~> 0.85"
30
30
  spec.add_development_dependency "webmock", "~> 3.12"
31
31
  spec.add_development_dependency "yard", "~> 0.9"
32
32
  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.0
4
+ version: 0.5.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: 2021-04-06 00:00:00.000000000 Z
11
+ date: 2023-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: pry
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '0.14'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '0.14'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -70,16 +70,16 @@ dependencies:
70
70
  name: rubocop
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '0.85'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: '0.85'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: webmock
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -145,14 +145,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
145
145
  requirements:
146
146
  - - ">="
147
147
  - !ruby/object:Gem::Version
148
- version: 2.4.0
148
+ version: '3.0'
149
149
  required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  requirements:
151
151
  - - ">="
152
152
  - !ruby/object:Gem::Version
153
153
  version: '0'
154
154
  requirements: []
155
- rubygems_version: 3.0.3
155
+ rubygems_version: 3.4.10
156
156
  signing_key:
157
157
  specification_version: 4
158
158
  summary: A tiny, zero dependency, and easy to test helper for sending text messages