Class: Alma::FineSet
- Inherits:
-
Object
- Object
- Alma::FineSet
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/alma/fine_set.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
include Alma::Error.
Instance Method Summary collapse
- #currency ⇒ Object
- #each ⇒ Object (also: #list)
-
#initialize(response_body_hash) ⇒ FineSet
constructor
A new instance of FineSet.
- #key ⇒ Object
- #size ⇒ Object
- #sum ⇒ Object (also: #total_sum)
- #total_record_count ⇒ Object (also: #total_records)
Constructor Details
#initialize(response_body_hash) ⇒ FineSet
Returns a new instance of FineSet.
10 11 12 |
# File 'lib/alma/fine_set.rb', line 10 def initialize(response_body_hash) @response = response_body_hash end |
Instance Attribute Details
#response ⇒ Object (readonly)
include Alma::Error
7 8 9 |
# File 'lib/alma/fine_set.rb', line 7 def response @response end |
Instance Method Details
#currency ⇒ Object
32 33 34 |
# File 'lib/alma/fine_set.rb', line 32 def currency fetch('currency', nil) end |
#each ⇒ Object Also known as: list
18 19 20 |
# File 'lib/alma/fine_set.rb', line 18 def each @response.fetch(key, []).map{|item| Alma::AlmaRecord.new(item)} end |
#key ⇒ Object
14 15 16 |
# File 'lib/alma/fine_set.rb', line 14 def key 'fee' end |
#size ⇒ Object
23 24 25 |
# File 'lib/alma/fine_set.rb', line 23 def size each.count end |
#sum ⇒ Object Also known as: total_sum
27 28 29 |
# File 'lib/alma/fine_set.rb', line 27 def sum fetch('total_sum', 0) end |
#total_record_count ⇒ Object Also known as: total_records
36 37 38 |
# File 'lib/alma/fine_set.rb', line 36 def total_record_count fetch('total_record_count', 0) end |