twilio-rails 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -14
- data/app/controllers/twilio/rails/phone_controller.rb +6 -2
- data/app/controllers/twilio/rails/sms_controller.rb +6 -5
- data/app/jobs/twilio/rails/phone/attach_recording_job.rb +1 -0
- data/app/jobs/twilio/rails/phone/finished_call_job.rb +1 -0
- data/app/jobs/twilio/rails/phone/unanswered_call_job.rb +1 -0
- data/app/operations/twilio/rails/application_operation.rb +2 -1
- data/app/operations/twilio/rails/find_or_create_phone_caller_operation.rb +2 -1
- data/app/operations/twilio/rails/phone/attach_recording_operation.rb +3 -2
- data/app/operations/twilio/rails/phone/base_operation.rb +1 -0
- data/app/operations/twilio/rails/phone/create_operation.rb +11 -8
- data/app/operations/twilio/rails/phone/find_operation.rb +1 -0
- data/app/operations/twilio/rails/phone/finished_call_operation.rb +2 -1
- data/app/operations/twilio/rails/phone/receive_recording_operation.rb +3 -2
- data/app/operations/twilio/rails/phone/start_call_operation.rb +15 -13
- data/app/operations/twilio/rails/phone/twiml/after_operation.rb +2 -1
- data/app/operations/twilio/rails/phone/twiml/base_operation.rb +11 -5
- data/app/operations/twilio/rails/phone/twiml/error_operation.rb +2 -1
- data/app/operations/twilio/rails/phone/twiml/greeting_operation.rb +3 -2
- data/app/operations/twilio/rails/phone/twiml/invalid_phone_number_operation.rb +25 -0
- data/app/operations/twilio/rails/phone/twiml/prompt_operation.rb +6 -5
- data/app/operations/twilio/rails/phone/twiml/prompt_response_operation.rb +2 -1
- data/app/operations/twilio/rails/phone/twiml/request_validation_failure_operation.rb +1 -0
- data/app/operations/twilio/rails/phone/twiml/timeout_operation.rb +5 -4
- data/app/operations/twilio/rails/phone/unanswered_call_operation.rb +2 -1
- data/app/operations/twilio/rails/phone/update_operation.rb +1 -0
- data/app/operations/twilio/rails/phone/update_response_operation.rb +1 -0
- data/app/operations/twilio/rails/sms/base_operation.rb +1 -0
- data/app/operations/twilio/rails/sms/create_operation.rb +2 -1
- data/app/operations/twilio/rails/sms/find_message_operation.rb +1 -0
- data/app/operations/twilio/rails/sms/find_operation.rb +1 -0
- data/app/operations/twilio/rails/sms/send_operation.rb +12 -12
- data/app/operations/twilio/rails/sms/twiml/base_operation.rb +1 -0
- data/app/operations/twilio/rails/sms/twiml/error_operation.rb +1 -0
- data/app/operations/twilio/rails/sms/twiml/message_operation.rb +4 -3
- data/app/operations/twilio/rails/sms/update_message_operation.rb +1 -0
- data/lib/generators/twilio/rails/install/install_generator.rb +1 -0
- data/lib/generators/twilio/rails/install/templates/initializer.rb +5 -8
- data/lib/generators/twilio/rails/install/templates/message.rb +1 -0
- data/lib/generators/twilio/rails/install/templates/phone_call.rb +1 -0
- data/lib/generators/twilio/rails/install/templates/phone_caller.rb +1 -0
- data/lib/generators/twilio/rails/install/templates/recording.rb +1 -0
- data/lib/generators/twilio/rails/install/templates/response.rb +1 -0
- data/lib/generators/twilio/rails/install/templates/sms_conversation.rb +1 -0
- data/lib/generators/twilio/rails/phone_tree/phone_tree_generator.rb +1 -0
- data/lib/generators/twilio/rails/sms_responder/sms_responder_generator.rb +1 -0
- data/lib/generators/twilio/rails/sms_responder/templates/responder.rb.erb +2 -2
- data/lib/tasks/rails_tasks.rake +6 -5
- data/lib/twilio/rails/client.rb +9 -8
- data/lib/twilio/rails/concerns/has_direction.rb +2 -1
- data/lib/twilio/rails/concerns/has_phone_number.rb +13 -4
- data/lib/twilio/rails/concerns/has_time_scopes.rb +1 -0
- data/lib/twilio/rails/configuration.rb +42 -40
- data/lib/twilio/rails/formatter.rb +35 -29
- data/lib/twilio/rails/models/message.rb +1 -0
- data/lib/twilio/rails/models/phone_call.rb +1 -0
- data/lib/twilio/rails/models/phone_caller.rb +4 -3
- data/lib/twilio/rails/models/recording.rb +1 -0
- data/lib/twilio/rails/models/response.rb +7 -6
- data/lib/twilio/rails/models/sms_conversation.rb +1 -0
- data/lib/twilio/rails/phone/base_tree.rb +8 -7
- data/lib/twilio/rails/phone/tree.rb +8 -7
- data/lib/twilio/rails/phone/tree_macros.rb +9 -9
- data/lib/twilio/rails/phone.rb +3 -2
- data/lib/twilio/rails/phone_number.rb +6 -5
- data/lib/twilio/rails/phone_number_formatter/north_america.rb +52 -0
- data/lib/twilio/rails/phone_number_formatter.rb +20 -0
- data/lib/twilio/rails/railtie.rb +6 -1
- data/lib/twilio/rails/sms/delegated_responder.rb +6 -5
- data/lib/twilio/rails/sms/responder.rb +3 -2
- data/lib/twilio/rails/sms.rb +3 -2
- data/lib/twilio/rails/version.rb +1 -1
- data/lib/twilio/rails.rb +12 -26
- metadata +20 -6
data/lib/twilio/rails.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require "forwardable"
|
1
2
|
require "active_operation"
|
2
3
|
require "twilio-ruby"
|
3
4
|
require "faraday"
|
@@ -8,13 +9,15 @@ require "twilio/rails/engine"
|
|
8
9
|
module Twilio
|
9
10
|
module Rails
|
10
11
|
# Base error class for all errors raised by the Twilio::Rails gem. Every error is a subclass of this one.
|
11
|
-
class Error < StandardError
|
12
|
+
class Error < StandardError; end
|
12
13
|
end
|
13
14
|
end
|
14
15
|
|
15
16
|
require "twilio/rails/railtie"
|
16
17
|
require "twilio/rails/configuration"
|
17
18
|
require "twilio/rails/formatter"
|
19
|
+
require "twilio/rails/phone_number_formatter"
|
20
|
+
require "twilio/rails/phone_number_formatter/north_america"
|
18
21
|
require "twilio/rails/phone_number"
|
19
22
|
require "twilio/rails/client"
|
20
23
|
|
@@ -40,7 +43,6 @@ require "twilio/rails/models/message"
|
|
40
43
|
module Twilio
|
41
44
|
module Rails
|
42
45
|
class << self
|
43
|
-
|
44
46
|
# Read and write accessible configuration object. In most cases this should only be read after the app has been
|
45
47
|
# initialized. See {Twilio::Rails::Configuration} for more information.
|
46
48
|
#
|
@@ -49,6 +51,14 @@ module Twilio
|
|
49
51
|
@config ||= ::Twilio::Rails::Configuration.new
|
50
52
|
end
|
51
53
|
|
54
|
+
# See the ActiveSupport::Deprecation documentation:
|
55
|
+
# https://api.rubyonrails.org/classes/ActiveSupport/Deprecation.html
|
56
|
+
#
|
57
|
+
# @return [ActiveSupport::Deprecation] the deprecator for the engine.
|
58
|
+
def deprecator
|
59
|
+
@deprecator ||= ActiveSupport::Deprecation.new("2.0", "Twilio::Rails")
|
60
|
+
end
|
61
|
+
|
52
62
|
# Called in the `config/initializers/twilio_rails.rb` file to configure the engine. This yields the {.config}
|
53
63
|
# object above and then calls {Twilio::Rails::Configuration#validate!} to ensure the configuration is valid.
|
54
64
|
#
|
@@ -60,30 +70,6 @@ module Twilio
|
|
60
70
|
config.validate!
|
61
71
|
nil
|
62
72
|
end
|
63
|
-
|
64
|
-
# Abstraction for the framework to notify of an important exception that has occurred. This safely calls the
|
65
|
-
# configured `config.exception_notifier` or does nothing if it is set to `nil`. This does not catch, handle, or
|
66
|
-
# prevent the exception from raising.
|
67
|
-
#
|
68
|
-
# @param exception [Exception] the exception that has occurred.
|
69
|
-
# @param message [String] a description of the exception, defaults to `exception.message` if blank.
|
70
|
-
# @param context [Hash] a hash of arbitrary additional context to include in the notification.
|
71
|
-
# @param exception_binding [Binding] the binding of where the exception is being notified.
|
72
|
-
# @return [true, false] if an exception has been successfully notified.
|
73
|
-
def notify_exception(exception, message: nil, context: {}, exception_binding: nil)
|
74
|
-
if config.exception_notifier
|
75
|
-
begin
|
76
|
-
message = message.presence || exception.message
|
77
|
-
config.exception_notifier.call(exception, message, context, exception_binding)
|
78
|
-
true
|
79
|
-
rescue => e
|
80
|
-
config.logger.tagged(self.class) { |l| l.error("ExceptionNotifier failed to notify of exception=#{ exception.inspect } message=#{ message.inspect } context=#{ context.inspect }") }
|
81
|
-
false
|
82
|
-
end
|
83
|
-
else
|
84
|
-
false
|
85
|
-
end
|
86
|
-
end
|
87
73
|
end
|
88
74
|
end
|
89
75
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twilio-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin McPhillips
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-02-21 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: rails
|
@@ -164,6 +163,20 @@ dependencies:
|
|
164
163
|
- - ">="
|
165
164
|
- !ruby/object:Gem::Version
|
166
165
|
version: '0'
|
166
|
+
- !ruby/object:Gem::Dependency
|
167
|
+
name: standardrb
|
168
|
+
requirement: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '0'
|
173
|
+
type: :development
|
174
|
+
prerelease: false
|
175
|
+
version_requirements: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '0'
|
167
180
|
description: A Rails engine that provides the framework to build complex phone interactions
|
168
181
|
using the Twilio API.
|
169
182
|
email:
|
@@ -201,6 +214,7 @@ files:
|
|
201
214
|
- app/operations/twilio/rails/phone/twiml/base_operation.rb
|
202
215
|
- app/operations/twilio/rails/phone/twiml/error_operation.rb
|
203
216
|
- app/operations/twilio/rails/phone/twiml/greeting_operation.rb
|
217
|
+
- app/operations/twilio/rails/phone/twiml/invalid_phone_number_operation.rb
|
204
218
|
- app/operations/twilio/rails/phone/twiml/prompt_operation.rb
|
205
219
|
- app/operations/twilio/rails/phone/twiml/prompt_response_operation.rb
|
206
220
|
- app/operations/twilio/rails/phone/twiml/request_validation_failure_operation.rb
|
@@ -255,6 +269,8 @@ files:
|
|
255
269
|
- lib/twilio/rails/phone/tree.rb
|
256
270
|
- lib/twilio/rails/phone/tree_macros.rb
|
257
271
|
- lib/twilio/rails/phone_number.rb
|
272
|
+
- lib/twilio/rails/phone_number_formatter.rb
|
273
|
+
- lib/twilio/rails/phone_number_formatter/north_america.rb
|
258
274
|
- lib/twilio/rails/railtie.rb
|
259
275
|
- lib/twilio/rails/sms.rb
|
260
276
|
- lib/twilio/rails/sms/delegated_responder.rb
|
@@ -269,7 +285,6 @@ metadata:
|
|
269
285
|
changelog_uri: https://github.com/kmcphillips/twilio-rails/blob/main/CHANGELOG.md
|
270
286
|
documentation_uri: https://rubydoc.info/gems/twilio-rails
|
271
287
|
rubygems_mfa_required: 'true'
|
272
|
-
post_install_message:
|
273
288
|
rdoc_options: []
|
274
289
|
require_paths:
|
275
290
|
- lib
|
@@ -284,8 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
284
299
|
- !ruby/object:Gem::Version
|
285
300
|
version: '0'
|
286
301
|
requirements: []
|
287
|
-
rubygems_version: 3.
|
288
|
-
signing_key:
|
302
|
+
rubygems_version: 3.6.2
|
289
303
|
specification_version: 4
|
290
304
|
summary: A framework for building rich phone interactions in Rails using Twilio.
|
291
305
|
test_files: []
|