Class: HomeAway::API::Response

Inherits:
Hashie::Mash
  • Object
show all
Defined in:
lib/homeaway/api/response.rb

Overview

A container around the response that the HomeAway API returns. This object extends Hashie::Mash and can be accessed in an identical method

Instance Method Summary collapse

Instance Method Details

#_metadataHomeAway::API::Response

Returns information about the request that was just made. This includes things such as connection headers and status code

Returns:



44
45
46
# File 'lib/homeaway/api/response.rb', line 44

def 
  @metadata ||= HomeAway::API::Response.new
end

#convert_key(key) ⇒ Object



23
24
25
# File 'lib/homeaway/api/response.rb', line 23

def convert_key(key) #:nodoc:
  HomeAway::API::Util::Validators.camel_case(key)
end

#has?(*attrs) ⇒ Boolean

a helper method to determine if this response has any particular fields in its payload, potentially nested

Parameters:

  • attrs (Symbol)

    one or more symbols to search into this response with

Returns:

  • (Boolean)


32
33
34
35
36
37
38
39
# File 'lib/homeaway/api/response.rb', line 32

def has?(*attrs)
  entity = self
  attrs.each do |attr|
    return false unless entity.has_key?(attr.to_sym)
    entity = entity.send(attr.to_sym)
  end
  true
end