Class: Podio::Bulletin

Inherits:
ActivePodio::Base show all
Defined in:
lib/podio/models/bulletin.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, #initialize_attributes, list, member, #new_record?, output_attribute_as_json, #persisted?, property, #to_param

Constructor Details

This class inherits a constructor from ActivePodio::Base

Class Method Details

.create(attributes) ⇒ Object



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

def create(attributes)
  response = Podio.connection.post do |req|
    req.url "/bulletin/"
    req.body = attributes
  end

  response.body['bulletin_id']
end

.find(id, options = {}) ⇒ Object



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

def find(id, options={})
  member Podio.connection.get("/bulletin/#{id}").body
end

.find_allObject



43
44
45
# File 'lib/podio/models/bulletin.rb', line 43

def find_all
  list Podio.connection.get("/bulletin/?show_drafts=1").body
end

.find_all_by_locale(locale) ⇒ Object



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

def find_all_by_locale(locale)
  list Podio.connection.get("/bulletin/?locale=locale").body
end

.find_visibleObject



39
40
41
# File 'lib/podio/models/bulletin.rb', line 39

def find_visible
  list Podio.connection.get("/bulletin/").body
end

.preview!(id) ⇒ Object



51
52
53
# File 'lib/podio/models/bulletin.rb', line 51

def preview!(id)
  Podio.connection.post("/bulletin/#{id}/preview").body
end

.send!(id) ⇒ Object



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

def send!(id)
  Podio.connection.post("/bulletin/#{id}/send").body
end

.update(id, attributes) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/podio/models/bulletin.rb', line 26

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

  response.status
end