Class: Basecampeverest::Attachments

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

Class Method Summary collapse

Class Method Details

.allBasecampeverest::Project

find all #### via the Basecamp API

Returns:



6
7
8
9
10
11
# File 'lib/basecampeverest/resources/attachment.rb', line 6

def self.all
    response = Basecampeverest::Connect.get 

    # parse the response to remove HTTParty info
    response.parsed_response
end

.deleteBasecampeverest::Project

#### via the Basecamp API

Parameters:

Returns:



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/basecampeverest/resources/attachment.rb', line 65

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

.findBasecampeverest::Project

#### via the Basecamp API

Parameters:

Returns:



17
18
19
20
21
22
# File 'lib/basecampeverest/resources/attachment.rb', line 17

def self.find()
    response = Basecampeverest::Connect.get 

    # parse the response to remove HTTParty info
    response.parsed_response
end

.new(options = {}) ⇒ Basecampeverest::Project

#### via the Basecamp API

Parameters:

Returns:



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/basecampeverest/resources/attachment.rb', line 30

def self.new(options={})
    post_params = {
      :body => options.to_json,
      :headers => Basecampeverest::Connect.headers.merge({'Content-Type' => 'application/json'})
    }
    # make the http basecamp call
    response = Basecampeverest::Connect.post "####", post_params

    # parse the response to remove HTTParty info
    response.parsed_response
end

.updateBasecampeverest::Project

#### via the Basecamp API

Parameters:

Returns:



47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/basecampeverest/resources/attachment.rb', line 47

def self.update()
    post_params = {
      :body => options.to_json,
      :headers => Basecampeverest::Connect.merge({'Content-Type' => 'application/json'})
    }

    # make the http basecamp call
    response = Basecampeverest::Connect.put "####", post_params

    # parse the response to remove HTTParty info
    response.parsed_response
end