Class: Telesign::ApiResponse

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/telesign/api_response.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ ApiResponse

Returns a new instance of ApiResponse.



11
12
13
14
15
# File 'lib/telesign/api_response.rb', line 11

def initialize(response)
  @response = response.send(self.class.response_method)
  raise_exceptions
  after_initialize
end

Class Method Details

.response_method(method = nil) ⇒ Object



6
7
8
9
# File 'lib/telesign/api_response.rb', line 6

def self.response_method(method = nil)
  @response_method ||= method
  @response_method
end

Instance Method Details

#after_initializeObject



17
18
# File 'lib/telesign/api_response.rb', line 17

def after_initialize
end

#raise_exceptionsObject



20
21
22
# File 'lib/telesign/api_response.rb', line 20

def raise_exceptions
  Exceptions::raise_if_error(api_error)
end