Class: Podio::Widget

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

Overview

Instance Attribute Summary

Attributes inherited from ActivePodio::Base

#attributes

Class Method Summary collapse

Methods inherited from ActivePodio::Base

#==, #[], #[]=, #api_friendly_ref_type, #as_json, collection, delegate_to_hash, has_many, has_one, #hash, #initialize, #initialize_attributes, klass_from_string, list, member, #new_record?, output_attribute_as_json, #parent_model, #persisted?, property, #to_param

Constructor Details

This class inherits a constructor from ActivePodio::Base

Class Method Details

.clone(id, attributes) ⇒ Object



65
66
67
68
69
70
71
72
# File 'lib/podio/models/widget.rb', line 65

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

  member response.body
end

.create(ref_type, ref_id, attributes) ⇒ Object



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

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

  member response.body
end

.delete(id) ⇒ Object



40
41
42
# File 'lib/podio/models/widget.rb', line 40

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

.find(id) ⇒ Object



55
56
57
# File 'lib/podio/models/widget.rb', line 55

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

.find_all_for_reference(ref_type, ref_id) ⇒ Object



60
61
62
# File 'lib/podio/models/widget.rb', line 60

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



30
31
32
33
34
35
36
37
# File 'lib/podio/models/widget.rb', line 30

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

  member response.body
end

.update_order(ref_type, ref_id, widget_list) ⇒ Object



45
46
47
48
49
50
51
52
# File 'lib/podio/models/widget.rb', line 45

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