Skip to content

cloudfuji/trello-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trello::Client - Trello API client

Configuration

Get developer API key:

https://trello.com/1/appKey/generate

Get user token:

https://trello.com/1/connect?key=$YOUR_API_KEY&name=trello-client.rb&response_type=token

Usage

require 'trello-client'

Trello::Client.new do |client|
  # Set API key
  client.api_key = ...

  # Set token
  client.token = ...

  # Get member
  client.member('me') do |m|
    # Returns Trello::Client::Member object
    m['id']       # => member identifier
    m['fullName'] # => member name
    m['userName'] # => member user
    m['url']      # => member url
  end

  # Get member with boards
  client.member( 'me', :boards => 'all' ) do |m|
    m.boards.each do |b|
      # Returns Trello::Client::Board objects
      b['id']     # => board identifier
      b['name']   # => board name
  end 

  # Get board
  client.board( '<identifier>' ) do |b|
    # Returns Trello::Client::Board object
    b['id']     # => board identifier
    b['name']   # => board name
    b['url']    # => board url
  end

  # Get board with lists
  client.board( '<identifier>', :lists => 'all' ) do |b|
    b.lists.each do |l|
      # Returns Trello::Client::List object
      l['id']       # => list identifier
      l['idBoard']  # => list board identifier
      l['name']     # => list name
    end
  end

  # Get list
  client.list( '<identifier>' ) do |l|
    # Returns Trello::Client::List object
    l['id']       # => list identifier
    l['idBoard']  # => list board identifier
    l['name']     # => list name
  end

  # Get list with cards
  client.list( '<identifier>' ) do |l|
    l.cards.each do |c|
      # Returns Trello::Client::Card object
      c['id']       # => card identifier
      c['idBoard']  # => card board identifier
      c['idList']   # => card list identifier
      c['name']     # => card name
    end
  end

  # Get card
  client.card( '<identifier>' ) do |card|
    card['id']      # => card identifier
    card['name']    # => card name
    card['closed']  # => true | false
  end
end

Author

blair christensen. <blair.christensen@gmail.com>

Homepage

github.com/blairc/trello-client/

See Also

To Do

  • DRY Card, Board, List and Member

  • DRY +board()+, +list()+ and +member()+

  • Make trello2todo configurable

  • Actual API test that can be run on demand

  • Memoize API calls

  • Lazy fetching of data that wasn’t requested?