Class: Basecampeverest::CalendarEvents
- Inherits:
-
Object
- Object
- Basecampeverest::CalendarEvents
- Defined in:
- lib/basecampeverest/resources/calendar_event.rb
Class Method Summary collapse
-
.all ⇒ Basecampeverest::Project
find all #### via the Basecamp API.
-
.delete ⇒ Basecampeverest::Project
#### via the Basecamp API.
-
.find(project_id) ⇒ Basecampeverest::Project
#### via the Basecamp API.
-
.find_specific(project_id, event_id) ⇒ Basecampeverest::Project
#### via the Basecamp API.
-
.new_calendar_event(options = {}) ⇒ Basecampeverest::Project
#### via the Basecamp API.
-
.new_project_event(project_id, options = {}) ⇒ Basecampeverest::Project
#### via the Basecamp API.
-
.update ⇒ Basecampeverest::Project
#### via the Basecamp API.
Class Method Details
.all ⇒ Basecampeverest::Project
find all #### via the Basecamp API
6 7 8 9 10 11 12 |
# File 'lib/basecampeverest/resources/calendar_event.rb', line 6 def self.all url = response = Basecampeverest::Connect.get # parse the response to remove HTTParty info response.parsed_response end |
.delete ⇒ Basecampeverest::Project
#### via the Basecamp API
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/basecampeverest/resources/calendar_event.rb', line 102 def self.delete() url = "####" response = Basecampeverest::Connect.delete url # This checks the response code for validity and error checking if response.code == 204 = "#### successfully deleted" elsif response.code == 403 = "You do not have permission to delete this ####" else = "Invalid project ID or authentication. The #### was not deleted." end # return the message end |
.find(project_id) ⇒ Basecampeverest::Project
#### via the Basecamp API
18 19 20 21 22 23 |
# File 'lib/basecampeverest/resources/calendar_event.rb', line 18 def self.find(project_id) url = "/projects/#{project_id}/calendar_events.json" response = Basecampeverest::Connect.get url # parse the response to remove HTTParty info response.parsed_response end |
.find_specific(project_id, event_id) ⇒ Basecampeverest::Project
#### via the Basecamp API
30 31 32 33 34 35 36 |
# File 'lib/basecampeverest/resources/calendar_event.rb', line 30 def self.find_specific(project_id, event_id) url = "/projects/#{project_id}/calendar_events/#{event_id}.json" response = Basecampeverest::Connect.get url # parse the response to remove HTTParty info response.parsed_response end |
.new_calendar_event(options = {}) ⇒ Basecampeverest::Project
#### via the Basecamp API
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/basecampeverest/resources/calendar_event.rb', line 63 def self.new_calendar_event(={}) post_params = { :body => .to_json, :headers => Basecampeverest::Connect.headers.merge({'Content-Type' => 'application/json'}) } # make the http basecamp call url = "/projects/1/calendar_events.json" response = Basecampeverest::Connect.post url, post_params # parse the response to remove HTTParty info response.parsed_response end |
.new_project_event(project_id, options = {}) ⇒ Basecampeverest::Project
#### via the Basecamp API
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/basecampeverest/resources/calendar_event.rb', line 44 def self.new_project_event(project_id, ={}) post_params = { :body => .to_json, :headers => Basecampeverest::Connect.headers.merge({'Content-Type' => 'application/json'}) } # make the http basecamp call url = "/projects/#{project_id}/calendar_events.json" response = Basecampeverest::Connect.post url, post_params # parse the response to remove HTTParty info response.parsed_response end |
.update ⇒ Basecampeverest::Project
#### via the Basecamp API
83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/basecampeverest/resources/calendar_event.rb', line 83 def self.update() post_params = { :body => .to_json, :headers => Basecampeverest::Connect.merge({'Content-Type' => 'application/json'}) } # make the http basecamp call url = response = Basecampeverest::Connect.put url, post_params # parse the response to remove HTTParty info response.parsed_response end |