Class: Nfe::TaxCoupon::Item

Inherits:
Data
  • Object
show all
Defined in:
lib/nfe/resources/dto/consumer_invoice_query/tax_coupon.rb,
sig/nfe/resources/dto/consumer_invoice_query/tax_coupon.rbs

Overview

A single coupon line item (+det+ / prod).

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeItem

Returns a new instance of Item.

Parameters:

  • code: (Object)
  • description: (String, nil)
  • quantity: (Object)
  • unit_amount: (Object)
  • net_amount: (Object)
  • gross_amount: (Object)
  • cfop: (Object)


73
# File 'sig/nfe/resources/dto/consumer_invoice_query/tax_coupon.rbs', line 73

def initialize: (code: untyped, description: String?, quantity: untyped, unit_amount: untyped, net_amount: untyped, gross_amount: untyped, cfop: untyped) -> void

Instance Attribute Details

#cfopObject (readonly)

Returns the value of attribute cfop.

Returns:

  • (Object)


69
70
71
# File 'sig/nfe/resources/dto/consumer_invoice_query/tax_coupon.rbs', line 69

def cfop
  @cfop
end

#codeObject (readonly)

Returns the value of attribute code.

Returns:

  • (Object)


63
64
65
# File 'sig/nfe/resources/dto/consumer_invoice_query/tax_coupon.rbs', line 63

def code
  @code
end

#descriptionString? (readonly)

Returns the value of attribute description.

Returns:

  • (String, nil)


64
65
66
# File 'sig/nfe/resources/dto/consumer_invoice_query/tax_coupon.rbs', line 64

def description
  @description
end

#gross_amountObject (readonly)

Returns the value of attribute gross_amount.

Returns:

  • (Object)


68
69
70
# File 'sig/nfe/resources/dto/consumer_invoice_query/tax_coupon.rbs', line 68

def gross_amount
  @gross_amount
end

#net_amountObject (readonly)

Returns the value of attribute net_amount.

Returns:

  • (Object)


67
68
69
# File 'sig/nfe/resources/dto/consumer_invoice_query/tax_coupon.rbs', line 67

def net_amount
  @net_amount
end

#quantityObject (readonly)

Returns the value of attribute quantity.

Returns:

  • (Object)


65
66
67
# File 'sig/nfe/resources/dto/consumer_invoice_query/tax_coupon.rbs', line 65

def quantity
  @quantity
end

#unit_amountObject (readonly)

Returns the value of attribute unit_amount.

Returns:

  • (Object)


66
67
68
# File 'sig/nfe/resources/dto/consumer_invoice_query/tax_coupon.rbs', line 66

def unit_amount
  @unit_amount
end

Class Method Details

.from_api(payload) ⇒ Nfe::TaxCoupon::Item?

Parameters:

  • payload (Hash[untyped, untyped], nil)

Returns:



119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/nfe/resources/dto/consumer_invoice_query/tax_coupon.rb', line 119

def self.from_api(payload)
  return nil if payload.nil?

  new(
    code: payload["code"]&.to_s,
    description: payload["description"],
    quantity: payload["quantity"],
    unit_amount: payload["unitAmount"],
    net_amount: payload["netAmount"],
    gross_amount: payload["grossAmount"],
    cfop: payload["cfop"]
  )
end

.newinstance

Parameters:

  • code: (Object)
  • description: (String, nil)
  • quantity: (Object)
  • unit_amount: (Object)
  • net_amount: (Object)
  • gross_amount: (Object)
  • cfop: (Object)

Returns:

  • (instance)


72
# File 'sig/nfe/resources/dto/consumer_invoice_query/tax_coupon.rbs', line 72

def self.new: (code: untyped, description: String?, quantity: untyped, unit_amount: untyped, net_amount: untyped, gross_amount: untyped, cfop: untyped) -> instance