Class: GitTrelloPostCommit::Trello::HTTP

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

Instance Method Summary collapse

Constructor Details

#initialize(token, api_key) ⇒ HTTP

Returns a new instance of HTTP.



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

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



23
24
25
# File 'lib/git_trello_post_commit/trello-http.rb', line 23

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



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

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

#get_cards(list_id) ⇒ Object



27
28
29
# File 'lib/git_trello_post_commit/trello-http.rb', line 27

def get_cards(list_id)
  http_request(:get, "/1/lists/#{list_id}/cards", :params => {:fields => "idList"})
end

#update_card(card_id, params) ⇒ Object



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

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