Class: EvergreenHoldings::Status
- Inherits:
-
Object
- Object
- EvergreenHoldings::Status
- Defined in:
- lib/evergreen_holdings.rb
Overview
Status objects represent all the holdings attached to a specific tcn
Instance Attribute Summary collapse
-
#copies ⇒ Object
readonly
Returns the value of attribute copies.
-
#libraries ⇒ Object
readonly
Returns the value of attribute libraries.
Instance Method Summary collapse
-
#any_copies_available? ⇒ Boolean
Determines if any copies are available for your patrons.
-
#initialize(json_data, idl_order, connection = nil) ⇒ Status
constructor
A new instance of Status.
Constructor Details
permalink #initialize(json_data, idl_order, connection = nil) ⇒ Status
Returns a new instance of Status.
157 158 159 160 161 162 163 164 165 |
# File 'lib/evergreen_holdings.rb', line 157 def initialize(json_data, idl_order, connection = nil) @idl_order = idl_order @connection = connection @raw_data = JSON.parse(json_data)['payload'][0] extract_copies substitute_values_for_ids unless @connection.nil? @available_copies = [] @next_copy_available = 'a date' end |
Instance Attribute Details
permalink #copies ⇒ Object (readonly)
Returns the value of attribute copies.
155 156 157 |
# File 'lib/evergreen_holdings.rb', line 155 def copies @copies end |
permalink #libraries ⇒ Object (readonly)
Returns the value of attribute libraries.
155 156 157 |
# File 'lib/evergreen_holdings.rb', line 155 def libraries @libraries end |
Instance Method Details
permalink #any_copies_available? ⇒ Boolean
Determines if any copies are available for your patrons
168 169 170 171 172 173 174 |
# File 'lib/evergreen_holdings.rb', line 168 def any_copies_available? @copies.each do |copy| return true if copy.status.zero? return true if copy.status == 'Available' end false end |