Class: GrowViral::Warehouse::ChecksFollowHistory
- Inherits:
-
Object
- Object
- GrowViral::Warehouse::ChecksFollowHistory
- Defined in:
- lib/warehouse/checks_follow_history.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#following_uid ⇒ Object
readonly
Returns the value of attribute following_uid.
-
#uid ⇒ Object
readonly
Returns the value of attribute uid.
Class Method Summary collapse
Instance Method Summary collapse
- #exists? ⇒ Boolean
-
#initialize(uid, following_uid, deps) ⇒ ChecksFollowHistory
constructor
A new instance of ChecksFollowHistory.
- #uri ⇒ Object
Constructor Details
#initialize(uid, following_uid, deps) ⇒ ChecksFollowHistory
Returns a new instance of ChecksFollowHistory.
9 10 11 12 13 14 15 16 |
# File 'lib/warehouse/checks_follow_history.rb', line 9 def initialize(uid, following_uid, deps) raise HandleNotUidError unless uid.is_a? Numeric raise HandleNotUidError unless following_uid.is_a? Numeric @uid = uid @following_uid = following_uid @config = deps[:config] end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
8 9 10 |
# File 'lib/warehouse/checks_follow_history.rb', line 8 def config @config end |
#following_uid ⇒ Object (readonly)
Returns the value of attribute following_uid.
8 9 10 |
# File 'lib/warehouse/checks_follow_history.rb', line 8 def following_uid @following_uid end |
#uid ⇒ Object (readonly)
Returns the value of attribute uid.
8 9 10 |
# File 'lib/warehouse/checks_follow_history.rb', line 8 def uid @uid end |
Class Method Details
.exists?(*args) ⇒ Boolean
4 5 6 |
# File 'lib/warehouse/checks_follow_history.rb', line 4 def self.exists?(*args) new(*args).exists? end |
Instance Method Details
#exists? ⇒ Boolean
18 19 20 21 22 23 24 25 |
# File 'lib/warehouse/checks_follow_history.rb', line 18 def exists? response = Net::HTTP.get_response(uri) if response.code.to_i == 200 true else false end end |
#uri ⇒ Object
27 28 29 |
# File 'lib/warehouse/checks_follow_history.rb', line 27 def uri @uri ||= URI.parse("#{config.host}/follows?uid=#{uid}&following_uid=#{following_uid}") end |