Class: InstaScraper::HTML::Account
- Inherits:
-
InstaScraper::HTML
- Object
- InstaScraper::HTML
- InstaScraper::HTML::Account
- Defined in:
- lib/insta_scraper/html/account.rb
Instance Attribute Summary collapse
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(username = nil, html = nil) ⇒ Account
constructor
A new instance of Account.
- #url ⇒ Object
Methods inherited from InstaScraper::HTML
Constructor Details
#initialize(username = nil, html = nil) ⇒ Account
Returns a new instance of Account.
5 6 7 8 9 10 |
# File 'lib/insta_scraper/html/account.rb', line 5 def initialize(username = nil, html = nil) raise ArgumentError, 'Provide a username or html string' if !username && !html @username = username @html = html end |
Instance Attribute Details
#username ⇒ Object (readonly)
Returns the value of attribute username.
3 4 5 |
# File 'lib/insta_scraper/html/account.rb', line 3 def username @username end |
Instance Method Details
#data ⇒ Object
16 17 18 19 20 21 |
# File 'lib/insta_scraper/html/account.rb', line 16 def data @data ||= Hashie::Mash.new(::JSON.parse(shared_data)) .extend(Hashie::Extensions::DeepFetch) .extend(Hashie::Extensions::DeepFind) end |
#url ⇒ Object
12 13 14 |
# File 'lib/insta_scraper/html/account.rb', line 12 def url "https://www.instagram.com/#{username}/" end |