Sha256: a9800de0278db98cca4415f789df7e945885071669bcbcf342a3fc901eb7a421

Contents?: true

Size: 548 Bytes

Versions: 1

Compression:

Stored size: 548 Bytes

Contents

class CloudscrapeClient
  class Executions
    class Results
      attr_reader :response

      def initialize(response:)
        @response = response
      end

      def as_hash
        collection.map(&:as_hash)
      end

      def collection
        response.fetch(:rows, [[]]).map(&result)
      end

      private

      def headers
        response.fetch(:headers, [])
      end

      def result
        lambda do |row|
          CloudscrapeClient::Executions::Result.new(headers: headers, row: row)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cloudscrape-client-0.4.0 lib/cloudscrape_client/executions/results.rb