Sha256: a28441a88b39e46e7b8a90a896ef372ca8e4f84db8d1038e6dc19eb5ef56103e
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
module Awis module API class UrlInfo < Base DEFAULT_RESPONSE_GROUP = %w(related_links categories rank rank_by_country usage_stats adult_content speed language owned_domains links_in_count site_data).freeze def fetch(arguments = {}) raise ArgumentError, "Any valid URL." unless arguments.has_key?(:url) validation_arguments!(arguments) @response_body = Awis::Connection.new.get(params) self end def load_request_uri(arguments = {}) validation_arguments!(arguments) super(params) end private def validation_arguments!(arguments) @arguments = arguments @arguments[:response_group] = Array(arguments.fetch(:response_group, DEFAULT_RESPONSE_GROUP)) end def params { "Action" => action_name, "Url" => arguments[:url], "ResponseGroup" => response_groups, } end def response_groups arguments[:response_group].sort.map { |group| camelize(group) }.join(",") end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
awis-sdk-ruby-0.0.6 | lib/awis/api/url_info.rb |
awis-sdk-ruby-0.0.5 | lib/awis/api/url_info.rb |