Class: Hackershout::Provider::Base
- Inherits:
-
Object
- Object
- Hackershout::Provider::Base
- Includes:
- Output
- Defined in:
- lib/hackershout/provider/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#agent ⇒ Object
readonly
Returns the value of attribute agent.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Base
constructor
A new instance of Base.
- #post ⇒ Object
- #publish ⇒ Object
Methods included from Output
Constructor Details
#initialize(options = {}) ⇒ Base
Returns a new instance of Base.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/hackershout/provider/base.rb', line 13 def initialize( = {}) @name = self.class.name.split("::").last @url = [:url] << "&utm_medium=#{@name.downcase}" @title = [:title] @tags = [:tags] @message = [:message] creds = YAML.load(File.read(File.join(File.('~'), '.hackershoutrc')))[@name.downcase] raise "Can't find credentials on ~/.hackershoutrc for #{@name}" unless creds @login = creds["login"] @password = creds["password"] @agent = Mechanize.new end |
Instance Attribute Details
#agent ⇒ Object (readonly)
Returns the value of attribute agent.
9 10 11 |
# File 'lib/hackershout/provider/base.rb', line 9 def agent @agent end |
Instance Method Details
#post ⇒ Object
34 35 36 |
# File 'lib/hackershout/provider/base.rb', line 34 def post raise NotImplementedError end |
#publish ⇒ Object
28 29 30 31 32 |
# File 'lib/hackershout/provider/base.rb', line 28 def publish print "Posting to #{@name}..." post unless ENV['NOSEND'] print "Posted to #{@name}!" end |