Class: Podio::Tag

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

#==, #[], #[]=, #api_friendly_ref_type, #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(tagable_type, tagable_id, attributes) ⇒ Object



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

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

.find_by_app(app_id, limit, text) ⇒ Object



24
25
26
27
# File 'lib/podio/models/tag.rb', line 24

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_top_by_app(app_id, limit, text) ⇒ Object



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

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



15
16
17
18
19
20
21
22
# File 'lib/podio/models/tag.rb', line 15

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