Class: Unfuddle::Person

Inherits:
Base
  • Object
show all
Defined in:
lib/unfuddle/person.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#__set_attributes, #attributes, #delete_path, #destroy!, #fetch!, find_by, #get_path, #has_attribute?, has_many, #id, #initialize, #method_missing, #put_path, #respond_to?, #save!, #singular_name, #to_json, #to_params, #to_xml, #unfetched?, #update_attribute, #update_attributes!, #write_attribute

Constructor Details

This class inherits a constructor from Unfuddle::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Unfuddle::Base

Class Method Details

.all(options = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/unfuddle/person.rb', line 7

def self.all(options={})
  url = options[:including_removed] == true ? "people.json?removed=true" : "people.json"
  response = Unfuddle.get(url)
  
  if response.status == 404
    nil
  else
    Unfuddle.assert_response!(200, response)
    response.json.map { |attributes| self.new(attributes) }
  end
end

Instance Method Details

#relative_pathObject



19
20
21
# File 'lib/unfuddle/person.rb', line 19

def relative_path
  "people/#{id}"
end