twilio-ruby 4.0.1 → 4.1.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 +8 -8
- data/CHANGES.md +7 -0
- data/README.md +1 -1
- data/lib/twilio-ruby.rb +3 -0
- data/lib/twilio-ruby/rest/monitor/alerts.rb +8 -0
- data/lib/twilio-ruby/rest/monitor/events.rb +8 -0
- data/lib/twilio-ruby/rest/monitor_client.rb +101 -0
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/rest/monitor_client_spec.rb +17 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzBkNGUyMmQ2NjBlNTExYzliMDZhOTNmYjBhMGUzNjVmOTJmMmMxZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Nzc0NWViMGU0MTc5YzMxYzljYWYwYjAyNTkwNjAyYjFlY2MwZWZkNg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDhhNDkzNmI4NDU4ZTUwNTg5Y2ViZTlkMzFjODM4ZmFlOWFlMzI3M2Y1NmNi
|
10
|
+
MjllNDI0NDg3NjQyNTc3ZGQ1MGJiM2Y1YWM0NzQ3YThlMTE4YTQ5ZjcwN2Ni
|
11
|
+
YTg1MDZmOTUxYzdiNzNiYmY5NTVkNTY4MzA5MzRiZDMwZjdkNGQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzE3OWY0ODBjNjhiODJkMDVmMjgxNzk1MDc1NDhiMjk1YTEyMDU2YjI3YWE3
|
14
|
+
YWQ4ODc1MWZlZGY1Y2FiNWIwOWMwNWVhMTYzOTZkNGFjODliMzE2MDdlOGIx
|
15
|
+
NGU2NWQwOWJhYWJjMzA1N2M3NzgyYWMzYTdlNGE4YmMzYTY3ZjA=
|
data/CHANGES.md
CHANGED
data/README.md
CHANGED
@@ -11,7 +11,7 @@ A module for using the Twilio REST API and generating valid [TwiML](http://www.t
|
|
11
11
|
To install using [Bundler][bundler] grab the latest stable version:
|
12
12
|
|
13
13
|
```ruby
|
14
|
-
gem 'twilio-ruby', '~> 4.0
|
14
|
+
gem 'twilio-ruby', '~> 4.1.0'
|
15
15
|
```
|
16
16
|
|
17
17
|
To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
|
data/lib/twilio-ruby.rb
CHANGED
@@ -52,6 +52,8 @@ require 'twilio-ruby/rest/task_router/workflows'
|
|
52
52
|
require 'twilio-ruby/rest/task_router/workspaces'
|
53
53
|
require 'twilio-ruby/rest/task_router/workspace_statistics'
|
54
54
|
require 'twilio-ruby/rest/lookups/phone_numbers'
|
55
|
+
require 'twilio-ruby/rest/monitor/events'
|
56
|
+
require 'twilio-ruby/rest/monitor/alerts'
|
55
57
|
require 'twilio-ruby/rest/media'
|
56
58
|
require 'twilio-ruby/rest/messages'
|
57
59
|
require 'twilio-ruby/rest/applications'
|
@@ -84,6 +86,7 @@ require 'twilio-ruby/rest/client'
|
|
84
86
|
require 'twilio-ruby/rest/task_router_client'
|
85
87
|
require 'twilio-ruby/rest/lookups_client'
|
86
88
|
require 'twilio-ruby/rest/pricing_client'
|
89
|
+
require 'twilio-ruby/rest/monitor_client'
|
87
90
|
require 'rack/twilio_webhook_authentication'
|
88
91
|
|
89
92
|
module Twilio
|
@@ -0,0 +1,101 @@
|
|
1
|
+
require 'twilio-ruby/rest/base_client'
|
2
|
+
module Twilio
|
3
|
+
module REST
|
4
|
+
class MonitorClient < BaseClient
|
5
|
+
API_VERSION = 'v1'
|
6
|
+
|
7
|
+
attr_reader :events
|
8
|
+
attr_reader :alerts
|
9
|
+
|
10
|
+
host 'monitor.twilio.com'
|
11
|
+
|
12
|
+
##
|
13
|
+
# Instantiate a new HTTP Monitor client to talk to Twilio. The parameters
|
14
|
+
# +account_sid+, +auth_token+ are required, unless you have configured
|
15
|
+
# them already using the block configure syntax, and used to generate the
|
16
|
+
# HTTP basic auth header in each request. The +options+ parameter is a
|
17
|
+
# hash of connection configuration options. the following keys are
|
18
|
+
# supported:
|
19
|
+
#
|
20
|
+
# === <tt>host: 'monitor.twilio.com'</tt>
|
21
|
+
#
|
22
|
+
# The domain to which you'd like the client to make HTTP requests. Useful
|
23
|
+
# for testing. Defaults to 'monitor.twilio.com'.
|
24
|
+
#
|
25
|
+
# === <tt>port: 443</tt>
|
26
|
+
#
|
27
|
+
# The port on which to connect to the above domain. Defaults to 443 and
|
28
|
+
# should be left that way except in testing environments.
|
29
|
+
#
|
30
|
+
# === <tt>use_ssl: true</tt>
|
31
|
+
#
|
32
|
+
# Declare whether ssl should be used for connections to the above domain.
|
33
|
+
# Defaults to true and should be left alone except when testing.
|
34
|
+
#
|
35
|
+
# === <tt>ssl_verify_peer: true</tt>
|
36
|
+
#
|
37
|
+
# Declare whether to verify the host's ssl cert when setting up the
|
38
|
+
# connection to the above domain. Defaults to true, but can be turned off
|
39
|
+
# to avoid ssl certificate verification failures in environments without
|
40
|
+
# the necessary ca certificates.
|
41
|
+
#
|
42
|
+
# === <tt>ssl_ca_file: '/path/to/ca/file'</tt>
|
43
|
+
#
|
44
|
+
# Specify the path to the certificate authority bundle you'd like to use
|
45
|
+
# to verify Twilio's SSL certificate on each request. If not specified, a
|
46
|
+
# certificate bundle extraced from Firefox is packaged with the gem and
|
47
|
+
# used by default.
|
48
|
+
#
|
49
|
+
# === <tt>timeout: 30</tt>
|
50
|
+
#
|
51
|
+
# Set the time in seconds to wait before timing out the HTTP request.
|
52
|
+
# Defaults to 30 seconds. If you aren't fetching giant pages of call or
|
53
|
+
# SMS logs you can safely decrease this to something like 3 seconds or
|
54
|
+
# lower. In paricular if you are sending SMS you can set this to 1 second
|
55
|
+
# or less and swallow the exception if you don't care about the response.
|
56
|
+
#
|
57
|
+
# === <tt>proxy_addr: 'proxy.host.domain'</tt>
|
58
|
+
#
|
59
|
+
# The domain of a proxy through which you'd like the client to make HTTP
|
60
|
+
# requests. Defaults to nil.
|
61
|
+
#
|
62
|
+
# === <tt>proxy_port: 3128</tt>
|
63
|
+
#
|
64
|
+
# The port on which to connect to the above proxy. Defaults to nil.
|
65
|
+
#
|
66
|
+
# === <tt>proxy_user: 'username'</tt>
|
67
|
+
#
|
68
|
+
# The user name to use for authentication with the proxy. Defaults to nil.
|
69
|
+
#
|
70
|
+
# === <tt>proxy_pass: 'password'</tt>
|
71
|
+
#
|
72
|
+
# The password to use for authentication with the proxy. Defaults to nil.
|
73
|
+
#
|
74
|
+
# === <tt>retry_limit: 1</tt>
|
75
|
+
#
|
76
|
+
# The number of times to retry a request that has failed before throwing
|
77
|
+
# an exception. Defaults to one.
|
78
|
+
def inspect # :nodoc:
|
79
|
+
"<Twilio::REST::MonitorClient @account_sid=#{@account_sid}>"
|
80
|
+
end
|
81
|
+
|
82
|
+
protected
|
83
|
+
|
84
|
+
##
|
85
|
+
# Set up +events+ attribute.
|
86
|
+
def set_up_subresources # :doc:
|
87
|
+
@events = Twilio::REST::Monitor::Events.new "/#{API_VERSION}/Events", self
|
88
|
+
@alerts = Twilio::REST::Monitor::Alerts.new "/#{API_VERSION}/Alerts", self
|
89
|
+
end
|
90
|
+
|
91
|
+
##
|
92
|
+
# Builds up full request path
|
93
|
+
def build_full_path(path, params, method)
|
94
|
+
path = path.dup
|
95
|
+
path << "?#{url_encode(params)}" if method == :get && !params.empty?
|
96
|
+
path
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
data/lib/twilio-ruby/version.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Twilio::REST::MonitorClient do
|
4
|
+
before do
|
5
|
+
@client = Twilio::REST::MonitorClient.new('AC123', 'foobar')
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'should set up an event resources object' do
|
9
|
+
expect(@client).to respond_to(:events)
|
10
|
+
expect(@client.events.instance_variable_get('@path')).to eq('/v1/Events')
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should set up an alert resources object' do
|
14
|
+
expect(@client).to respond_to(:alerts)
|
15
|
+
expect(@client.alerts.instance_variable_get('@path')).to eq('/v1/Alerts')
|
16
|
+
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twilio-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Benton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -159,6 +159,9 @@ files:
|
|
159
159
|
- lib/twilio-ruby/rest/lookups_client.rb
|
160
160
|
- lib/twilio-ruby/rest/media.rb
|
161
161
|
- lib/twilio-ruby/rest/messages.rb
|
162
|
+
- lib/twilio-ruby/rest/monitor/alerts.rb
|
163
|
+
- lib/twilio-ruby/rest/monitor/events.rb
|
164
|
+
- lib/twilio-ruby/rest/monitor_client.rb
|
162
165
|
- lib/twilio-ruby/rest/next_gen_list_resource.rb
|
163
166
|
- lib/twilio-ruby/rest/notifications.rb
|
164
167
|
- lib/twilio-ruby/rest/outgoing_caller_ids.rb
|
@@ -223,6 +226,7 @@ files:
|
|
223
226
|
- spec/rest/instance_resource_spec.rb
|
224
227
|
- spec/rest/lookups/phone_number_spec.rb
|
225
228
|
- spec/rest/message_spec.rb
|
229
|
+
- spec/rest/monitor_client_spec.rb
|
226
230
|
- spec/rest/numbers_spec.rb
|
227
231
|
- spec/rest/pricing_client_spec.rb
|
228
232
|
- spec/rest/queue_spec.rb
|
@@ -286,6 +290,7 @@ test_files:
|
|
286
290
|
- spec/rest/instance_resource_spec.rb
|
287
291
|
- spec/rest/lookups/phone_number_spec.rb
|
288
292
|
- spec/rest/message_spec.rb
|
293
|
+
- spec/rest/monitor_client_spec.rb
|
289
294
|
- spec/rest/numbers_spec.rb
|
290
295
|
- spec/rest/pricing_client_spec.rb
|
291
296
|
- spec/rest/queue_spec.rb
|