class LastbillClient::Response

@author ciappa_m@modulotech.fr Represents response from a LastBill API @see LastbillClient::Client @see LastbillClient::Request @since 0.1.0

Attributes

original_response[R]

@return [HTTParty::Response] The response object from HTTParty call

parsed_response[R]

@return [Hash] The JSON object resulting from HTTParty parsed response

Public Class Methods

new(response) click to toggle source

@param response [HTTParty::Response] The response object from HTTParty call

# File lib/lastbill_client/response.rb, line 17
def initialize(response)
  @original_response = response
  @parsed_response   = response.parsed_response
end

Public Instance Methods

method_missing(method_name, *args, &block) click to toggle source
# File lib/lastbill_client/response.rb, line 22
def method_missing(method_name, *args, &block)
  if %i[original_response parsed_response].include?(method_name)
    send(method_name)
  else
    @parsed_response.send(method_name, *args, &block)
  end
end
respond_to_missing?(method_name, include_private = false) click to toggle source
Calls superclass method
# File lib/lastbill_client/response.rb, line 30
def respond_to_missing?(method_name, include_private = false)
  %i[original_response parsed_response].include?(method_name) || super
end