Class: InstagramUser

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#follower_countObject

Returns the value of attribute follower_count.



2
3
4
# File 'lib/instagram_user.rb', line 2

def follower_count
  @follower_count
end

#is_privateObject

Returns the value of attribute is_private.



2
3
4
# File 'lib/instagram_user.rb', line 2

def is_private
  @is_private
end

#media_jsonObject

Returns the value of attribute media_json.



2
3
4
# File 'lib/instagram_user.rb', line 2

def media_json
  @media_json
end

#profile_pic_urlObject

Returns the value of attribute profile_pic_url.



2
3
4
# File 'lib/instagram_user.rb', line 2

def profile_pic_url
  @profile_pic_url
end

#usernameObject

Returns the value of attribute username.



2
3
4
# File 'lib/instagram_user.rb', line 2

def username
  @username
end

Instance Method Details

#avg_likesObject



3
4
5
6
7
8
9
# File 'lib/instagram_user.rb', line 3

def avg_likes
  #code
  items = @media_json['items']
  total = items.length
  sum_likes = items.inject(0){|s, post| s + post['likes']['count']}
  @avg = sum_likes/total
end