Module: Gistmeetup

Extended by:
Gistmeetup
Included in:
Gistmeetup
Defined in:
lib/gistmeetup.rb

Defined Under Namespace

Modules: Error

Constant Summary collapse

VERSION =
'0.0.1'

Instance Method Summary collapse

Instance Method Details

#login!(credentials = {}) ⇒ Object



38
39
40
# File 'lib/gistmeetup.rb', line 38

def login!(credentials={})
  Gist.login!(credentials)
end

#post(meetup, comment, files, options = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/gistmeetup.rb', line 15

def post(meetup, comment, files, options={})
  ret = Gist.multi_gist(files, options)

  RMeetup::Client.api_key = "311e1e54e55667752236e673758662c"

  events = RMeetup::Client.fetch(:events, {:group_urlname => "#{meetup}"})
  if events.empty?
    groups = RMeetup::Client.fetch(:groups, {:group_urlname => "#{meetup}"})
    ret = ""
    if groups.empty?
      ret = "The meetup '#{meetup}' does not exist." 
    else
      ret = "No meetup events exist for '#{meetup}'"
    end
    ret
  else
    nextEvent = events[0]
    url = ret["html_url"]
    RMeetup::Client.post(:event_comment, {:event_id => "#{nextEvent.id}", :comment => "#{comment} - #{url}" })
    "Posted to github on '#{url}' and link to it on '#{meetup}' comments"
  end
end