Class: Senju::Trello

Inherits:
Object
  • Object
show all
Defined in:
lib/senju/trello.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Trello

Returns a new instance of Trello.



5
6
7
8
9
10
11
# File 'lib/senju/trello.rb', line 5

def initialize(params)
  @client = Trello::Client.new(
    consumer_key: params["key"],
    consumer_secret: params["secret"],
    oauth_token: params["token"]
  )
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



13
14
15
# File 'lib/senju/trello.rb', line 13

def method_missing(method, *args, &block)
  client.send(method, *args, &block)
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



3
4
5
# File 'lib/senju/trello.rb', line 3

def client
  @client
end

Instance Method Details

#board(repo) ⇒ Object



17
18
19
# File 'lib/senju/trello.rb', line 17

def board(repo)
  client.find(:boards, repo)
end

#columns(repo) ⇒ Object



21
22
23
# File 'lib/senju/trello.rb', line 21

def columns(repo)
  board(repo).lists
end

#issues(repo) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/senju/trello.rb', line 25

def issues(repo)
  cards = []
  columns(repo).each do |column|
    column.cards.each do |card|
      cards << card
    end
  end
  cards
end