class DogapiDemo::V1::CommentService

Constants

API_VERSION

Public Instance Methods

comment(message, options = {}) click to toggle source

Submit a comment.

   # File lib/dogapi-demo/v1/comment.rb
11 def comment(message, options = {})
12   begin
13     params = {
14       :api_key => @api_key,
15       :application_key => @application_key
16     }
17 
18     body = {
19       'message' => message,
20     }.merge options
21 
22     request(Net::HTTP::Post, "/api/#{API_VERSION}/comments", params, body, true)
23   rescue Exception => e
24     suppress_error_if_silent e
25   end
26 end
delete_comment(comment_id) click to toggle source
   # File lib/dogapi-demo/v1/comment.rb
46 def delete_comment(comment_id)
47   begin
48     params = {
49       :api_key => @api_key,
50       :application_key => @application_key
51     }
52 
53     request(Net::HTTP::Delete, "/api/#{API_VERSION}/comments/#{comment_id}", params, nil, false)
54   rescue Exception => e
55     suppress_error_if_silent e
56   end
57 end
update_comment(comment_id, options = {}) click to toggle source

Update a comment.

   # File lib/dogapi-demo/v1/comment.rb
29 def update_comment(comment_id, options = {})
30   begin
31     params = {
32       :api_key => @api_key,
33       :application_key => @application_key
34     }
35 
36     if options.empty?
37       raise "Must update something."
38     end
39 
40     request(Net::HTTP::Put, "/api/#{API_VERSION}/comments/#{comment_id}", params, options, true)
41   rescue Exception => e
42     suppress_error_if_silent e
43   end
44 end