twilio-ruby 3.10.1 → 3.11.0
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS.md +24 -0
- data/CHANGES +11 -0
- data/Makefile +13 -0
- data/README.md +28 -13
- data/docs/Makefile +130 -0
- data/docs/_themes/LICENSE +45 -0
- data/docs/_themes/README.rst +25 -0
- data/docs/_themes/flask_theme_support.py +86 -0
- data/docs/_themes/kr/layout.html +32 -0
- data/docs/_themes/kr/relations.html +19 -0
- data/docs/_themes/kr/static/flasky.css_t +469 -0
- data/docs/_themes/kr/static/small_flask.css +70 -0
- data/docs/_themes/kr/theme.conf +7 -0
- data/docs/_themes/kr_small/layout.html +22 -0
- data/docs/_themes/kr_small/static/flasky.css_t +287 -0
- data/docs/_themes/kr_small/theme.conf +10 -0
- data/docs/changelog.rst +1 -0
- data/docs/conf.py +266 -0
- data/docs/faq.rst +42 -0
- data/docs/getting-started.rst +91 -0
- data/docs/index.rst +108 -0
- data/docs/make.bat +170 -0
- data/docs/src/pip-delete-this-directory.txt +5 -0
- data/docs/usage/accounts.rst +89 -0
- data/docs/usage/applications.rst +108 -0
- data/docs/usage/basics.rst +81 -0
- data/docs/usage/caller-ids.rst +45 -0
- data/docs/usage/conferences.rst +108 -0
- data/docs/usage/messages.rst +110 -0
- data/docs/usage/notifications.rst +70 -0
- data/docs/usage/phone-calls.rst +168 -0
- data/docs/usage/phone-numbers.rst +159 -0
- data/docs/usage/queues.rst +112 -0
- data/docs/usage/recordings.rst +96 -0
- data/docs/usage/sip.rst +103 -0
- data/docs/usage/token-generation.rst +81 -0
- data/docs/usage/transcriptions.rst +31 -0
- data/docs/usage/twiml.rst +70 -0
- data/docs/usage/validation.rst +71 -0
- data/examples/examples.rb +8 -5
- data/lib/twilio-ruby.rb +10 -0
- data/lib/twilio-ruby/rest/accounts.rb +1 -1
- data/lib/twilio-ruby/rest/instance_resource.rb +2 -1
- data/lib/twilio-ruby/rest/list_resource.rb +4 -1
- data/lib/twilio-ruby/rest/media.rb +14 -0
- data/lib/twilio-ruby/rest/messages.rb +12 -0
- data/lib/twilio-ruby/rest/sip.rb +12 -0
- data/lib/twilio-ruby/rest/sip/credential_lists.rb +11 -0
- data/lib/twilio-ruby/rest/sip/credential_lists/credentials.rb +6 -0
- data/lib/twilio-ruby/rest/sip/domains.rb +12 -0
- data/lib/twilio-ruby/rest/sip/domains/credential_list_mappings.rb +6 -0
- data/lib/twilio-ruby/rest/sip/domains/ip_access_control_list_mappings.rb +6 -0
- data/lib/twilio-ruby/rest/sip/ip_access_control_lists.rb +11 -0
- data/lib/twilio-ruby/rest/sip/ip_access_control_lists/ip_addresses.rb +6 -0
- data/lib/twilio-ruby/rest/sms.rb +1 -1
- data/lib/twilio-ruby/rest/usage/records.rb +1 -1
- data/lib/twilio-ruby/rest/utils.rb +1 -1
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/rest/message_spec.rb +12 -0
- metadata +52 -2
data/examples/examples.rb
CHANGED
@@ -50,16 +50,19 @@ end
|
|
50
50
|
|
51
51
|
################ SMS MESSAGES ################
|
52
52
|
|
53
|
-
# print a list of
|
54
|
-
@account.
|
55
|
-
puts
|
53
|
+
# print a list of messages
|
54
|
+
@account.messages.list({:date_sent => '2010-09-01'}).each do |message|
|
55
|
+
puts message.body
|
56
56
|
end
|
57
57
|
|
58
58
|
# print a particular sms message
|
59
|
-
puts @account.
|
59
|
+
puts @account.messages.get('SMXXXXXXXX').body
|
60
60
|
|
61
61
|
# send an sms
|
62
|
-
@account.
|
62
|
+
@account.messages.create(:from => '+14159341234', :to => '+16105557069', :body => 'Hey there!')
|
63
|
+
|
64
|
+
# send an mms
|
65
|
+
@account.messages.create(:from => '+14159341234', :to => '+16105557069', :media_urls => 'http://example.com/media.png')
|
63
66
|
|
64
67
|
################ PHONE NUMBERS ################
|
65
68
|
|
data/lib/twilio-ruby.rb
CHANGED
@@ -22,6 +22,16 @@ require 'twilio-ruby/rest/calls'
|
|
22
22
|
require 'twilio-ruby/rest/sms'
|
23
23
|
require 'twilio-ruby/rest/sms/messages'
|
24
24
|
require 'twilio-ruby/rest/sms/short_codes'
|
25
|
+
require 'twilio-ruby/rest/sip'
|
26
|
+
require 'twilio-ruby/rest/sip/domains'
|
27
|
+
require 'twilio-ruby/rest/sip/domains/ip_access_control_list_mappings'
|
28
|
+
require 'twilio-ruby/rest/sip/domains/credential_list_mappings'
|
29
|
+
require 'twilio-ruby/rest/sip/credential_lists'
|
30
|
+
require 'twilio-ruby/rest/sip/credential_lists/credentials'
|
31
|
+
require 'twilio-ruby/rest/sip/ip_access_control_lists'
|
32
|
+
require 'twilio-ruby/rest/sip/ip_access_control_lists/ip_addresses'
|
33
|
+
require 'twilio-ruby/rest/media'
|
34
|
+
require 'twilio-ruby/rest/messages'
|
25
35
|
require 'twilio-ruby/rest/applications'
|
26
36
|
require 'twilio-ruby/rest/connect_apps'
|
27
37
|
require 'twilio-ruby/rest/authorized_connect_apps'
|
@@ -8,7 +8,7 @@ module Twilio
|
|
8
8
|
resource :sandbox, :available_phone_numbers, :incoming_phone_numbers,
|
9
9
|
:calls, :outgoing_caller_ids, :conferences, :sms, :recordings,
|
10
10
|
:transcriptions, :notifications, :applications, :connect_apps,
|
11
|
-
:authorized_connect_apps, :queues, :usage
|
11
|
+
:authorized_connect_apps, :queues, :usage, :messages, :media, :sip
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -84,9 +84,10 @@ module Twilio
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def resource(*resources)
|
87
|
+
custom_resource_names = {:sms => 'SMS', :sip => 'SIP'}
|
87
88
|
resources.each do |r|
|
88
89
|
resource = twilify r
|
89
|
-
relative_path = r
|
90
|
+
relative_path = custom_resource_names.fetch(r, resource)
|
90
91
|
path = "#{@path}/#{relative_path}"
|
91
92
|
resource_class = Twilio::REST.const_get resource
|
92
93
|
instance_variable_set("@#{r}", resource_class.new(path, @client))
|
@@ -3,10 +3,13 @@ module Twilio
|
|
3
3
|
class ListResource
|
4
4
|
include Utils
|
5
5
|
|
6
|
+
|
6
7
|
def initialize(path, client)
|
8
|
+
custom_names = {"Media" => "MediaInstance", "IpAddresses" => "IpAddress"}
|
7
9
|
@path, @client = path, client
|
8
10
|
resource_name = self.class.name.split('::')[-1]
|
9
|
-
|
11
|
+
instance_name = custom_names.fetch(resource_name, resource_name.chop)
|
12
|
+
@instance_class = Twilio::REST.const_get instance_name
|
10
13
|
@list_key, @instance_id_key = detwilify(resource_name), 'sid'
|
11
14
|
end
|
12
15
|
|
data/lib/twilio-ruby/rest/sms.rb
CHANGED
@@ -4,7 +4,7 @@ module Twilio
|
|
4
4
|
|
5
5
|
def twilify(something)
|
6
6
|
if something.is_a? Hash
|
7
|
-
Hash[*something.to_a.map {|a| [twilify(a[0]).to_sym, a[1]]}.flatten]
|
7
|
+
Hash[*something.to_a.map {|a| [twilify(a[0]).to_sym, a[1]]}.flatten(1)]
|
8
8
|
else
|
9
9
|
something.to_s.split('_').map do |s|
|
10
10
|
[s[0,1].capitalize, s[1..-1]].join
|
data/lib/twilio-ruby/version.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Twilio::REST::Message do
|
4
|
+
before do
|
5
|
+
@message = Twilio::REST::Message.new('someUri', 'someClient')
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'sets up a media resources object' do
|
9
|
+
@message.should respond_to(:media)
|
10
|
+
@message.media.instance_variable_get('@path').should == 'someUri/Media'
|
11
|
+
end
|
12
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twilio-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.11.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-09-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
@@ -134,11 +134,49 @@ extra_rdoc_files:
|
|
134
134
|
files:
|
135
135
|
- .gitignore
|
136
136
|
- .travis.yml
|
137
|
+
- AUTHORS.md
|
138
|
+
- CHANGES
|
137
139
|
- Gemfile
|
138
140
|
- LICENSE
|
141
|
+
- Makefile
|
139
142
|
- README.md
|
140
143
|
- Rakefile
|
141
144
|
- conf/cacert.pem
|
145
|
+
- docs/Makefile
|
146
|
+
- docs/_themes/LICENSE
|
147
|
+
- docs/_themes/README.rst
|
148
|
+
- docs/_themes/flask_theme_support.py
|
149
|
+
- docs/_themes/kr/layout.html
|
150
|
+
- docs/_themes/kr/relations.html
|
151
|
+
- docs/_themes/kr/static/flasky.css_t
|
152
|
+
- docs/_themes/kr/static/small_flask.css
|
153
|
+
- docs/_themes/kr/theme.conf
|
154
|
+
- docs/_themes/kr_small/layout.html
|
155
|
+
- docs/_themes/kr_small/static/flasky.css_t
|
156
|
+
- docs/_themes/kr_small/theme.conf
|
157
|
+
- docs/changelog.rst
|
158
|
+
- docs/conf.py
|
159
|
+
- docs/faq.rst
|
160
|
+
- docs/getting-started.rst
|
161
|
+
- docs/index.rst
|
162
|
+
- docs/make.bat
|
163
|
+
- docs/src/pip-delete-this-directory.txt
|
164
|
+
- docs/usage/accounts.rst
|
165
|
+
- docs/usage/applications.rst
|
166
|
+
- docs/usage/basics.rst
|
167
|
+
- docs/usage/caller-ids.rst
|
168
|
+
- docs/usage/conferences.rst
|
169
|
+
- docs/usage/messages.rst
|
170
|
+
- docs/usage/notifications.rst
|
171
|
+
- docs/usage/phone-calls.rst
|
172
|
+
- docs/usage/phone-numbers.rst
|
173
|
+
- docs/usage/queues.rst
|
174
|
+
- docs/usage/recordings.rst
|
175
|
+
- docs/usage/sip.rst
|
176
|
+
- docs/usage/token-generation.rst
|
177
|
+
- docs/usage/transcriptions.rst
|
178
|
+
- docs/usage/twiml.rst
|
179
|
+
- docs/usage/validation.rst
|
142
180
|
- examples/examples.rb
|
143
181
|
- examples/print-call-log.rb
|
144
182
|
- lib/twilio-ruby.rb
|
@@ -158,12 +196,22 @@ files:
|
|
158
196
|
- lib/twilio-ruby/rest/incoming_phone_numbers.rb
|
159
197
|
- lib/twilio-ruby/rest/instance_resource.rb
|
160
198
|
- lib/twilio-ruby/rest/list_resource.rb
|
199
|
+
- lib/twilio-ruby/rest/media.rb
|
200
|
+
- lib/twilio-ruby/rest/messages.rb
|
161
201
|
- lib/twilio-ruby/rest/notifications.rb
|
162
202
|
- lib/twilio-ruby/rest/outgoing_caller_ids.rb
|
163
203
|
- lib/twilio-ruby/rest/queues.rb
|
164
204
|
- lib/twilio-ruby/rest/queues/members.rb
|
165
205
|
- lib/twilio-ruby/rest/recordings.rb
|
166
206
|
- lib/twilio-ruby/rest/sandbox.rb
|
207
|
+
- lib/twilio-ruby/rest/sip.rb
|
208
|
+
- lib/twilio-ruby/rest/sip/credential_lists.rb
|
209
|
+
- lib/twilio-ruby/rest/sip/credential_lists/credentials.rb
|
210
|
+
- lib/twilio-ruby/rest/sip/domains.rb
|
211
|
+
- lib/twilio-ruby/rest/sip/domains/credential_list_mappings.rb
|
212
|
+
- lib/twilio-ruby/rest/sip/domains/ip_access_control_list_mappings.rb
|
213
|
+
- lib/twilio-ruby/rest/sip/ip_access_control_lists.rb
|
214
|
+
- lib/twilio-ruby/rest/sip/ip_access_control_lists/ip_addresses.rb
|
167
215
|
- lib/twilio-ruby/rest/sms.rb
|
168
216
|
- lib/twilio-ruby/rest/sms/messages.rb
|
169
217
|
- lib/twilio-ruby/rest/sms/short_codes.rb
|
@@ -182,6 +230,7 @@ files:
|
|
182
230
|
- spec/rest/client_spec.rb
|
183
231
|
- spec/rest/conference_spec.rb
|
184
232
|
- spec/rest/instance_resource_spec.rb
|
233
|
+
- spec/rest/message_spec.rb
|
185
234
|
- spec/rest/queue_spec.rb
|
186
235
|
- spec/rest/recording_spec.rb
|
187
236
|
- spec/spec_helper.rb
|
@@ -227,6 +276,7 @@ test_files:
|
|
227
276
|
- spec/rest/instance_resource_spec.rb
|
228
277
|
- spec/rest/recording_spec.rb
|
229
278
|
- spec/rest/account_spec.rb
|
279
|
+
- spec/rest/message_spec.rb
|
230
280
|
- spec/rest/client_spec.rb
|
231
281
|
- spec/rest/queue_spec.rb
|
232
282
|
- spec/util/capability_spec.rb
|