Sha256: 235e14f7baf805ae4e050e7d9d6275ae69bbcb21cca9fc16e4ece9f9504caef8

Contents?: true

Size: 629 Bytes

Versions: 2

Compression:

Stored size: 629 Bytes

Contents

# frozen_string_literal: true

module PuppeteerEntity
  class Content < Base
    attributes_from Attributes::Content

    transform_keys(&:to_sym)

    private

    def as_body_json
      to_h
        .slice(*Attributes::Content.attribute_names)
        .reject { |_, v| v.blank? }
        .deep_stringify_keys
        .deep_transform_keys do |k|
          case k
          when "set_extra_http_headers" then "setExtraHTTPHeaders"
          else k.camelcase(:lower)
          end
        end
    end

    def browserless_uri
      URI.parse(browserless_url).tap do |uri|
        uri.path = "/content"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
puppeteer_entity-0.1.1 lib/puppeteer_entity/content.rb
puppeteer_entity-0.1.0 lib/puppeteer_entity/content.rb