Class: GrowViral::Warehouse::FetchesFollowHistory

Inherits:
Object
  • Object
show all
Defined in:
lib/warehouse/fetches_follow_history.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uid, deps) ⇒ FetchesFollowHistory

Returns a new instance of FetchesFollowHistory.

Raises:



9
10
11
12
13
14
# File 'lib/warehouse/fetches_follow_history.rb', line 9

def initialize(uid, deps)
  raise HandleNotUidError unless uid.is_a? Numeric

  @uid = uid
  @config = deps[:config]
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



8
9
10
# File 'lib/warehouse/fetches_follow_history.rb', line 8

def config
  @config
end

#uidObject (readonly)

Returns the value of attribute uid.



8
9
10
# File 'lib/warehouse/fetches_follow_history.rb', line 8

def uid
  @uid
end

Class Method Details

.fetch(*args) ⇒ Object



4
5
6
# File 'lib/warehouse/fetches_follow_history.rb', line 4

def self.fetch(*args)
  new(*args).fetch
end

Instance Method Details

#fetchObject



16
17
18
19
# File 'lib/warehouse/fetches_follow_history.rb', line 16

def fetch
  response = Net::HTTP.get_response(uri)
  JSON.parse(response.body)
end

#uriObject



21
22
23
# File 'lib/warehouse/fetches_follow_history.rb', line 21

def uri
  @uri ||= URI.parse("#{config.host}/follow_history?uid=#{uid}")
end