Module: Gistmeetup
Defined Under Namespace
Modules: Error
Constant Summary collapse
- VERSION =
'0.0.1'
Instance Method Summary collapse
- #login!(credentials = {}) ⇒ Object
- #post(meetup, comment, files, options = {}) ⇒ Object
- #saveMetaData(meetup, comment, nextEvent, url, response) ⇒ Object
Instance Method Details
#login!(credentials = {}) ⇒ Object
58 59 60 |
# File 'lib/gistmeetup.rb', line 58 def login!(credentials={}) Gist.login!(credentials) end |
#post(meetup, comment, files, options = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/gistmeetup.rb', line 20 def post(meetup, comment, files, ={}) ret = Gist.multi_gist(files, ) 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"] response = RMeetup::Client.post(:event_comment, {:event_id => "#{nextEvent.id}", :comment => "#{comment} - #{url}" }) saveMetaData(meetup, comment, nextEvent, url, response) "Posted to github on '#{url}' and link to it on '#{meetup}' comments" end end |
#saveMetaData(meetup, comment, nextEvent, url, response) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/gistmeetup.rb', line 44 def saveMetaData(meetup, comment, nextEvent, url, response) json = JSON.parse(response.body) code = Parse::Object.new("Code") code["meetup"] = meetup code["comment"] = comment code["nextEvent_id"] = nextEvent.id code["nextEvent_name"] = nextEvent.name code["member_id"] = json["member_id"].to_s code["member_name"] = json["member_name"] code["event_comment_id"] = json["event_comment_id"].to_s result = code.save end |