Skip to content

Commit

Permalink
Regnerate library for 5.0.0-rc20
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Connors committed May 22, 2017
1 parent 3be7e7a commit f8f0bc1
Show file tree
Hide file tree
Showing 213 changed files with 10,041 additions and 678 deletions.
8 changes: 8 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
twilio-ruby changelog
=====================

[2017-05-22] Version 5.0.0-rc20
- Add Wireless Domain
- Add Fax Domain
- Add Video Domain
- Updated Usage Trigger enums with missing categories.
- Add `area_code_geomatch`, `validtiy_period`, `fallback_to_long_code` to Messaging Service
- Converted `TwilioException` to `TwilioError`

[2017-04-27] Version 5.0.0-rc19
------------------

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ A module for using the Twilio REST API and generating valid [TwiML](http://www.t
To install using [Bundler][bundler] grab the latest stable version:

```ruby
gem 'twilio-ruby', '~> 5.0.0.rc17'
gem 'twilio-ruby', '~> 5.0.0.rc20'
```

To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:

```bash
gem install twilio-ruby -v 5.0.0.rc17
gem install twilio-ruby -v 5.0.0.rc20
```

To build and install the development branch yourself from the latest source:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Twilio
module REST
class TwilioException < Exception
class TwilioError < StandardError
attr_reader :message, :body

def initialize(message, body = nil)
Expand All @@ -13,7 +13,7 @@ def to_s
end
end

class RestException < TwilioException
class RestError < TwilioError
attr_reader :message, :code, :status_code

def initialize(message, code, status_code)
Expand All @@ -26,5 +26,6 @@ def to_s
"[HTTP #{status_code}] #{code} : #{message}"
end
end

end
end
6 changes: 3 additions & 3 deletions lib/twilio-ruby/framework/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def initialize(version, response)

def process_response(response)
if response.status_code != 200
raise Twilio::REST::TwilioException.new('Unable to fetch page', response)
raise Twilio::REST::TwilioError.new('Unable to fetch page', response)
end

response.body
Expand All @@ -45,7 +45,7 @@ def load_page(payload)
end
end

raise Twilio::REST::TwilioException.new('Page Records can not be deserialized')
raise Twilio::REST::TwilioError.new('Page Records can not be deserialized')
end

def previous_page_url
Expand All @@ -69,7 +69,7 @@ def next_page_url
end

def get_instance(payload)
raise Twilio::REST::TwilioException.new('Page.get_instance() must be implemented in the derived class')
raise Twilio::REST::TwilioError.new('Page.get_instance() must be implemented in the derived class')
end

def previous_page
Expand Down
9 changes: 9 additions & 0 deletions lib/twilio-ruby/framework/serialize.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ def self.deserialize_iso8601(date)
end
end

def self.serialize_object(object)
if object.is_a?(Hash) or object.is_a?(Array)
require 'json'
JSON.generate(object)
else
object
end
end

def self.flatten(map, result={}, previous=[])
map.each do |key, value|
if value.is_a? Hash
Expand Down
2 changes: 1 addition & 1 deletion lib/twilio-ruby/framework/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def exception(response, header)
code = response.body['code']
end

return Twilio::REST::RestException.new(message, code, response.status_code)
return Twilio::REST::RestError.new(message, code, response.status_code)
end

def fetch(method, uri, params={}, data={}, headers={}, auth=nil, timeout=nil)
Expand Down
1 change: 1 addition & 0 deletions lib/twilio-ruby/http/http_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def initialize(proxy_addr=nil, proxy_port=nil, proxy_user=nil, proxy_pass=nil, s
end

def request(host, port, method, url, params={}, data={}, headers={}, auth=nil, timeout=nil)
puts(url)
@connection = Faraday.new(url: host + ":" + port.to_s, ssl: {verify: true}) do |f|
f.request :url_encoded
f.adapter @adapter
Expand Down
28 changes: 28 additions & 0 deletions lib/twilio-ruby/jwt/access_token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,34 @@ def payload
end
end

class TaskRouterGrant
attr_accessor :workspace_sid,
:worker_sid,
:role

def key
'task_router'
end

def payload
payload = {}

if workspace_sid
payload[:workspace_sid] = workspace_sid
end

if worker_sid
payload[:worker_sid] = worker_sid
end

if role
payload[:role] = role
end

payload
end
end


end
end
Expand Down
106 changes: 64 additions & 42 deletions lib/twilio-ruby/rest/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ module REST
##
# A client for accessing the Twilio API.
class Client
attr_accessor :http_client, :username, :password, :account_sid, :auth_token
attr_accessor :http_client, :username, :password, :account_sid, :auth_token, :region

##
# Initializes the Twilio Client
def initialize(username=nil, password=nil, account_sid=nil, http_client=Twilio::HTTP::Client.new)
def initialize(username=nil, password=nil, account_sid=nil, region=nil, http_client=Twilio::HTTP::Client.new)
@username = username || Twilio.account_sid
@password = password || Twilio.auth_token
@region = region
@account_sid = account_sid || @username
@auth_token = @password
@auth = [@username, @password]
Expand All @@ -36,6 +37,8 @@ def initialize(username=nil, password=nil, account_sid=nil, http_client=Twilio::
@trunking = nil
@video = nil
@messaging = nil
@wireless = nil
@sync = nil
end

##
Expand All @@ -57,6 +60,13 @@ def request(host, port, method, uri, params={}, data={}, headers={}, auth=nil, t
headers['Accept'] = 'application/json'
end

if !region.nil?
head, tail = uri.split('.', 2)
if !tail.start_with?(region)
uri = [head, region, tail].join('.')
end
end

@http_client.request(
host,
port,
Expand Down Expand Up @@ -154,96 +164,108 @@ def messaging
@messaging ||= Messaging.new self
end

def addresses
return self.api.v2010.account.addresses
##
# Access the Wireless Twilio Domain
def wireless
@wireless ||= Wireless.new self
end

##
# Access the Sync Twilio Domain
def sync
@sync ||= Sync.new self
end

def addresses(sid=:unset)
self.api.v2010.account.addresses(sid)
end

def applications
return self.api.v2010.account.applications
def applications(sid=:unset)
self.api.v2010.account.applications(sid)
end

def authorized_connect_apps
return self.api.v2010.account.authorized_connect_apps
def authorized_connect_apps(sid=:unset)
self.api.v2010.account.authorized_connect_apps(sid)
end

def available_phone_numbers
return self.api.v2010.account.available_phone_numbers
def available_phone_numbers(sid=:unset)
self.api.v2010.account.available_phone_numbers(sid)
end

def calls
return self.api.v2010.account.calls
def calls(sid=:unset)
self.api.v2010.account.calls(sid)
end

def conferences
return self.api.v2010.account.conferences
def conferences(sid=:unset)
self.api.v2010.account.conferences(sid)
end

def connect_apps
return self.api.v2010.account.connect_apps
def connect_apps(sid=:unset)
self.api.v2010.account.connect_apps(sid)
end

def incoming_phone_numbers
return self.api.v2010.account.incoming_phone_numbers
def incoming_phone_numbers(sid=:unset)
self.api.v2010.account.incoming_phone_numbers(sid)
end

def keys
return self.api.v2010.account.keys
def keys(sid=:unset)
self.api.v2010.account.keys(sid)
end

def messages
return self.api.v2010.account.messages
def messages(sid=:unset)
self.api.v2010.account.messages(sid)
end

def new_keys
return self.api.v2010.account.new_keys
self.api.v2010.account.new_keys
end

def new_signing_keys
return self.api.v2010.account.new_signing_keys
self.api.v2010.account.new_signing_keys
end

def notifications
return self.api.v2010.account.notifications
def notifications(sid=:unset)
self.api.v2010.account.notifications(sid)
end

def outgoing_caller_ids
return self.api.v2010.account.outgoing_caller_ids
def outgoing_caller_ids(sid=:unset)
self.api.v2010.account.outgoing_caller_ids(sid)
end

def queues
return self.api.v2010.account.queues
def queues(sid=:unset)
self.api.v2010.account.queues(sid)
end

def recordings
return self.api.v2010.account.recordings
def recordings(sid=:unset)
self.api.v2010.account.recordings(sid)
end

def signing_keys
return self.api.v2010.account.signing_keys
def signing_keys(sid=:unset)
self.api.v2010.account.signing_keys(sid)
end

def sip
return self.api.v2010.account.sip
self.api.v2010.account.sip
end

def short_codes
return self.api.v2010.account.short_codes
def short_codes(sid=:unset)
self.api.v2010.account.short_codes(sid)
end

def tokens
return self.api.v2010.account.tokens
self.api.v2010.account.tokens
end

def transcriptions
return self.api.v2010.account.transcriptions
def transcriptions(sid=:unset)
self.api.v2010.account.transcriptions(sid)
end

def usage
return self.api.v2010.account.usage
self.api.v2010.account.usage
end

def validation_requests
return self.api.v2010.account.validation_requests
self.api.v2010.account.validation_requests
end

##
Expand Down
Loading

0 comments on commit f8f0bc1

Please sign in to comment.