Sha256: 49f548d6a4db18f024fe0ec57a1b2a9e57e7bbb276ec34528e3e1019439f9478
Contents?: true
Size: 954 Bytes
Versions: 1
Compression:
Stored size: 954 Bytes
Contents
module Yelp4r class Response attr_accessor :body def initialize(response) @body = rash_response(response) end def response_code @body.message.code end def success? response_code == 0 end def error_message @body.message.text unless success? end def data if !@body.businesses.blank? @body.businesses elsif !@body.neighborhoods.blank? @body.neighborhoods end end private def rash_response(response) if response.is_a?(Array) @body = [] response.each do |b| if b.is_a?(Hash) @body << Hashie::Rash.new(b) else @body << b end end elsif response.is_a?(Hash) @body = Hashie::Rash.new(response) else @body = response end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
yelp4r-1.2.0 | lib/yelp4r/response.rb |