Sha256: 56fa8d38a6a90541842659375de365e6500d911eace566123c0e6dc2dafddf76
Contents?: true
Size: 688 Bytes
Versions: 3
Compression:
Stored size: 688 Bytes
Contents
module Locomotive module Httparty class Webservice include ::HTTParty def self.consume(url, options = {}) url = HTTParty.normalize_base_uri(url) options[:base_uri], path = url.scan(/^(http[s]?:\/\/.+\.[a-z]{2,})(\/.+)*/).first options.delete(:format) if options[:format] == 'default' username, password = options.delete(:username), options.delete(:password) options[:basic_auth] = { :username => username, :password => password } if username path ||= '/' puts "[WebService] consuming #{path}, #{options.inspect}" self.get(path, options).try(:underscore_keys) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
locomotive_cms-0.0.3.3 | lib/locomotive/httparty/webservice.rb |
locomotive_cms-0.0.3.1 | lib/locomotive/httparty/webservice.rb |
locomotive_cms-0.0.2.9 | lib/locomotive/httparty/webservice.rb |