class PageData

Class handling media data. Takes a data object extended Hashie::Extensions::DeepFind

Attributes

all_media[R]
all_media_count[R]
end_cursor[R]
hashtag_id[R]
hashtag_name[R]
media_count[R]
medias[R]
top_media_count[R]
top_medias[R]

Public Class Methods

new(data) click to toggle source
# File lib/botinsta/data/page_data.rb, line 9
def initialize(data)

  @hashtag_id       = data.deep_find('hashtag')['id']
  @hashtag_name     = data.deep_find('hashtag')['name']
  @has_next_page    = data.deep_find('page_info')['has_next_page']
  @end_cursor       = data.deep_find('end_cursor')
  @top_medias       = data['data']['hashtag']['edge_hashtag_to_top_posts']['edges']
  @top_media_count  = @top_medias.count
  @medias           = data['data']['hashtag']['edge_hashtag_to_media']['edges']
  @media_count      = @medias.count + @top_media_count
  @all_media        = @top_medias + @medias
  @all_media_count  = @all_media.count

end

Public Instance Methods

end_cursor_nil?() click to toggle source
# File lib/botinsta/data/page_data.rb, line 28
def end_cursor_nil?
  @end_cursor.nil?
end
medias_empty?() click to toggle source
# File lib/botinsta/data/page_data.rb, line 32
def medias_empty?
  @medias.empty?
end
next_page?() click to toggle source
# File lib/botinsta/data/page_data.rb, line 24
def next_page?
  @has_next_page
end