class ExotelApi::Metadata
Public Class Methods
details(params={})
click to toggle source
# File lib/exotel_api/metadata.rb, line 9 def self.details(params={}) self.new.details(params) end
new()
click to toggle source
# File lib/exotel_api/metadata.rb, line 7 def initialize; end
Public Instance Methods
details(number)
click to toggle source
# File lib/exotel_api/metadata.rb, line 13 def details(number) response = self.class.get("/#{ExotelApi.exotel_sid}/Numbers/#{number}", :basic_auth => auth) handle_response(response) end
Protected Instance Methods
auth()
click to toggle source
# File lib/exotel_api/metadata.rb, line 20 def auth {:username => ExotelApi.exotel_sid, :password => ExotelApi.exotel_token} end
handle_response(response)
click to toggle source
# File lib/exotel_api/metadata.rb, line 24 def handle_response(response) case response.code.to_i when 200...300 then ExotelApi::Response.new(response) when 401 then raise ExotelApi::AuthenticationError, "#{response.body} Verify your sid and token." else raise ExotelApi::UnexpectedError, response.body end end