Class: Basecampeverest::CalendarEvents

Inherits:
Object
  • Object
show all
Defined in:
lib/basecampeverest/resources/calendar_event.rb

Class Method Summary collapse

Class Method Details

.allBasecampeverest::Project

find all #### via the Basecamp API

Returns:



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

.deleteBasecampeverest::Project

#### via the Basecamp API

Parameters:

Returns:



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
        message = "#### successfully deleted"
    elsif response.code == 403
        message = "You do not have permission to delete this ####"
    else 
        message = "Invalid project ID or authentication. The #### was not deleted."
    end

    # return the message
    message
end

.find(project_id) ⇒ Basecampeverest::Project

#### via the Basecamp API

Parameters:

Returns:



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

Parameters:

Returns:



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

Parameters:

Returns:



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(options={})
    post_params = {
      :body => options.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

Parameters:

Returns:



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, options={})
    post_params = {
      :body => options.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

.updateBasecampeverest::Project

#### via the Basecamp API

Parameters:

Returns:



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 => options.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