Class: Hcp::LineItem

Inherits:
Resource show all
Defined in:
lib/hcp/resources/line_item.rb

Overview

One line of what a job or an estimate option comes to.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

amount, attribute, #id, #initialize, timestamp

Constructor Details

This class inherits a constructor from Hcp::Resource

Class Method Details

.keyObject

Housecall Pro answers a job's line items under data rather than under their own name.



5
# File 'lib/hcp/resources/line_item.rb', line 5

def self.key = 'data'

Instance Method Details

#amountBigDecimal?

Returns the amount, which Housecall Pro counts in cents.

Returns:

  • (BigDecimal, nil)

    the amount, which Housecall Pro counts in cents.



15
# File 'lib/hcp/resources/line_item.rb', line 15

amount :amount

#descriptionString?

Returns the description, as Housecall Pro answers it.

Returns:

  • (String, nil)

    the description, as Housecall Pro answers it.



8
# File 'lib/hcp/resources/line_item.rb', line 8

attribute :description

#kindSymbol?

Returns :materials, :labor, or one of the gratuities and discounts.

Returns:

  • (Symbol, nil)

    :materials, :labor, or one of the gratuities and discounts.



18
# File 'lib/hcp/resources/line_item.rb', line 18

def kind = @node['kind']&.tr(' ', '_')&.to_sym

#nameString?

Returns the name, as Housecall Pro answers it.

Returns:

  • (String, nil)

    the name, as Housecall Pro answers it.



7
# File 'lib/hcp/resources/line_item.rb', line 7

attribute :name

#quantityFloat, ...

Returns:

  • (Float, nil)

    how many of it, to two decimal places.

  • (String, nil)

    the quantity, as Housecall Pro answers it.



11
# File 'lib/hcp/resources/line_item.rb', line 11

attribute :quantity

#unit_costBigDecimal?

Returns the unit_cost, which Housecall Pro counts in cents.

Returns:

  • (BigDecimal, nil)

    the unit_cost, which Housecall Pro counts in cents.



14
# File 'lib/hcp/resources/line_item.rb', line 14

amount :unit_cost

#unit_priceBigDecimal?

Returns the unit_price, which Housecall Pro counts in cents.

Returns:

  • (BigDecimal, nil)

    the unit_price, which Housecall Pro counts in cents.



13
# File 'lib/hcp/resources/line_item.rb', line 13

amount :unit_price