Class: TrelloFreestyler::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/trello_freestyler/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(key, token, trello_url) ⇒ Client

Returns a new instance of Client.



7
8
9
10
11
# File 'lib/trello_freestyler/client.rb', line 7

def initialize(key, token, trello_url)
  @key = key
  @token = token
  @trello_url = trello_url
end

Instance Method Details

#authObject



13
14
15
# File 'lib/trello_freestyler/client.rb', line 13

def auth
  { key: @key, token: @token }
end

#card_actions(card_id, action_types) ⇒ Object



23
24
25
26
27
# File 'lib/trello_freestyler/client.rb', line 23

def card_actions(card_id, action_types)
  url = @trello_url + "/cards/#{card_id}/actions"
  params = { params: auth.merge({ filter: action_types }) }
  RestClient.get url, params
end

#cards(board_id) ⇒ Object



17
18
19
20
21
# File 'lib/trello_freestyler/client.rb', line 17

def cards(board_id)
  url = @trello_url + "/boards/#{board_id}/cards"
  params = { params: auth }
  RestClient.get url, params
end