Class: Trello::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/trello-client.rb,
lib/trello-client/card.rb,
lib/trello-client/list.rb,
lib/trello-client/board.rb,
lib/trello-client/member.rb,
lib/trello-client/version.rb

Overview

:nodoc:

Defined Under Namespace

Classes: Board, Card, List, Member

Constant Summary collapse

VERSION =

Trello::Client version

'0.0.6'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Client

Initialize Trello::Client object

Yields:

  • (_self)

Yield Parameters:



143
144
145
146
147
148
149
# 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

Instance Attribute Details

#apiObject

Get/Set Trello API URL



128
129
130
# File 'lib/trello-client.rb', line 128

def api
  @api
end

#api_keyObject

Get/Set Trello API key



133
134
135
# File 'lib/trello-client.rb', line 133

def api_key
  @api_key
end

#api_tokenObject

Get/Set Trello API application token



138
139
140
# File 'lib/trello-client.rb', line 138

def api_token
  @api_token
end

Instance Method Details

#board(id, options = {}) {|board| ... } ⇒ Object

Get Trello::Client::Board object

See trello.com/docs/api/board/index.html

Params:

id

Board identifier

options

(optional) Additional API parameters

Yields:



160
161
162
163
164
165
# 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| ... } ⇒ Object

Get Trello::Client::Card object

See trello.com/docs/api/card/index.html

Params:

id

Card identifier

options

(optional) Additional API parameters

Yields:



176
177
178
179
180
181
# 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| ... } ⇒ Object

Get Trello::Client::List object

See trello.com/docs/api/list/index.html

Params:

id

List identifier

options

(optional) Additional API parameters

Yields:

  • (l)


192
193
194
195
196
197
# 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| ... } ⇒ Object

Get Trello::Client::Member object

See trello.com/docs/api/member/index.html

Params:

id

Member identifier

options

(optional) Additional API parameters

Yields:

  • (m)


209
210
211
212
213
214
# 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