Class: Gemometer::Notifiers::Base
- Inherits:
-
Object
- Object
- Gemometer::Notifiers::Base
- Defined in:
- lib/gemometer/notifiers/base.rb
Instance Attribute Summary collapse
-
#gems ⇒ Object
readonly
Returns the value of attribute gems.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(opts) ⇒ Base
constructor
A new instance of Base.
- #notify ⇒ Object
Constructor Details
#initialize(opts) ⇒ Base
Returns a new instance of Base.
11 12 13 14 15 16 |
# File 'lib/gemometer/notifiers/base.rb', line 11 def initialize(opts) @gems = opts[:gems] @url = opts[:url] @key = opts[:key] @username = opts[:username] end |
Instance Attribute Details
#gems ⇒ Object (readonly)
Returns the value of attribute gems.
9 10 11 |
# File 'lib/gemometer/notifiers/base.rb', line 9 def gems @gems end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
9 10 11 |
# File 'lib/gemometer/notifiers/base.rb', line 9 def key @key end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
9 10 11 |
# File 'lib/gemometer/notifiers/base.rb', line 9 def url @url end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
9 10 11 |
# File 'lib/gemometer/notifiers/base.rb', line 9 def username @username end |
Class Method Details
.mandatory_options ⇒ Object
24 25 26 |
# File 'lib/gemometer/notifiers/base.rb', line 24 def self. raise NotImplementedError end |
Instance Method Details
#notify ⇒ Object
18 19 20 21 22 |
# File 'lib/gemometer/notifiers/base.rb', line 18 def notify return false if gems.empty? response = make_request %w(204 200).include?(response.code) || raise(Gemometer::NotifyError.new("#{response.code}: #{response.message}")) end |