Class: FaxFinder::Query

Inherits:
Request show all
Defined in:
lib/fax_finder/query.rb

Constant Summary

Constants inherited from Request

Request::CONTENT_TYPE, Request::TIME_FORMAT

Constants included from Constants

Constants::BASE_PATH, Constants::DEFAULT_PORT, Constants::DEFAULT_SSL

Class Method Summary collapse

Class Method Details

.construct_http_request(fax_key, entry_key) ⇒ Object



13
14
15
16
17
18
# File 'lib/fax_finder/query.rb', line 13

def self.construct_http_request(fax_key, entry_key)
  request = Net::HTTP::Get.new(self.path(fax_key, entry_key))
  request.basic_auth self.user, self.password
  request.set_content_type(Request::CONTENT_TYPE)
  request
end

.get(fax_key, entry_key) ⇒ Object



7
8
9
10
11
# File 'lib/fax_finder/query.rb', line 7

def self.get(fax_key, entry_key)
  self.post(){
    construct_http_request(fax_key, entry_key)
  }
end

.path(fax_key, entry_key) ⇒ Object



20
21
22
23
# File 'lib/fax_finder/query.rb', line 20

def self.path(fax_key, entry_key)
  params=[BASE_PATH, fax_key, entry_key].reject{ |p| p.nil? }
  File.join(*params)
end