Class: Trello::HTTP

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

Instance Method Summary collapse

Constructor Details

#initialize(token, api_key) ⇒ HTTP



9
10
11
12
# File 'lib/git-trello/trello-http.rb', line 9

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



22
23
24
# File 'lib/git-trello/trello-http.rb', line 22

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



14
15
16
# File 'lib/git-trello/trello-http.rb', line 14

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



26
27
28
# File 'lib/git-trello/trello-http.rb', line 26

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

#update_card(card_id, params) ⇒ Object



18
19
20
# File 'lib/git-trello/trello-http.rb', line 18

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