class VoiceBase::Response
Attributes
http_response[RW]
Public Class Methods
new(http_response, api_version = "1.1")
click to toggle source
# File lib/voicebase/response.rb, line 8 def initialize(http_response, api_version = "1.1") @http_response = http_response if api_version.to_i < 2 self.extend(VoiceBase::V1::Response) elsif api_version.to_i == 2 self.extend(VoiceBase::V2::Response) elsif api_version.to_i == 3 self.extend(VoiceBase::V3::Response) else raise UnknownApiVersionError end end
Public Instance Methods
method_missing(method, *args, &block)
click to toggle source
E.g.
@response.request_status is derived from the response hash 'statusMessage' key, or @response.status_message from 'statusMessage'
Calls superclass method
# File lib/voicebase/response.rb, line 31 def method_missing(method, *args, &block) if result = http_response.parsed_response[camelize_name(method)] result else super end end
ok?()
click to toggle source
# File lib/voicebase/response.rb, line 21 def ok? http_response.code && http_response.code >= 200 && http_response.code < 300 end