Sha256: 648de01627ecd0500bc59d11c9b436323129e0ccf90d4197f6a3158c267c6150
Contents?: true
Size: 944 Bytes
Versions: 49
Compression:
Stored size: 944 Bytes
Contents
# frozen_string_literal: true require 'active_support/core_ext/hash/indifferent_access' require 'httpclient' require 'yaml' module Aranha module Parsers class SourceAddress class HashHttpPost class << self def valid_source?(source) source.is_a?(::Hash) && source.with_indifferent_access[:method].to_s.downcase.strip == 'post' end end attr_reader :source def initialize(source) @source = source.with_indifferent_access end def ==(other) self.class == other.class && source == other.source end def url source.fetch(:url) end def serialize source.to_yaml end def content HTTPClient.new.post_content( source[:url], source[:params].merge(follow_redirect: true) ) end end end end end
Version data entries
49 entries across 49 versions & 3 rubygems