Class: EvergreenHoldings::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/evergreen_holdings.rb

Overview

Status objects represent all the holdings attached to a specific tcn

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json_data, idl_order, connection = nil) ⇒ Status



160
161
162
163
164
165
166
167
168
# File 'lib/evergreen_holdings.rb', line 160

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

#copiesObject (readonly)

Returns the value of attribute copies.



159
160
161
# File 'lib/evergreen_holdings.rb', line 159

def copies
  @copies
end

#librariesObject (readonly)

Returns the value of attribute libraries.



159
160
161
# File 'lib/evergreen_holdings.rb', line 159

def libraries
  @libraries
end

Instance Method Details

#any_copies_available?Boolean

Determines if any copies are available for your patrons



171
172
173
174
175
176
177
# File 'lib/evergreen_holdings.rb', line 171

def any_copies_available?
  @copies.each do |copy|
    return true if copy.status.zero?
    return true if copy.status == 'Available'
  end
  false
end