Class: InstaScraper::JSON::Account

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from InstaScraper::JSON

#raw_json

Constructor Details

#initialize(username) ⇒ Account

Returns a new instance of Account.



5
6
7
# File 'lib/insta_scraper/json/account.rb', line 5

def initialize(username)
  @username = username
end

Instance Attribute Details

#usernameObject (readonly)

Returns the value of attribute username.



3
4
5
# File 'lib/insta_scraper/json/account.rb', line 3

def username
  @username
end

Instance Method Details

#dataObject



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

def data
  @data ||=
    Hashie::Mash.new(::JSON.parse(raw_json))
                .extend(Hashie::Extensions::DeepFetch)
                .extend(Hashie::Extensions::DeepFind)
end

#urlObject



9
10
11
# File 'lib/insta_scraper/json/account.rb', line 9

def url
  "https://www.instagram.com/#{username}/?__a=1"
end