Class: IGScrape::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/ig_scrape/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username) ⇒ Client

Returns a new instance of Client.



7
8
9
10
11
# File 'lib/ig_scrape/client.rb', line 7

def initialize(username)
  @username = username
  @posts = []
  load_profile
end

Instance Attribute Details

#follower_countObject

Returns the value of attribute follower_count.



5
6
7
# File 'lib/ig_scrape/client.rb', line 5

def follower_count
  @follower_count
end

#follows_countObject

Returns the value of attribute follows_count.



5
6
7
# File 'lib/ig_scrape/client.rb', line 5

def follows_count
  @follows_count
end

#full_nameObject

Returns the value of attribute full_name.



5
6
7
# File 'lib/ig_scrape/client.rb', line 5

def full_name
  @full_name
end

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/ig_scrape/client.rb', line 5

def id
  @id
end

#post_countObject

Returns the value of attribute post_count.



5
6
7
# File 'lib/ig_scrape/client.rb', line 5

def post_count
  @post_count
end

#postsObject

Returns the value of attribute posts.



5
6
7
# File 'lib/ig_scrape/client.rb', line 5

def posts
  @posts
end

#profile_pic_urlObject

Returns the value of attribute profile_pic_url.



5
6
7
# File 'lib/ig_scrape/client.rb', line 5

def profile_pic_url
  @profile_pic_url
end

#usernameObject

Returns the value of attribute username.



5
6
7
# File 'lib/ig_scrape/client.rb', line 5

def username
  @username
end

Instance Method Details

#has_more_posts?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/ig_scrape/client.rb', line 19

def has_more_posts?
  @posts.length < @post_count
end

#loadObject



13
14
15
16
17
# File 'lib/ig_scrape/client.rb', line 13

def load
  while has_more_posts? do
    load_more_posts
  end
end

#loaded_post_countObject



23
24
25
# File 'lib/ig_scrape/client.rb', line 23

def loaded_post_count
  @posts.length
end