Class: DevOpsDaysOutput
- Inherits:
-
Object
- Object
- DevOpsDaysOutput
- Includes:
- HTTParty
- Defined in:
- lib/papercallio/devopsdays_output.rb
Instance Method Summary collapse
- #download_twitter_image ⇒ Object
-
#initialize(submission) ⇒ DevOpsDaysOutput
constructor
A new instance of DevOpsDaysOutput.
- #output_program ⇒ Object
- #output_speaker ⇒ Object
Constructor Details
#initialize(submission) ⇒ DevOpsDaysOutput
Returns a new instance of DevOpsDaysOutput.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/papercallio/devopsdays_output.rb', line 9 def initialize(submission) #puts submission['talk_talk_format'] @submission = submission @talk_type = "talk" if submission['talk_talk_format'].include?('Talk') @talk_type = "ignite" if submission['talk_talk_format'].include?('Ignite') @reformat_name = submission['profile_name'].downcase.tr(" ", "-") @file_name = "#{@reformat_name}.md" @options = { screen_name: submission['profile_twitter'] } output_program output_speaker #puts submission['profile_twitter'] #if submission['profile_twitter'] # download_twitter_image #else # puts "no twitter profile for #{submission['profile_name']}, so did not attempt to download" #end end |
Instance Method Details
#download_twitter_image ⇒ Object
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/papercallio/devopsdays_output.rb', line 64 def download_twitter_image twitter_info = self.class.get('/1.1/users/show.json', @options) puts twitter_info twitter_image_url = twitter_info['profile_image_url_https'] puts twitter_info['profile_image_url_https'] download = open(URI.parse(twitter_image_url)) # likely should honor the original format jpg/gif/png or whatever IO.copy_stream(download, "images/#{@reformat_name}.jpg") # if no twitter image, then should likely look to see if website is linked in then try to pull from there end |
#output_program ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/papercallio/devopsdays_output.rb', line 27 def output_program session_markdown = [ "+++", "Talk_date = \"\"", "Talk_start_time = \"\"", "Talk_end_time = \"\"", "Title = \"#{@submission['talk_title']}\"", "Type = \"#{@talk_type}\"", "Speakers = [\"#{@submission['profile_name']}\"]", "+++", "#{@submission['talk_description']}" ].join("\n") + "\n" File.open("program/#{@file_name}", 'w') do |f| f.puts session_markdown end end |
#output_speaker ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/papercallio/devopsdays_output.rb', line 45 def output_speaker speaker_markdown = [ "+++", "Title = \"#{@submission['profile_name']}\"", "Twitter = \"#{@submission['profile_twitter']}\"", "Website = \"#{@submission['profile_url']}\"", "type = \"speaker\"", "linktitle = \"#{@reformat_name}\"", "image = \"#{@reformat_name}.jpg\"", "+++", "#{@submission['profile_bio']}" ].join("\n") + "\n" File.open("speakers/#{@file_name}", 'w') do |f| f.puts speaker_markdown end end |