Class: PSClient::Api

Inherits:
BaseApi show all
Defined in:
lib/ps_pop_client/client.rb

Instance Method Summary collapse

Methods inherited from BaseApi

#request

Constructor Details

#initialize(args = { :base_uri => DEFAULT_URI }) ⇒ Api

Returns a new instance of Api.



6
7
8
# File 'lib/ps_pop_client/client.rb', line 6

def initialize(args={ :base_uri => DEFAULT_URI })
  super(args)
end

Instance Method Details

#find(req = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ps_pop_client/client.rb', line 10

def find(req={}) 
  begin
    parsed_req = parse_req_to_symbols(req)
    check_request(parsed_req)
    uri = encode_uri(parsed_req)
    response = request(uri)
    check_status(response)
    fitlered_response = filter_records(parsed_req, response)
    return Response.new(fitlered_response).parse
  rescue => e
    return Response.new(e).parse_error
  end
end