Class: Thingdeck::Property

Inherits:
Object
  • Object
show all
Defined in:
lib/thingdeck/property.rb

Instance Method Summary collapse

Constructor Details

#initialize(wrapper) ⇒ Property

Returns a new instance of Property.



3
4
5
# File 'lib/thingdeck/property.rb', line 3

def initialize(wrapper)
  @wrapper = wrapper
end

Instance Method Details

#all(id, type, params = {}) ⇒ Object



7
8
9
10
# File 'lib/thingdeck/property.rb', line 7

def all(id, type, params = {})
  url = collection_url(id, type)
  @wrapper.perform_request { |c| c.get(url, params) }
end

#create(id, type, params) ⇒ Object



17
18
19
20
# File 'lib/thingdeck/property.rb', line 17

def create(id, type, params)
  url = collection_url(id, type)
  @wrapper.perform_request { |c| c.post(url, params) }
end

#destroy(id, type, pid) ⇒ Object



22
23
24
25
# File 'lib/thingdeck/property.rb', line 22

def destroy(id, type, pid)
  url = single_url(id, type, pid)
  @wrapper.perform_request { |c| c.delete(url) }
end

#find(id, type, pid, params = {}) ⇒ Object



12
13
14
15
# File 'lib/thingdeck/property.rb', line 12

def find(id, type, pid, params = {})
  url = single_url(id, type, pid)
  @wrapper.perform_request { |c| c.get(url, params) }
end