Class: StarkInfra::CreditNote::Invoice::Discount
- Inherits:
-
Utils::SubResource
- Object
- Utils::SubResource
- StarkInfra::CreditNote::Invoice::Discount
- Defined in:
- lib/creditnote/creditnote.rb
Overview
# CreditNote::Invoice::Discount object
Invoice discount information.
## Parameters (required):
-
percentage [float]: percentage of discount applied until specified due date
-
due [DateTime or string]: due datetime for the discount
Instance Attribute Summary collapse
-
#due ⇒ Object
readonly
Returns the value of attribute due.
-
#percentage ⇒ Object
readonly
Returns the value of attribute percentage.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(percentage:, due:) ⇒ Discount
constructor
A new instance of Discount.
Methods inherited from Utils::SubResource
Constructor Details
#initialize(percentage:, due:) ⇒ Discount
Returns a new instance of Discount.
510 511 512 513 |
# File 'lib/creditnote/creditnote.rb', line 510 def initialize(percentage:, due:) @percentage = percentage @due = due end |
Instance Attribute Details
#due ⇒ Object (readonly)
Returns the value of attribute due.
509 510 511 |
# File 'lib/creditnote/creditnote.rb', line 509 def due @due end |
#percentage ⇒ Object (readonly)
Returns the value of attribute percentage.
509 510 511 |
# File 'lib/creditnote/creditnote.rb', line 509 def percentage @percentage end |
Class Method Details
.parse_discounts(discounts) ⇒ Object
515 516 517 518 519 520 521 522 523 524 525 526 |
# File 'lib/creditnote/creditnote.rb', line 515 def self.parse_discounts(discounts) return discounts if discounts.nil? parsed_discounts = [] discounts.each do |discount| unless discount.is_a? Discount discount = StarkInfra::Utils::API.from_api_json(resource[:resource_maker], discount) end parsed_discounts << discount end parsed_discounts end |