Module: ProsperWorks::ApiOperations::List

Includes:
Connect
Included in:
Webhook
Defined in:
lib/prosperworks/api_operations/list.rb

Instance Method Summary collapse

Methods included from Connect

#get_uri, #handle_response, #send_request

Instance Method Details

#handle_multiple_response(response) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/prosperworks/api_operations/list.rb', line 16

def handle_multiple_response(response)
  result = handle_response(nil, response)
  if result.is_a?(ProsperWorks::Errors)
    # pass the error along
    result
  else
    result.map do |webhook|
      self.new(webhook)
    end
  end
end

#listObject



9
10
11
12
13
14
# File 'lib/prosperworks/api_operations/list.rb', line 9

def list
  uri = get_uri(api_name)

  response = send_request("get", uri)
  handle_multiple_response(response)
end