Sha256: 5756147569a60d43e78a20f07dbf868fd1642e35d625cd1d1937edf574894069

Contents?: true

Size: 541 Bytes

Versions: 1

Compression:

Stored size: 541 Bytes

Contents

module Yelp4r
  class Response
    
    attr_accessor :body
    
    def initialize(body)
      @body = body
    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
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tcocca-yelp4r-1.0.2 lib/yelp4r/response.rb