Class: Tend::Garden

Inherits:
Object
  • Object
show all
Includes:
Util::Ht, Util::Util
Defined in:
lib/tend/models/garden.rb

Direct Known Subclasses

Campaign, Contact, Page, Referrer, Segment, Visit

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Util::Util

included

Methods included from Util::Ht

included

Constructor Details

#initialize(attributes) ⇒ Garden

Returns a new instance of Garden.



7
8
9
10
11
12
# 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

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



6
7
8
# File 'lib/tend/models/garden.rb', line 6

def attributes
  @attributes
end

Class Method Details

.all(options = {}) ⇒ Object



15
16
17
18
# File 'lib/tend/models/garden.rb', line 15

def all options = {}
  response = get options
  fill_collection response, self
end

.create(attributes, options = {}) ⇒ Object



24
25
26
# File 'lib/tend/models/garden.rb', line 24

def create attributes, options = {}
  new( post( attributes, options)[:data] )
end

.find(id, options = {}) ⇒ Object



20
21
22
# File 'lib/tend/models/garden.rb', line 20

def find id, options = {}
  new( get( options.merge(id: id, no_pagination: true) )[:data] )
end