Class: Podio::Widget

Inherits:
ActivePodio::Base show all
Defined in:
lib/podio/models/widget.rb

Instance Attribute Summary

Attributes inherited from ActivePodio::Base

#attributes, #error_code, #error_message, #error_parameters, #error_propagate

Class Method Summary collapse

Methods inherited from ActivePodio::Base

#==, #[], #[]=, #as_json, collection, delegate_to_hash, handle_api_errors_for, has_many, has_one, #hash, #initialize, list, member, #new_record?, #persisted?, property, #to_param

Constructor Details

This class inherits a constructor from ActivePodio::Base

Class Method Details

.create(ref_type, ref_id, attributes) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/podio/models/widget.rb', line 11

def create(ref_type, ref_id, attributes)
  response = Podio.connection.post do |req|
    req.url "/widget/#{ref_type}/#{ref_id}/"
    req.body = attributes
  end

  response.body['widget_id']
end

.delete(id) ⇒ Object



29
30
31
# File 'lib/podio/models/widget.rb', line 29

def delete(id)
  Podio.connection.delete("/widget/#{id}").status
end

.find(id) ⇒ Object



42
43
44
# File 'lib/podio/models/widget.rb', line 42

def find(id)
  member Podio.connection.get("/widget/#{id}").body
end

.find_all_for_reference(ref_type, ref_id) ⇒ Object



46
47
48
# File 'lib/podio/models/widget.rb', line 46

def find_all_for_reference(ref_type, ref_id)
  list Podio.connection.get("/widget/#{ref_type}/#{ref_id}/display/").body
end

.update(id, attributes) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/podio/models/widget.rb', line 20

def update(id, attributes)
  response = Podio.connection.put do |req|
    req.url "/widget/#{id}"
    req.body = attributes
  end

  response.status
end

.update_order(ref_type, ref_id, widget_list) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/podio/models/widget.rb', line 33

def update_order(ref_type, ref_id, widget_list)
  response = Podio.connection.put do |req|
    req.url "/widget/#{ref_type}/#{ref_id}/order"
    req.body = widget_list
  end

  response.status
end