Class: Podio::Tag

Inherits:
ActivePodio::Base show all
Defined in:
lib/podio/models/tag.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

.create(tagable_type, tagable_id, attributes) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/podio/models/tag.rb', line 8

def create(tagable_type, tagable_id, attributes)
  response = Podio.connection.post do |req|
    req.url "/tag/#{tagable_type}/#{tagable_id}/"
    req.body = attributes
  end

  response.body
end

.delete(tagable_type, tagable_id, attributes) ⇒ Object



67
68
69
70
71
72
73
# File 'lib/podio/models/tag.rb', line 67

def delete(tagable_type, tagable_id, attributes)
  response = Podio.connection.delete do |req|
    req.url("/tag/#{tagable_type}/#{tagable_id}/", attributes)
  end

  response.status
end

.find_by_app(app_id, limit, text) ⇒ Object



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

def find_by_app(app_id, limit, text)
  text = CGI.escape(text) if text
  list Podio.connection.get("/tag/app/#{app_id}/?limit=#{limit}&text=#{text}").body
end

.find_by_org(org_id, limit, text) ⇒ Object



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

def find_by_org(org_id, limit, text)
  text = CGI.escape(text) if text
  list Podio.connection.get("/tag/org/#{org_id}/?limit=#{limit}&text=#{text}").body
end

.find_by_space(space_id, limit, text) ⇒ Object



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

def find_by_space(space_id, limit, text)
  text = CGI.escape(text) if text
  list Podio.connection.get("/tag/space/#{space_id}/?limit=#{limit}&text=#{text}").body
end

.find_tagged_objects_on_app(app_id, attributes) ⇒ Object



52
53
54
# File 'lib/podio/models/tag.rb', line 52

def find_tagged_objects_on_app(app_id, attributes)
  Podio.connection.get("/tag/app/#{app_id}/search/", attributes).body
end

.find_tagged_objects_on_org(org_id, attributes) ⇒ Object



62
63
64
# File 'lib/podio/models/tag.rb', line 62

def find_tagged_objects_on_org(org_id, attributes)
  Podio.connection.get("/tag/org/#{org_id}/search/", attributes).body
end

.find_tagged_objects_on_space(space_id, attributes) ⇒ Object



57
58
59
# File 'lib/podio/models/tag.rb', line 57

def find_tagged_objects_on_space(space_id, attributes)
  Podio.connection.get("/tag/space/#{space_id}/search/", attributes).body
end

.find_top_by_app(app_id, limit, text) ⇒ Object



34
35
36
37
# File 'lib/podio/models/tag.rb', line 34

def find_top_by_app(app_id, limit, text)
  text = CGI.escape(text) if text
  Podio.connection.get("/tag/app/#{app_id}/top/?limit=#{limit}&text=#{text}").body
end

.update(tagable_type, tagable_id, attributes) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/podio/models/tag.rb', line 18

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

  response.body
end