Class: InstaScraper::JSON::MediaCommentStream

Inherits:
InstaScraper::JSON show all
Defined in:
lib/insta_scraper/json/media_comment_stream.rb

Instance Attribute Summary collapse

Attributes inherited from InstaScraper::JSON

#response

Instance Method Summary collapse

Methods inherited from InstaScraper::JSON

#raw_json

Constructor Details

#initialize(shortcode, options = {}) ⇒ MediaCommentStream

, last_comment_id = nil, max_comments = nil, per_page = 20)



12
13
14
15
16
17
18
19
# File 'lib/insta_scraper/json/media_comment_stream.rb', line 12

def initialize(shortcode, options = {})#, last_comment_id = nil, max_comments = nil, per_page = 20)
  @shortcode       = shortcode
  @last_comment_id = options[:last_comment_id] || nil
  @per_page        = options[:per_page] || 20
  @max_comments    = options[:max_comments] || nil
  @responses       = {}
  @comments        = {}
end

Instance Attribute Details

#commentsObject (readonly)

Returns the value of attribute comments.



4
5
6
# File 'lib/insta_scraper/json/media_comment_stream.rb', line 4

def comments
  @comments
end

#errorObject (readonly)

Returns the value of attribute error.



4
5
6
# File 'lib/insta_scraper/json/media_comment_stream.rb', line 4

def error
  @error
end

#last_comment_idObject (readonly)

Returns the value of attribute last_comment_id.



4
5
6
# File 'lib/insta_scraper/json/media_comment_stream.rb', line 4

def last_comment_id
  @last_comment_id
end

#max_commentsObject (readonly)

Returns the value of attribute max_comments.



4
5
6
# File 'lib/insta_scraper/json/media_comment_stream.rb', line 4

def max_comments
  @max_comments
end

#per_pageObject (readonly)

Returns the value of attribute per_page.



4
5
6
# File 'lib/insta_scraper/json/media_comment_stream.rb', line 4

def per_page
  @per_page
end

#responsesObject (readonly)

Returns the value of attribute responses.



4
5
6
# File 'lib/insta_scraper/json/media_comment_stream.rb', line 4

def responses
  @responses
end

#shortcodeObject (readonly)

Returns the value of attribute shortcode.



4
5
6
# File 'lib/insta_scraper/json/media_comment_stream.rb', line 4

def shortcode
  @shortcode
end

Instance Method Details

#dataObject



21
22
23
24
25
# File 'lib/insta_scraper/json/media_comment_stream.rb', line 21

def data
  Hashie::Mash.new({ comments: _data })
              .extend(Hashie::Extensions::DeepFetch)
              .extend(Hashie::Extensions::DeepFind)
end