Class: Hcp::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/hcp/request.rb

Overview

One read from Housecall Pro.

Constant Summary collapse

HOST =

Where Housecall Pro answers.

'https://api.housecallpro.com'

Instance Method Summary collapse

Constructor Details

#initialize(path:, params: {}, company_id: nil) ⇒ Request

Returns a new instance of Request.

Parameters:

  • path (String)

    what to read, under the host.

  • params (Hash) (defaults to: {})

    the query to read it with.

  • company_id (String, nil) (defaults to: nil)

    the location to read it as.



10
11
12
13
14
# File 'lib/hcp/request.rb', line 10

def initialize(path:, params: {}, company_id: nil)
  @path = path
  @params = params
  @company_id = company_id
end

Instance Method Details

#bodyHash

Returns what Housecall Pro answered.

Returns:

  • (Hash)

    what Housecall Pro answered.



17
# File 'lib/hcp/request.rb', line 17

def body = Answer.new(Net::HTTP.get_response(uri, headers)).body