Class: StarkInfra::CreditNote::Invoice::Description
- Inherits:
-
Utils::SubResource
- Object
- Utils::SubResource
- StarkInfra::CreditNote::Invoice::Description
- Defined in:
- lib/creditnote/creditnote.rb
Overview
# CreditNote::Invoice::Description object
Invoice description information.
## Parameters (required):
-
key [string]: Description for the value. ex: ‘Taxes’
## Parameters (optional):
-
value [string]: amount related to the described key. ex: ‘R$100,00’
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(key:, value:) ⇒ Description
constructor
A new instance of Description.
Methods inherited from Utils::SubResource
Constructor Details
#initialize(key:, value:) ⇒ Description
Returns a new instance of Description.
552 553 554 555 |
# File 'lib/creditnote/creditnote.rb', line 552 def initialize(key:, value:) @key = key @value = value end |
Instance Attribute Details
#due ⇒ Object (readonly)
Returns the value of attribute due.
551 552 553 |
# File 'lib/creditnote/creditnote.rb', line 551 def due @due end |
#percentage ⇒ Object (readonly)
Returns the value of attribute percentage.
551 552 553 |
# File 'lib/creditnote/creditnote.rb', line 551 def percentage @percentage end |
Class Method Details
.parse_descriptions(descriptions) ⇒ Object
557 558 559 560 561 562 563 564 565 566 567 |
# File 'lib/creditnote/creditnote.rb', line 557 def self.parse_descriptions(descriptions) return descriptions if descriptions.nil? parsed_descriptions = [] descriptions.each do |description| unless description.is_a? Description description = StarkInfra::Utils::API.from_api_json(resource[:resource_maker], description) end parsed_descriptions << description end parsed_descriptions end |
.resource ⇒ Object
569 570 571 572 573 574 575 576 577 578 579 |
# File 'lib/creditnote/creditnote.rb', line 569 def self.resource { resource_name: 'Description', resource_maker: proc { |json| Description.new( key: json['key'], value: json['value'] ) } } end |