module AirbnbApi::Resource::ClassMethods

Attributes

attributes[R]
many[R]
root[R]

Public Instance Methods

build(attributes) click to toggle source
# File lib/airbnb_api/resource.rb, line 49
def build(attributes)
  new(attributes)
end
has_attributes(attributes) click to toggle source
# File lib/airbnb_api/resource.rb, line 30
def has_attributes(attributes)
  attr_accessor(*@attributes = attributes)
end
has_many(attribute, klass) click to toggle source
# File lib/airbnb_api/resource.rb, line 34
def has_many(attribute, klass)
  @many ||= {}
  @many[attribute.to_sym] = klass
  attr_accessor(attribute.to_sym)
end
has_root(boolean) click to toggle source
# File lib/airbnb_api/resource.rb, line 40
def has_root(boolean)
  @root = boolean
end
root_element() click to toggle source
# File lib/airbnb_api/resource.rb, line 44
def root_element
  @root = @root.nil? ? true : @root
  @root ? name.to_s.gsub(/([^\^])([A-Z])/,'\1_\2').downcase.to_sym : nil
end