Class: EvergreenHoldings::Status
- Inherits:
-
Object
- Object
- EvergreenHoldings::Status
- Defined in:
- lib/evergreen_holdings.rb
Instance Attribute Summary collapse
-
#copies ⇒ Object
readonly
Returns the value of attribute copies.
Instance Method Summary collapse
-
#any_copies_available? ⇒ Boolean
Determines if any copies are available for your patrons.
-
#initialize(json_data, connection = nil) ⇒ Status
constructor
A new instance of Status.
Constructor Details
#initialize(json_data, connection = nil) ⇒ Status
Returns a new instance of Status.
75 76 77 78 79 80 81 82 |
# File 'lib/evergreen_holdings.rb', line 75 def initialize json_data, connection = nil @connection = connection @raw_data = JSON.parse(json_data)['payload'][0] @copies = extract_copies substitute_values_for_ids unless @connection.nil? @available_copies = [] @next_copy_available = 'a date' end |
Instance Attribute Details
#copies ⇒ Object (readonly)
Returns the value of attribute copies.
74 75 76 |
# File 'lib/evergreen_holdings.rb', line 74 def copies @copies end |
Instance Method Details
#any_copies_available? ⇒ Boolean
Determines if any copies are available for your patrons
85 86 87 88 89 90 |
# File 'lib/evergreen_holdings.rb', line 85 def any_copies_available? @copies.each do |copy| return true if 0 == copy.status return true if 'Available' == copy.status end end |