class Trello::Client
Trello
API client.
Constants
- VERSION
Trello::Client
version
Attributes
api[RW]
Get/Set Trello
API URL
api_key[RW]
Get/Set Trello
API key
api_token[RW]
Get/Set Trello
API application token
Public Class Methods
new() { |self| ... }
click to toggle source
Initialize Trello::Client
object
# File lib/trello-client.rb, line 143 def initialize @api = 'https://api.trello.com/1' @api_key = nil @api_token = nil yield self if block_given? self end
Public Instance Methods
board(id, options = {} ) { |board| ... }
click to toggle source
Get Trello::Client::Board
object
See trello.com/docs/api/board/index.html
Params:
id
-
Board
identifier options
-
(optional) Additional API parameters
# File lib/trello-client.rb, line 160 def board(id, options = {} ) raise('invalid id') if id.nil? || id.empty? board = Trello::Client::Board.new( _get( "#{api}/board/#{id}", options ) ) yield board if block_given? board end
card(id, options = {} ) { |card| ... }
click to toggle source
Get Trello::Client::Card
object
See trello.com/docs/api/card/index.html
Params:
id
-
Card
identifier options
-
(optional) Additional API parameters
# File lib/trello-client.rb, line 176 def card(id, options = {} ) raise('invalid id') if id.nil? || id.empty? card = Trello::Client::Card.new( _get( "#{api}/card/#{id}", options ) ) yield card if block_given? card end
list(id, options = {} ) { |l| ... }
click to toggle source
Get Trello::Client::List
object
See trello.com/docs/api/list/index.html
Params:
id
-
List
identifier options
-
(optional) Additional API parameters
# File lib/trello-client.rb, line 192 def list(id, options = {} ) raise('invalid id') if id.nil? || id.empty? l = Trello::Client::List.new( _get( "#{api}/list/#{id}", options ) ) yield l if block_given? l end
member(id, options = {} ) { |m| ... }
click to toggle source
Get Trello::Client::Member
object
See trello.com/docs/api/member/index.html
Params:
id
-
Member
identifier options
-
(optional) Additional API parameters
# File lib/trello-client.rb, line 209 def member(id, options = {} ) raise('invalid id') if id.nil? || id.empty? m = Trello::Client::Member.new( _get( "#{api}/members/#{id}", options ) ) yield m if block_given? m end
Private Instance Methods
_get( uri, options = {} )
click to toggle source
# File lib/trello-client.rb, line 219 def _get( uri, options = {} ) _validate_request!(uri) defaults = { :key => @api_key, :token => @api_token } options.merge!(defaults) if options uri << '?' options.keys.sort.each do |k| uri << "#{k}=#{ options[k] }&" end end uri.gsub! /&$/, '' open(uri).read end
_validate_request!(uri)
click to toggle source
# File lib/trello-client.rb, line 234 def _validate_request!(uri) raise('invalid URI') if uri.nil? || uri.empty? raise('invalid API key') if @api_key.nil? || @api_key.empty? raise('invalid API token') if @api_token.nil? || @api_token.empty? end