class Ticard::TrelloRepository
Public Class Methods
new(credentials={})
click to toggle source
# File lib/ticard/trello_repository.rb, line 6 def initialize(credentials={}) Trello.configure do |config| config.developer_public_key = credentials["developer_public_key"] config.member_token = credentials["member_token"] end end
Public Instance Methods
get(url)
click to toggle source
# File lib/ticard/trello_repository.rb, line 13 def get(url) in_trello = card_in_trello(url) Card.new(in_trello.desc, :url => url).as_stored end
put(card)
click to toggle source
# File lib/ticard/trello_repository.rb, line 18 def put(card) in_trello = card_in_trello(card.url) in_trello.desc = card.content in_trello.save end
Private Instance Methods
card_in_trello(url)
click to toggle source
# File lib/ticard/trello_repository.rb, line 26 def card_in_trello(url) regex = /\/c\/(.+?)\// id = regex.match(url)[1] Trello::Card.find(id) end