twilio-rb 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +13 -11
- data/lib/railtie.rb +1 -1
- metadata +36 -25
data/README.md
CHANGED
@@ -40,7 +40,7 @@ Any method that calls the Twilio API will raise `Twilio::ConfigurationError` if
|
|
40
40
|
|
41
41
|
## Summary
|
42
42
|
|
43
|
-
Twilio resources are represented as Ruby objects. List resources are
|
43
|
+
Twilio resources are represented as Ruby objects. List resources are represented by classes, e.g. `Twilio::SMS` and operations on list resources are performed using class methods, e.g. `Twilio::SMS.create`. Resource instances are represented by instances of those classes, and operations on those resource instances are performed using instance methods.
|
44
44
|
|
45
45
|
Resources that can be created via the API, using the HTTP POST verb can be done so in the library using the `.create` class method, e.g.
|
46
46
|
|
@@ -56,11 +56,11 @@ Twilio::Notification.all.each &:destroy
|
|
56
56
|
|
57
57
|
Object representations instantiated by the library respond to all methods that match attributes on its corresponding resource. The method names are those of the parameters in snake case (underscored), i.e. as they are returned in the JSON representation.
|
58
58
|
|
59
|
-
The Twilio API documentation itself is the canonical reference for which resources have what properties, and which of those can be updated by the API. Please refer to the Twilio REST API documentation for
|
59
|
+
The Twilio API documentation itself is the canonical reference for which resources have what properties, and which of those can be updated by the API. Please refer to the Twilio REST API documentation for that information.
|
60
60
|
|
61
61
|
## Accessing resource instances
|
62
62
|
|
63
|
-
Resource instances can be accessed ad hoc
|
63
|
+
Resource instances can be accessed ad hoc passing the resource sid to the `.find` class method on the resource class, e.g.
|
64
64
|
|
65
65
|
<pre>call = Twilio::Call.find 'CAe1644a7eed5088b159577c5802d8be38'</pre>
|
66
66
|
|
@@ -92,7 +92,7 @@ Twilio does some fancy stuff to implement date ranges, consider the API request:
|
|
92
92
|
|
93
93
|
<pre>GET /2010-04-01/Accounts/AC5ef87.../Calls?StartTime>=2009-07-06&EndTime<=2009-07-10</pre>
|
94
94
|
|
95
|
-
This will return all calls started after midnight July 06th 2009 and completed before July 10th 2009. Any call started and ended within that time range matches those criteria and will be returned. To make the same
|
95
|
+
This will return all calls started after midnight July 06th 2009 and completed before July 10th 2009. Any call started and ended within that time range matches those criteria and will be returned. To make the same request using this library:
|
96
96
|
|
97
97
|
<pre>
|
98
98
|
require 'date'
|
@@ -101,14 +101,14 @@ start_date, end_date = Date.parse('2009-07-06'), Date.parse('2009-07-10')
|
|
101
101
|
Twilio::Call.all :started_after => start_date, :ended_before => end_date
|
102
102
|
</pre>
|
103
103
|
|
104
|
-
All option parameters pertaining to dates accept a string or any object that returns a RFC 2822 date when `#to_s` is called on it, e.g. an instance of `Date`. If a date parameter is not a
|
104
|
+
All option parameters pertaining to dates accept a string or any object that returns a RFC 2822 date when `#to_s` is called on it, e.g. an instance of `Date`. If a date parameter is not a range but absolute, one can of course use the normal option, e.g.
|
105
105
|
|
106
106
|
<pre>Twilio::Call.all :start_time => start_date</pre>
|
107
107
|
|
108
108
|
The key names for these Date filters are inconsistent across resources, in the library they are:
|
109
109
|
|
110
110
|
<pre>
|
111
|
-
Twilio::SMS.all :created_before => date, :created_after => date, :sent_before => date, :sent_after # :"created_#{when}" and :"sent_#{when}" are
|
111
|
+
Twilio::SMS.all :created_before => date, :created_after => date, :sent_before => date, :sent_after # :"created_#{when}" and :"sent_#{when}" are synonymous
|
112
112
|
Twilio::Notification.all :created_before => date, :created_after => date
|
113
113
|
Twilio::Call.all :started_before => date, :started_after => date, :ended_before => date, :ended_after => date
|
114
114
|
</pre>
|
@@ -223,7 +223,7 @@ Twilio::CapabilityToken.create \
|
|
223
223
|
|
224
224
|
# Twilio Connect
|
225
225
|
|
226
|
-
With Twilio Connect you can attribute Twilio usage to accounts of customers that have
|
226
|
+
With Twilio Connect you can attribute Twilio usage to accounts of customers that have authorized you to perform API calls on there behalf. twilio-rb supports Twilio Connect. To make an API call using a Twilio Connect account, two extra parameters are required, `account_sid` and `connect`
|
227
227
|
|
228
228
|
<pre>
|
229
229
|
Twilio::SMS.create to: '+12125551234', from: '+6165550000', body: 'this will not be billed to the application developer',
|
@@ -279,7 +279,7 @@ bobs_account.sms.create :to => '+16465551234', :from => '+19175550000', :body =>
|
|
279
279
|
|
280
280
|
# Building TwiML documents
|
281
281
|
|
282
|
-
A TwiML document is an XML document. The best way to build XML in Ruby is with Builder, and so it follows that we should use builder for TwiML. `Twilio::TwiML.build` behaves like builder except element names are
|
282
|
+
A TwiML document is an XML document. The best way to build XML in Ruby is with Builder, and so it follows that we should use builder for TwiML. `Twilio::TwiML.build` behaves like builder except element names are capitalized for you and attributes are camelized for you as well. This is so you may continue to write beautiful code.
|
283
283
|
|
284
284
|
The following Ruby code:
|
285
285
|
|
@@ -313,7 +313,7 @@ Therefore emits the following TwiML document:
|
|
313
313
|
</Response>
|
314
314
|
</pre>
|
315
315
|
|
316
|
-
This
|
316
|
+
This specialized behaviour only affects `Twilio::TwiML.build` and does not affect Builder in general.
|
317
317
|
|
318
318
|
# Rails 3 integration
|
319
319
|
|
@@ -344,7 +344,7 @@ The participants list resource is a subresource of a conference resource instanc
|
|
344
344
|
|
345
345
|
<pre>conference = Twilio::Conference.find 'CFbbe46ff1274e283f7e3ac1df0072ab39'</pre>
|
346
346
|
|
347
|
-
Conference participants are accessed via the `#
|
347
|
+
Conference participants are accessed via the `#participants` instance method, e.g.
|
348
348
|
|
349
349
|
<pre>participants = conference.participants</pre>
|
350
350
|
|
@@ -362,7 +362,7 @@ To access properties of a singleton object the property name should be called as
|
|
362
362
|
|
363
363
|
<pre>Twilio::Sandobox.friendly_name</pre>
|
364
364
|
|
365
|
-
The first time a method is invoked on the object an API call is made to retrieve the data. The methods themselves are not defined until they are called, i.e. lazy evaluation. This strategy means that
|
365
|
+
The first time a method is invoked on the object an API call is made to retrieve the data. The methods themselves are not defined until they are called, i.e. lazy evaluation. This strategy means that additional properties added to subsequent versions of the API should not break the library.
|
366
366
|
|
367
367
|
Please refer to the Twilio REST API documentation for an up to date list of properties that the sandbox resource implements
|
368
368
|
|
@@ -394,3 +394,5 @@ A recording resource instance has an extra instance method: `#mp3` this returns
|
|
394
394
|
* Dan Imrie-Situnayake
|
395
395
|
* John Trupiano
|
396
396
|
* Aaron Lerch
|
397
|
+
* Joël Franusic
|
398
|
+
* Mark Burns
|
data/lib/railtie.rb
CHANGED
@@ -26,7 +26,7 @@ module Twilio
|
|
26
26
|
ActionController::Base.class_eval { before_filter Twilio::RequestFilter }
|
27
27
|
|
28
28
|
::ActionView::Template.register_template_handler(:voice, ActionView::Template::Handlers::TwiML)
|
29
|
-
::Mime::Type.
|
29
|
+
::Mime::Type.register 'text/xml', :voice
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twilio-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-20 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
|
-
requirement: &
|
16
|
+
requirement: &70246567007180 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70246567007180
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: i18n
|
27
|
-
requirement: &
|
27
|
+
requirement: &70246567006680 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,21 +32,32 @@ dependencies:
|
|
32
32
|
version: '0.5'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70246567006680
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: httparty
|
38
|
-
requirement: &
|
38
|
+
requirement: &70246567006200 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
|
-
- -
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.10.0
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70246567006200
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: crack
|
49
|
+
requirement: &70246567005740 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
42
53
|
- !ruby/object:Gem::Version
|
43
|
-
version: 0.
|
54
|
+
version: 0.3.2
|
44
55
|
type: :runtime
|
45
56
|
prerelease: false
|
46
|
-
version_requirements: *
|
57
|
+
version_requirements: *70246567005740
|
47
58
|
- !ruby/object:Gem::Dependency
|
48
59
|
name: builder
|
49
|
-
requirement: &
|
60
|
+
requirement: &70246567005280 !ruby/object:Gem::Requirement
|
50
61
|
none: false
|
51
62
|
requirements:
|
52
63
|
- - ! '>='
|
@@ -54,10 +65,10 @@ dependencies:
|
|
54
65
|
version: 2.1.2
|
55
66
|
type: :runtime
|
56
67
|
prerelease: false
|
57
|
-
version_requirements: *
|
68
|
+
version_requirements: *70246567005280
|
58
69
|
- !ruby/object:Gem::Dependency
|
59
70
|
name: jwt
|
60
|
-
requirement: &
|
71
|
+
requirement: &70246567004800 !ruby/object:Gem::Requirement
|
61
72
|
none: false
|
62
73
|
requirements:
|
63
74
|
- - ! '>='
|
@@ -65,10 +76,10 @@ dependencies:
|
|
65
76
|
version: 0.1.3
|
66
77
|
type: :runtime
|
67
78
|
prerelease: false
|
68
|
-
version_requirements: *
|
79
|
+
version_requirements: *70246567004800
|
69
80
|
- !ruby/object:Gem::Dependency
|
70
81
|
name: webmock
|
71
|
-
requirement: &
|
82
|
+
requirement: &70246567004340 !ruby/object:Gem::Requirement
|
72
83
|
none: false
|
73
84
|
requirements:
|
74
85
|
- - ! '>='
|
@@ -76,10 +87,10 @@ dependencies:
|
|
76
87
|
version: 1.6.1
|
77
88
|
type: :development
|
78
89
|
prerelease: false
|
79
|
-
version_requirements: *
|
90
|
+
version_requirements: *70246567004340
|
80
91
|
- !ruby/object:Gem::Dependency
|
81
92
|
name: rspec
|
82
|
-
requirement: &
|
93
|
+
requirement: &70246567003860 !ruby/object:Gem::Requirement
|
83
94
|
none: false
|
84
95
|
requirements:
|
85
96
|
- - ! '>='
|
@@ -87,10 +98,10 @@ dependencies:
|
|
87
98
|
version: 2.2.0
|
88
99
|
type: :development
|
89
100
|
prerelease: false
|
90
|
-
version_requirements: *
|
101
|
+
version_requirements: *70246567003860
|
91
102
|
- !ruby/object:Gem::Dependency
|
92
103
|
name: mocha
|
93
|
-
requirement: &
|
104
|
+
requirement: &70246567003400 !ruby/object:Gem::Requirement
|
94
105
|
none: false
|
95
106
|
requirements:
|
96
107
|
- - ! '>='
|
@@ -98,10 +109,10 @@ dependencies:
|
|
98
109
|
version: 0.9.10
|
99
110
|
type: :development
|
100
111
|
prerelease: false
|
101
|
-
version_requirements: *
|
112
|
+
version_requirements: *70246567003400
|
102
113
|
- !ruby/object:Gem::Dependency
|
103
114
|
name: timecop
|
104
|
-
requirement: &
|
115
|
+
requirement: &70246567002940 !ruby/object:Gem::Requirement
|
105
116
|
none: false
|
106
117
|
requirements:
|
107
118
|
- - ! '>='
|
@@ -109,10 +120,10 @@ dependencies:
|
|
109
120
|
version: 0.3.5
|
110
121
|
type: :development
|
111
122
|
prerelease: false
|
112
|
-
version_requirements: *
|
123
|
+
version_requirements: *70246567002940
|
113
124
|
- !ruby/object:Gem::Dependency
|
114
125
|
name: rake
|
115
|
-
requirement: &
|
126
|
+
requirement: &70246567002480 !ruby/object:Gem::Requirement
|
116
127
|
none: false
|
117
128
|
requirements:
|
118
129
|
- - ~>
|
@@ -120,7 +131,7 @@ dependencies:
|
|
120
131
|
version: 0.8.7
|
121
132
|
type: :development
|
122
133
|
prerelease: false
|
123
|
-
version_requirements: *
|
134
|
+
version_requirements: *70246567002480
|
124
135
|
description: A nice Ruby wrapper for the Twilio REST API
|
125
136
|
email: sjtgraham@mac.com
|
126
137
|
executables: []
|
@@ -177,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
188
|
version: '0'
|
178
189
|
requirements: []
|
179
190
|
rubyforge_project:
|
180
|
-
rubygems_version: 1.8.
|
191
|
+
rubygems_version: 1.8.6
|
181
192
|
signing_key:
|
182
193
|
specification_version: 3
|
183
194
|
summary: Interact with the Twilio API in a nice Ruby way.
|