class Tend::Garden

Attributes

attributes[RW]

Public Class Methods

all(options = {}) click to toggle source
# File lib/tend/models/garden.rb, line 15
def all options = {}
  response = get options
  fill_collection response, self
end
create(attributes, options = {}) click to toggle source
# File lib/tend/models/garden.rb, line 24
def create attributes, options = {}
  new( post( attributes, options)[:data] )
end
find(id, options = {}) click to toggle source
# File lib/tend/models/garden.rb, line 20
def find id, options = {}
  new( get( options.merge(id: id, no_pagination: true) )[:data] )
end
new(attributes) click to toggle source
# File lib/tend/models/garden.rb, line 7
def initialize attributes
  a = HashWithIndifferentAccess.new attributes
  init(a) do |att, value|
    send("#{att}=", value)
  end
end

Private Instance Methods

collection(name, cla, options = {}) click to toggle source
# File lib/tend/models/garden.rb, line 40
def collection name, cla, options = {}
   response = get options.merge(collection: name, id: id)
   self.class.fill_collection response, cla
end
init(attributes) { |att, value| ... } click to toggle source
# File lib/tend/models/garden.rb, line 33
def init attributes
  @attributes = attributes
  @attributes.each do |att, value|
    yield att, value
  end
end