Class: Podio::Form

Inherits:
ActivePodio::Base show all
Defined in:
lib/podio/models/form.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(app_id, attributes) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/podio/models/form.rb', line 22

def create(app_id, attributes)
  response = Podio.connection.post do |req|
    req.url "/form/app/#{app_id}/"
    req.body = attributes
  end

  response.body['form_id']
end

.disable(form_id) ⇒ Object



54
55
56
# File 'lib/podio/models/form.rb', line 54

def disable(form_id)
  Podio.connection.post("/form/#{form_id}/deactivate").body
end

.enable(form_id) ⇒ Object



59
60
61
# File 'lib/podio/models/form.rb', line 59

def enable(form_id)
  Podio.connection.post("/form/#{form_id}/activate").body
end

.find(form_id) ⇒ Object



49
50
51
# File 'lib/podio/models/form.rb', line 49

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

.find_all_for_app(app_id) ⇒ Object



42
43
44
45
46
# File 'lib/podio/models/form.rb', line 42

def find_all_for_app(app_id)
  list Podio.connection.get { |req|
    req.url("/form/app/#{app_id}/")
  }.body
end

.update(form_id, attributes) ⇒ Object



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

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

  response.status
end