Class: Basecampeverest::Access
- Inherits:
-
Object
- Object
- Basecampeverest::Access
- Defined in:
- lib/basecampeverest/resources/access.rb
Class Method Summary collapse
-
.for_calendar(calendar_id) ⇒ Basecampeverest::Project
find the people that have access to a calendar via the Basecamp API.
-
.for_project(project_id) ⇒ Basecampeverest::Project
find the people that have access to a project via the Basecamp API.
-
.grant_project(project_id, options = {}) ⇒ Basecampeverest::Project
find the people that have access to a project via the Basecamp API.
-
.revoke_project(project_id, user_id) ⇒ Basecampeverest::Project
find the people that have access to a project via the Basecamp API.
Class Method Details
.for_calendar(calendar_id) ⇒ Basecampeverest::Project
find the people that have access to a calendar via the Basecamp API
19 20 21 22 23 24 25 |
# File 'lib/basecampeverest/resources/access.rb', line 19 def self.for_calendar(calendar_id) url = "/calendars/#{calendar_id}/accesses.json" response = Basecampeverest::Connect.get url # parse the response to remove HTTParty info response.parsed_response end |
.for_project(project_id) ⇒ Basecampeverest::Project
find the people that have access to a project via the Basecamp API
7 8 9 10 11 12 13 |
# File 'lib/basecampeverest/resources/access.rb', line 7 def self.for_project(project_id) url = "/projects/#{project_id}/accesses.json" response = Basecampeverest::Connect.get url # parse the response to remove HTTParty info response.parsed_response end |
.grant_project(project_id, options = {}) ⇒ Basecampeverest::Project
find the people that have access to a project via the Basecamp API
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/basecampeverest/resources/access.rb', line 32 def self.grant_project(project_id, ={}) post_params = { :body => .to_json, :headers => Basecampeverest::Connect.headers.merge({'Content-Type' => 'application/json'}) } url = "/projects/#{project_id}/accesses.json" response = Basecampeverest::Connect.post url, post_params # parse the response to remove HTTParty info response.parsed_response end |
.revoke_project(project_id, user_id) ⇒ Basecampeverest::Project
find the people that have access to a project via the Basecamp API
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/basecampeverest/resources/access.rb', line 49 def self.revoke_project(project_id, user_id) post_params = { :body => .to_json, :headers => Basecampeverest::Connect.headers.merge({'Content-Type' => 'application/json'}) } url = "/projects/#{project_id}/accesses/#{user_id}.json" response = Basecampeverest::Connect.get url, post_params # parse the response to remove HTTParty info response.parsed_response end |