twi 0.0.1 → 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 +5 -5
- data/CHANGELOG.md +4 -0
- data/LICENSE.txt +17 -18
- data/README.md +62 -17
- data/lib/twi/config.rb +37 -0
- data/lib/twi/delivery.rb +20 -0
- data/lib/twi/event.rb +39 -0
- data/lib/twi/lio.rb +47 -0
- data/lib/twi/medium.rb +33 -0
- data/lib/twi/message.rb +65 -0
- data/lib/twi/participant.rb +14 -0
- data/lib/twi/resource.rb +14 -0
- data/lib/twi/version.rb +3 -1
- data/lib/twi.rb +15 -4
- metadata +31 -28
- data/.gitignore +0 -22
- data/Gemfile +0 -4
- data/Rakefile +0 -2
- data/twi.gemspec +0 -23
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 016ae01fae07b7e70c6f405174016450c862159332b87cacd470478c317817ff
|
|
4
|
+
data.tar.gz: 0ffcef985cc4256bf2ed9b8a7ad31ce98dd397786b825393d9aada604a1f93c8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 146e6081e40bb06aa2a4c2c404614a8d316ef16e171191b26460121ad2e654092410927e16ba02c819c42f33c3d746d13b306ea0514dc01af5a1ec3c44319181
|
|
7
|
+
data.tar.gz: 1e46956a86d74ff2077fdcc68b3698e2398b6534be2578dedad528bf6685209691067edf90e09b34f571280537590ff392a5d8b945901a737fe0143c1294f3f8
|
data/CHANGELOG.md
ADDED
data/LICENSE.txt
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Copyright (c) 2026 HouseAccount
|
|
4
4
|
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
the following conditions:
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
12
11
|
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
|
14
|
-
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
15
14
|
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
OF
|
|
22
|
-
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
|
@@ -1,29 +1,74 @@
|
|
|
1
|
-
#
|
|
1
|
+
# The enhanced Twilio API Ruby client
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Available methods
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
### Twi::Message
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
When receiving an incoming direct message via webhook:
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
```ruby
|
|
10
|
+
message = Twi::Message.new params
|
|
11
|
+
message.id # => 'SM083e290bef7794c407f14e22a891aa6d'
|
|
12
|
+
message.content # => 'Hello world'
|
|
13
|
+
message.sender # => '8009007000'
|
|
14
|
+
message.recipient # => '8008008000'
|
|
15
|
+
message.wallflower # nil
|
|
16
|
+
message.opt_in? # false
|
|
17
|
+
message.opt_out? # false
|
|
18
|
+
message.image_urls # => ['https://example.com/image.png']
|
|
19
|
+
```
|
|
10
20
|
|
|
11
|
-
|
|
21
|
+
When building a Twilio-like webhook payload:
|
|
12
22
|
|
|
13
|
-
|
|
23
|
+
```ruby
|
|
24
|
+
Twi::Message.params_for id: 'SM12', content: 'Hello', sender: '8009007000', recipient: '8008008000'
|
|
25
|
+
# => { MessageSid: 'SM12', Body: 'Hello',From: '+18009007000', To: '+18008008000' }
|
|
26
|
+
```
|
|
14
27
|
|
|
15
|
-
|
|
28
|
+
### Twi::Delivery
|
|
16
29
|
|
|
17
|
-
|
|
30
|
+
When receiving a delivery notification via webhook:
|
|
18
31
|
|
|
19
|
-
|
|
32
|
+
```ruby
|
|
33
|
+
delivery = Twi::Delivery.new params
|
|
34
|
+
delivery.id # => 'SM083e290bef7794c407f14e22a891aa6d'
|
|
35
|
+
delivery.status # => 'draft'
|
|
36
|
+
delivery.code # => '30006'
|
|
37
|
+
```
|
|
20
38
|
|
|
21
|
-
|
|
39
|
+
When building a Twilio-like webhook payload:
|
|
22
40
|
|
|
23
|
-
|
|
41
|
+
```ruby
|
|
42
|
+
Twi::Delivery.params_for id: 'SM12', status: 'sent'
|
|
43
|
+
# => { SmsSid: 'SM12', MessgeStatus: 'sent', ErrorCode: nil }
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Twi::Event
|
|
47
|
+
|
|
48
|
+
When receiving events about a conversation:
|
|
49
|
+
|
|
50
|
+
```ruby
|
|
51
|
+
event = Twi::Event.new params
|
|
52
|
+
event.id # => 'SM083e290bef7794c407f14e22a891aa6d'
|
|
53
|
+
event.conversation_id # => 'CH123'
|
|
54
|
+
event.target # => :participant
|
|
55
|
+
event.participant # => #<Participant id: 'SH12', phone: '9008009000', identity: nil>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## To Do
|
|
59
|
+
|
|
60
|
+
1. have a Rails engine with the webhook URLs already set?
|
|
61
|
+
4. have an interface to send and receive SMS with photos
|
|
62
|
+
5. another webhook for conversations
|
|
63
|
+
6. another one to be notified of deliveries
|
|
64
|
+
7. Assistant > create a phone number
|
|
65
|
+
8. have an error code URL for each error code and a sid_url
|
|
66
|
+
9. Declare some phones like Twilio.homeowner_phone or Twilio.numbers[:ddd] and a default Twilio.number and similar Twilio.messaging_service
|
|
67
|
+
10. a way to reopen closed conversations
|
|
68
|
+
11. a way to create conversations
|
|
69
|
+
12. and upload pictures in a conversation
|
|
70
|
+
13. x_twilio_webhook_enabled: true
|
|
71
|
+
14. return SIDs so we can store them
|
|
72
|
+
15. Set up defaults likw Twi::Lio.sid
|
|
73
|
+
16. Twi.mock = true
|
|
24
74
|
|
|
25
|
-
1. Fork it ( https://github.com/[my-github-username]/twi/fork )
|
|
26
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
27
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
28
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
|
29
|
-
5. Create a new Pull Request
|
data/lib/twi/config.rb
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Enhances the Twilio Ruby gem with an object-oriented approach.
|
|
2
|
+
module Twi
|
|
3
|
+
# Provides methods to read and write global configuration settings.
|
|
4
|
+
#
|
|
5
|
+
# A typical usage is to set the +sid+ and +secret+ to interact with Twilio API.
|
|
6
|
+
#
|
|
7
|
+
# @example Set the +sid+ and +secret+ to interact with Twilio API:
|
|
8
|
+
# Twi.configure do |twilio|
|
|
9
|
+
# twilio.sid = 'AC8776d'
|
|
10
|
+
# twilio.secret = '588213'
|
|
11
|
+
# end
|
|
12
|
+
#
|
|
13
|
+
# Note that Twi.configure has precedence over values through with
|
|
14
|
+
# environment variables (see {Twi::Lio}).
|
|
15
|
+
#
|
|
16
|
+
module Config
|
|
17
|
+
# Yields the global configuration to the given block.
|
|
18
|
+
#
|
|
19
|
+
# @example
|
|
20
|
+
# Twi.configure do |twilio|
|
|
21
|
+
# twilio.sid = 'AC8776d'
|
|
22
|
+
# end
|
|
23
|
+
#
|
|
24
|
+
# @yield [Twi::Lio] The global configuration.
|
|
25
|
+
def configure
|
|
26
|
+
yield lio if block_given?
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# @return [Twi::Lio] The global configuration.
|
|
30
|
+
def lio
|
|
31
|
+
@lio ||= Twi::Lio.new
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# @note Config is tauto-loaded in the Twi module to be able to invoke +Twi.configure+.
|
|
36
|
+
extend Config
|
|
37
|
+
end
|
data/lib/twi/delivery.rb
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Enhances the Twilio Ruby gem with an object-oriented approach.
|
|
2
|
+
module Twi
|
|
3
|
+
# The representation of a direct message delivery notification.
|
|
4
|
+
class Delivery < Resource
|
|
5
|
+
# @return [String] unique identifier
|
|
6
|
+
def id = @params['SmsSid']
|
|
7
|
+
|
|
8
|
+
# @return [String] delivery status, one of accepted, scheduled, queued, sending, sent,
|
|
9
|
+
# delivery_unknown, delivered, undelivered, failed # TODO: make an enum
|
|
10
|
+
def status = @params['MessageStatus']
|
|
11
|
+
|
|
12
|
+
# @return [String, nil] error code
|
|
13
|
+
def code = @params['ErrorCode']
|
|
14
|
+
|
|
15
|
+
# @return [Hash] the shape of the payload send by Twilio to the callback URL.
|
|
16
|
+
def self.params_for(id:, status:, code: nil)
|
|
17
|
+
{ SmsSid: id, MessageStatus: status, ErrorCode: code }
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
data/lib/twi/event.rb
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Enhances the Twilio Ruby gem with an object-oriented approach.
|
|
2
|
+
module Twi
|
|
3
|
+
# The representation of an event tied to a (clasic) conversation.
|
|
4
|
+
class Event < Resource
|
|
5
|
+
# @return [Symbol] what the event is about
|
|
6
|
+
def target
|
|
7
|
+
case @params['EventType']
|
|
8
|
+
when 'onConversationAdded', 'onConversationStateUpdated' then :conversation
|
|
9
|
+
when 'onParticipantAdded' then :participant
|
|
10
|
+
when 'onMessageAdded' then :message
|
|
11
|
+
when 'onDeliveryUpdated' then :delivery
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# @return [String] conversation state, one of active, inactive, closed, initializing.
|
|
16
|
+
def status = @params['Status'] || @params['StateTo'] || @params['State']
|
|
17
|
+
|
|
18
|
+
# @return [Participant] the participant the event is about (e.g.: joined the conversation).
|
|
19
|
+
def participant = Participant.new @params
|
|
20
|
+
|
|
21
|
+
# @return [String] unique message identifier
|
|
22
|
+
def id = @params['MessageSid']
|
|
23
|
+
|
|
24
|
+
# @return [String, nil] content
|
|
25
|
+
def content = @params['Body']&.squish
|
|
26
|
+
|
|
27
|
+
# @return [Array<String>] URLs of image attachments
|
|
28
|
+
def image_urls
|
|
29
|
+
media = JSON(@params.fetch('Media', '[]')).map { |params| Medium.new params }
|
|
30
|
+
media.filter(&:image?).map { |image| image.url }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# @return [String] unique conversation identifier
|
|
34
|
+
def conversation_id = @params['ConversationSid']
|
|
35
|
+
|
|
36
|
+
# @return [String, nil] error code
|
|
37
|
+
def code = @params['ErrorCode']
|
|
38
|
+
end
|
|
39
|
+
end
|
data/lib/twi/lio.rb
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Enhances the Twilio Ruby gem with an object-oriented approach.
|
|
2
|
+
module Twi
|
|
3
|
+
# Provides an object to store global configuration settings.
|
|
4
|
+
#
|
|
5
|
+
# This class is not used directly, but by calling {Twi::Config#configure Twi.configure},
|
|
6
|
+
# which creates and updates a single instance of {Twi::Lio}.
|
|
7
|
+
#
|
|
8
|
+
# @example Set the +sid+ and +secret+ to interact with Twilio API:
|
|
9
|
+
# Twi.configure do |config|
|
|
10
|
+
# twilio.sid = 'AC8776d'
|
|
11
|
+
# twilio.secret = '588213'
|
|
12
|
+
# end
|
|
13
|
+
#
|
|
14
|
+
# @see Twi::Lio for more examples.
|
|
15
|
+
#
|
|
16
|
+
# An alternative way to set global configuration settings is by storing
|
|
17
|
+
# them in the following environment variables:
|
|
18
|
+
#
|
|
19
|
+
# * +TWILIO_SID+ to store the Twilio SID
|
|
20
|
+
# * +TWILIO_SECRET+ to store the Twilio secret
|
|
21
|
+
# * +TWILIO_CONVERSATION_SERVICE_SID+ to store the Twilio Conversation service ID
|
|
22
|
+
#
|
|
23
|
+
# In case both methods are used together,
|
|
24
|
+
# {Twi::Config#configure Twi.configure} takes precedence.
|
|
25
|
+
#
|
|
26
|
+
# @example Set the +sid+ and +secret+ to interact with Twilio API:
|
|
27
|
+
# ENV['TWILIO_SID'] = 'AC8776d'
|
|
28
|
+
# ENV['TWILIO_SECRET'] = '588213'
|
|
29
|
+
#
|
|
30
|
+
class Lio
|
|
31
|
+
# Initialize the global configuration settings defaulting to matching environment variables.
|
|
32
|
+
def initialize
|
|
33
|
+
@sid = ENV['TWILIO_SID']
|
|
34
|
+
@secret = ENV['TWILIO_SECRET']
|
|
35
|
+
@conversation_service_sid = ENV['TWILIO_CONVERSATION_SERVICE_SID']
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# @return [String] the SID to interact with the Twilio API.
|
|
39
|
+
attr_reader :sid
|
|
40
|
+
|
|
41
|
+
# @return [String] the secret to interact with the Twilio API.
|
|
42
|
+
attr_reader :secret
|
|
43
|
+
|
|
44
|
+
# @return [String] the SID of the default Conversation service to use.
|
|
45
|
+
attr_reader :conversation_service_sid
|
|
46
|
+
end
|
|
47
|
+
end
|
data/lib/twi/medium.rb
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Enhances the Twilio Ruby gem with an object-oriented approach.
|
|
2
|
+
module Twi
|
|
3
|
+
# The representation of a medium (image) attached to a message.
|
|
4
|
+
class Medium < Resource
|
|
5
|
+
# @return [String] unique identifier
|
|
6
|
+
def id = @params['Sid']
|
|
7
|
+
|
|
8
|
+
# @return [Boolean] whether the medium has the content type of an image.
|
|
9
|
+
def image? = content_type.match? %r{^image/}
|
|
10
|
+
|
|
11
|
+
# @return [String] the content type
|
|
12
|
+
def content_type = @params['ContentType']
|
|
13
|
+
|
|
14
|
+
# @return [String] a URL where the image can be accessed at least for a few minutes.
|
|
15
|
+
def url
|
|
16
|
+
uri = URI service_url
|
|
17
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
18
|
+
http.use_ssl = true
|
|
19
|
+
|
|
20
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
|
21
|
+
request.basic_auth Twi.lio.sid, Twi.lio.secret
|
|
22
|
+
response = http.request(request)
|
|
23
|
+
|
|
24
|
+
JSON(response.body).dig 'links', 'content_direct_temporary'
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
|
|
29
|
+
def service_url
|
|
30
|
+
"https://mcs.us1.twilio.com/v1/Services/#{Twi.lio.conversation_service_sid}/Media/#{id}"
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
data/lib/twi/message.rb
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Enhances the Twilio Ruby gem with an object-oriented approach.
|
|
2
|
+
module Twi
|
|
3
|
+
# The representation of a direct message.
|
|
4
|
+
class Message < Resource
|
|
5
|
+
# @return [String] unique identifier
|
|
6
|
+
def id = @params['MessageSid']
|
|
7
|
+
|
|
8
|
+
# @return [String, nil] content
|
|
9
|
+
def content = @params['Body']&.squish
|
|
10
|
+
|
|
11
|
+
# @return [String] 10-digit phone number sending the SMS.
|
|
12
|
+
def sender = remove_prefix_from @params['From']
|
|
13
|
+
|
|
14
|
+
# @return [String] 10-digit phone number receiving the SMS.
|
|
15
|
+
def recipient = remove_prefix_from @params['To']
|
|
16
|
+
|
|
17
|
+
# @return [String] 10-digit phone number of any CC'd recipient.
|
|
18
|
+
def wallflower = remove_prefix_from @params['OtherRecipients0']
|
|
19
|
+
|
|
20
|
+
# @return [Boolean] whether the sender replied STOP to unsubscribe.
|
|
21
|
+
def opt_out? = @params['OptOutType'] == 'STOP'
|
|
22
|
+
|
|
23
|
+
# @return [Boolean] whether the sender replied START to resubscribe.
|
|
24
|
+
def opt_in? = @params['OptOutType'] == 'START'
|
|
25
|
+
|
|
26
|
+
# @return [Array<String>] URLs of image attachments
|
|
27
|
+
def image_urls
|
|
28
|
+
(0...@params['NumMedia'].to_i).filter_map do |index|
|
|
29
|
+
@params["MediaUrl#{index}"] if @params["MediaContentType#{index}"].match? %r{^image/}
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# @return [Hash] the shape of the payload send by Twilio to the callback URL.
|
|
34
|
+
def self.params_for(id:, sender:, recipient:, wallflower: nil, content: nil, opt: nil, media: [])
|
|
35
|
+
{
|
|
36
|
+
MessageSid: id,
|
|
37
|
+
From: "+1#{sender}",
|
|
38
|
+
To: "+1#{recipient}",
|
|
39
|
+
Body: content,
|
|
40
|
+
}.merge media_params_for(media).merge opt_params_for(opt).merge wallflower_params_for(wallflower)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
private
|
|
44
|
+
|
|
45
|
+
def self.media_params_for(media = [])
|
|
46
|
+
media.each_with_index.inject({ NumMedia: media.size.to_s }) do |hash, (item, index)|
|
|
47
|
+
url_key = "MediaUrl#{index}".to_sym
|
|
48
|
+
content_type_key = "MediaContentType#{index}".to_sym
|
|
49
|
+
hash.merge url_key => item[:url], content_type_key => item[:content_type]
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def self.opt_params_for(opt = nil)
|
|
54
|
+
case opt
|
|
55
|
+
when :out then { OptOutType: 'STOP' }
|
|
56
|
+
when :in then { OptOutType: 'START' }
|
|
57
|
+
else {}
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def self.wallflower_params_for(wallflower = nil)
|
|
62
|
+
wallflower ? { OtherRecipients0: "+1#{wallflower}" } : {}
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Enhances the Twilio Ruby gem with an object-oriented approach.
|
|
2
|
+
module Twi
|
|
3
|
+
# The representation of a participant in a (clasic) conversation.
|
|
4
|
+
class Participant < Resource
|
|
5
|
+
# @return [String] unique identifier.
|
|
6
|
+
def id = @params['ParticipantSid']
|
|
7
|
+
|
|
8
|
+
# @return [String] 10-digit phone number.
|
|
9
|
+
def phone = remove_prefix_from @params['MessagingBinding.Address']
|
|
10
|
+
|
|
11
|
+
# @return [String, nil] optional identifier.
|
|
12
|
+
def identity = @params['Identity']
|
|
13
|
+
end
|
|
14
|
+
end
|
data/lib/twi/resource.rb
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Enhances the Twilio Ruby gem with an object-oriented approach.
|
|
2
|
+
module Twi
|
|
3
|
+
# An abtract class for all Twilio resources.
|
|
4
|
+
class Resource
|
|
5
|
+
# @param params [ActionController::Parameters] the payload of Twilio hitting a callback URL.
|
|
6
|
+
def initialize(params = {})
|
|
7
|
+
@params = params
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
private
|
|
11
|
+
|
|
12
|
+
def remove_prefix_from(number) = number&.strip&.delete_prefix '+1'
|
|
13
|
+
end
|
|
14
|
+
end
|
data/lib/twi/version.rb
CHANGED
data/lib/twi.rb
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
require 'action_controller'
|
|
4
|
+
require 'action_controller/metal/strong_parameters'
|
|
5
|
+
require 'json'
|
|
6
|
+
require 'net/http'
|
|
7
|
+
require 'twilio-ruby'
|
|
8
|
+
|
|
9
|
+
require 'twi/lio'
|
|
10
|
+
require 'twi/config'
|
|
11
|
+
require 'twi/resource'
|
|
12
|
+
require 'twi/message'
|
|
13
|
+
require 'twi/delivery'
|
|
14
|
+
require 'twi/participant'
|
|
15
|
+
require 'twi/medium'
|
|
16
|
+
require 'twi/event'
|
metadata
CHANGED
|
@@ -1,63 +1,69 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: twi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
bindir: bin
|
|
7
|
+
- Claudio Baccigalupo
|
|
8
|
+
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
13
|
+
name: actionpack
|
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
|
16
15
|
requirements:
|
|
17
|
-
- - "
|
|
16
|
+
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
20
|
-
type: :
|
|
18
|
+
version: '0'
|
|
19
|
+
type: :runtime
|
|
21
20
|
prerelease: false
|
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
22
|
requirements:
|
|
24
|
-
- - "
|
|
23
|
+
- - ">="
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '
|
|
25
|
+
version: '0'
|
|
27
26
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
27
|
+
name: twilio-ruby
|
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
|
30
29
|
requirements:
|
|
31
30
|
- - ">="
|
|
32
31
|
- !ruby/object:Gem::Version
|
|
33
32
|
version: '0'
|
|
34
|
-
type: :
|
|
33
|
+
type: :runtime
|
|
35
34
|
prerelease: false
|
|
36
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
36
|
requirements:
|
|
38
37
|
- - ">="
|
|
39
38
|
- !ruby/object:Gem::Version
|
|
40
39
|
version: '0'
|
|
41
|
-
description:
|
|
40
|
+
description: Enhances OpenSSL::HMAC with timestamp.
|
|
42
41
|
email:
|
|
43
|
-
- claudiob@
|
|
42
|
+
- claudiob@users.noreply.github.com
|
|
44
43
|
executables: []
|
|
45
44
|
extensions: []
|
|
46
45
|
extra_rdoc_files: []
|
|
47
46
|
files:
|
|
48
|
-
-
|
|
49
|
-
- Gemfile
|
|
47
|
+
- CHANGELOG.md
|
|
50
48
|
- LICENSE.txt
|
|
51
49
|
- README.md
|
|
52
|
-
- Rakefile
|
|
53
50
|
- lib/twi.rb
|
|
51
|
+
- lib/twi/config.rb
|
|
52
|
+
- lib/twi/delivery.rb
|
|
53
|
+
- lib/twi/event.rb
|
|
54
|
+
- lib/twi/lio.rb
|
|
55
|
+
- lib/twi/medium.rb
|
|
56
|
+
- lib/twi/message.rb
|
|
57
|
+
- lib/twi/participant.rb
|
|
58
|
+
- lib/twi/resource.rb
|
|
54
59
|
- lib/twi/version.rb
|
|
55
|
-
|
|
56
|
-
homepage: ''
|
|
60
|
+
homepage: https://github.com/claudiob/twi
|
|
57
61
|
licenses:
|
|
58
62
|
- MIT
|
|
59
|
-
metadata:
|
|
60
|
-
|
|
63
|
+
metadata:
|
|
64
|
+
homepage_uri: https://github.com/claudiob/twi
|
|
65
|
+
source_code_uri: https://github.com/claudiob/twi
|
|
66
|
+
changelog_uri: https://github.com/claudiob/twi
|
|
61
67
|
rdoc_options: []
|
|
62
68
|
require_paths:
|
|
63
69
|
- lib
|
|
@@ -65,17 +71,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
65
71
|
requirements:
|
|
66
72
|
- - ">="
|
|
67
73
|
- !ruby/object:Gem::Version
|
|
68
|
-
version:
|
|
74
|
+
version: 3.2.0
|
|
69
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
76
|
requirements:
|
|
71
77
|
- - ">="
|
|
72
78
|
- !ruby/object:Gem::Version
|
|
73
79
|
version: '0'
|
|
74
80
|
requirements: []
|
|
75
|
-
|
|
76
|
-
rubygems_version: 2.2.2
|
|
77
|
-
signing_key:
|
|
81
|
+
rubygems_version: 4.0.3
|
|
78
82
|
specification_version: 4
|
|
79
|
-
summary:
|
|
83
|
+
summary: API Signature with timestamped MAC (Message Authentication Code).
|
|
80
84
|
test_files: []
|
|
81
|
-
has_rdoc:
|
data/.gitignore
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
*.gem
|
|
2
|
-
*.rbc
|
|
3
|
-
.bundle
|
|
4
|
-
.config
|
|
5
|
-
.yardoc
|
|
6
|
-
Gemfile.lock
|
|
7
|
-
InstalledFiles
|
|
8
|
-
_yardoc
|
|
9
|
-
coverage
|
|
10
|
-
doc/
|
|
11
|
-
lib/bundler/man
|
|
12
|
-
pkg
|
|
13
|
-
rdoc
|
|
14
|
-
spec/reports
|
|
15
|
-
test/tmp
|
|
16
|
-
test/version_tmp
|
|
17
|
-
tmp
|
|
18
|
-
*.bundle
|
|
19
|
-
*.so
|
|
20
|
-
*.o
|
|
21
|
-
*.a
|
|
22
|
-
mkmf.log
|
data/Gemfile
DELETED
data/Rakefile
DELETED
data/twi.gemspec
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
-
require 'twi/version'
|
|
5
|
-
|
|
6
|
-
Gem::Specification.new do |spec|
|
|
7
|
-
spec.name = "twi"
|
|
8
|
-
spec.version = Twi::VERSION
|
|
9
|
-
spec.authors = ["claudiob"]
|
|
10
|
-
spec.email = ["claudiob@gmail.com"]
|
|
11
|
-
spec.summary = %q{Write a short summary. Required.}
|
|
12
|
-
spec.description = %q{Write a longer description. Optional.}
|
|
13
|
-
spec.homepage = ""
|
|
14
|
-
spec.license = "MIT"
|
|
15
|
-
|
|
16
|
-
spec.files = `git ls-files -z`.split("\x0")
|
|
17
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
|
-
spec.require_paths = ["lib"]
|
|
20
|
-
|
|
21
|
-
spec.add_development_dependency "bundler", "~> 1.6"
|
|
22
|
-
spec.add_development_dependency "rake"
|
|
23
|
-
end
|