Class: Mistilteinn::Ticket::Github

Inherits:
Object
  • Object
show all
Defined in:
lib/mistilteinn/ticket/github.rb

Defined Under Namespace

Classes: ConfigError

Constant Summary collapse

API_URL_ROOT =
"https://api.github.com/"

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Github

Returns a new instance of Github.



12
13
14
15
16
17
# File 'lib/mistilteinn/ticket/github.rb', line 12

def initialize(config)
  @url = config.github.url
  unless @url
    raise ConfigError.new
  end
end

Instance Method Details

#create(title) ⇒ Object



27
28
29
# File 'lib/mistilteinn/ticket/github.rb', line 27

def create(title)
  # FIXME or DIE
end

#ticketsObject



19
20
21
22
23
24
25
# File 'lib/mistilteinn/ticket/github.rb', line 19

def tickets
  ::Mistilteinn::HttpUtil::get_json(api("issues")).map do |issue|
    ::Mistilteinn::Ticket::Entry.new(issue['number'],
                                     issue['title'],
                                     issue['state'])
  end
end