Sha256: 9c64e7b3ce7ca319faa037b12482d0826ac8fc79c999a7fb4b21984c440c1074

Contents?: true

Size: 533 Bytes

Versions: 4

Compression:

Stored size: 533 Bytes

Contents

module InstaScraper
  class JSON
    def raw_json
      @raw_json ||= response.body
    end

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

    attr_writer :response

    def response
      @response ||= Faraday.get(url)
    end

    protected

    def serialize_params
      return '' if params.empty?

      "?" + params.map {|k, v| "#{k}=#{v}"}.join('&')
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
insta_scraper-0.8.0 lib/insta_scraper/json.rb
insta_scraper-0.7.0 lib/insta_scraper/json.rb
insta_scraper-0.6.1 lib/insta_scraper/json.rb
insta_scraper-0.6.0 lib/insta_scraper/json.rb