Class: GithubTrello::HTTP

Inherits:
Object
  • Object
show all
Defined in:
lib/github-trello/http.rb

Instance Method Summary collapse

Constructor Details

#initialize(token, api_key) ⇒ HTTP

Returns a new instance of HTTP.



6
7
8
9
# File 'lib/github-trello/http.rb', line 6

def initialize(token, api_key)
  @token, @api_key = token, api_key
  @uri = URI("https://api.trello.com")
end

Instance Method Details

#add_comment(card_id, comment) ⇒ Object



19
20
21
# File 'lib/github-trello/http.rb', line 19

def add_comment(card_id, comment)
  http_request(:post, "/1/cards/#{card_id}/actions/comments", :body => "text=#{CGI::escape(comment)}")
end

#get_card(board_id, card_id) ⇒ Object



11
12
13
# File 'lib/github-trello/http.rb', line 11

def get_card(board_id, card_id)
  http_request(:get, "/1/boards/#{board_id}/cards/#{card_id}", :params => {:fields => "idList,closed"})
end

#update_card(card_id, params) ⇒ Object



15
16
17
# File 'lib/github-trello/http.rb', line 15

def update_card(card_id, params)
  http_request(:put, "/1/cards/#{card_id}", :params => params)
end