Class: GBIP::Title
- Inherits:
-
Object
- Object
- GBIP::Title
- Defined in:
- lib/gbip/title.rb
Overview
models a warehouse supply detail from the Global Books in Print API
Instance Attribute Summary collapse
-
#bic_subject ⇒ Object
Returns the value of attribute bic_subject.
-
#binding ⇒ Object
Returns the value of attribute binding.
-
#bisac_subject ⇒ Object
Returns the value of attribute bisac_subject.
-
#bowker_subject ⇒ Object
Returns the value of attribute bowker_subject.
-
#child_subject ⇒ Object
Returns the value of attribute child_subject.
-
#contributor ⇒ Object
Returns the value of attribute contributor.
-
#country ⇒ Object
Returns the value of attribute country.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#edition ⇒ Object
Returns the value of attribute edition.
-
#isbn ⇒ Object
Returns the value of attribute isbn.
-
#market ⇒ Object
Returns the value of attribute market.
-
#pubcode ⇒ Object
Returns the value of attribute pubcode.
-
#publication_date ⇒ Object
Returns the value of attribute publication_date.
-
#publisher ⇒ Object
Returns the value of attribute publisher.
-
#rrp ⇒ Object
Returns the value of attribute rrp.
-
#status ⇒ Object
Returns the value of attribute status.
-
#supplier ⇒ Object
Returns the value of attribute supplier.
-
#suppliers_with_stock ⇒ Object
Returns the value of attribute suppliers_with_stock.
-
#title ⇒ Object
Returns the value of attribute title.
-
#warehouses ⇒ Object
Returns the value of attribute warehouses.
Instance Method Summary collapse
-
#initialize(arr) ⇒ Title
constructor
A new instance of Title.
- #to_yaml ⇒ Object
Constructor Details
#initialize(arr) ⇒ Title
Returns a new instance of Title.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/gbip/title.rb', line 17 def initialize(arr) raise ArgumentError, "arr must be an array" unless arr.class == Array #raise ArgumentError, "Invalid number of array elements" unless arr.size == 14 self.market = arr[2].strip self.title = arr[3].strip self.isbn = RBook::ISBN.convert_to_isbn13(arr[4].strip) || arr[4].strip self.binding = arr[5].strip self.status = arr[6].strip self.edition = arr[7].strip self.contributor = arr[8].strip self.publisher = arr[9].strip self.publication_date = arr[10].strip self.rrp = BigDecimal.new(arr[11].strip) self.country = arr[12].strip self.pubcode = arr[13].strip self.currency = arr[14].strip self.bowker_subject = arr[15].strip self.bisac_subject = arr[16].strip self.child_subject = arr[17].strip self.bic_subject = arr[18].strip self.supplier = arr[19].strip self.suppliers_with_stock = arr[20].strip @warehouses = [] end |
Instance Attribute Details
#bic_subject ⇒ Object
Returns the value of attribute bic_subject.
14 15 16 |
# File 'lib/gbip/title.rb', line 14 def bic_subject @bic_subject end |
#binding ⇒ Object
Returns the value of attribute binding.
10 11 12 |
# File 'lib/gbip/title.rb', line 10 def binding @binding end |
#bisac_subject ⇒ Object
Returns the value of attribute bisac_subject.
14 15 16 |
# File 'lib/gbip/title.rb', line 14 def bisac_subject @bisac_subject end |
#bowker_subject ⇒ Object
Returns the value of attribute bowker_subject.
13 14 15 |
# File 'lib/gbip/title.rb', line 13 def bowker_subject @bowker_subject end |
#child_subject ⇒ Object
Returns the value of attribute child_subject.
14 15 16 |
# File 'lib/gbip/title.rb', line 14 def child_subject @child_subject end |
#contributor ⇒ Object
Returns the value of attribute contributor.
11 12 13 |
# File 'lib/gbip/title.rb', line 11 def contributor @contributor end |
#country ⇒ Object
Returns the value of attribute country.
13 14 15 |
# File 'lib/gbip/title.rb', line 13 def country @country end |
#currency ⇒ Object
Returns the value of attribute currency.
13 14 15 |
# File 'lib/gbip/title.rb', line 13 def currency @currency end |
#edition ⇒ Object
Returns the value of attribute edition.
10 11 12 |
# File 'lib/gbip/title.rb', line 10 def edition @edition end |
#isbn ⇒ Object
Returns the value of attribute isbn.
10 11 12 |
# File 'lib/gbip/title.rb', line 10 def isbn @isbn end |
#market ⇒ Object
Returns the value of attribute market.
10 11 12 |
# File 'lib/gbip/title.rb', line 10 def market @market end |
#pubcode ⇒ Object
Returns the value of attribute pubcode.
13 14 15 |
# File 'lib/gbip/title.rb', line 13 def pubcode @pubcode end |
#publication_date ⇒ Object
Returns the value of attribute publication_date.
11 12 13 |
# File 'lib/gbip/title.rb', line 11 def publication_date @publication_date end |
#publisher ⇒ Object
Returns the value of attribute publisher.
11 12 13 |
# File 'lib/gbip/title.rb', line 11 def publisher @publisher end |
#rrp ⇒ Object
Returns the value of attribute rrp.
12 13 14 |
# File 'lib/gbip/title.rb', line 12 def rrp @rrp end |
#status ⇒ Object
Returns the value of attribute status.
10 11 12 |
# File 'lib/gbip/title.rb', line 10 def status @status end |
#supplier ⇒ Object
Returns the value of attribute supplier.
12 13 14 |
# File 'lib/gbip/title.rb', line 12 def supplier @supplier end |
#suppliers_with_stock ⇒ Object
Returns the value of attribute suppliers_with_stock.
12 13 14 |
# File 'lib/gbip/title.rb', line 12 def suppliers_with_stock @suppliers_with_stock end |
#title ⇒ Object
Returns the value of attribute title.
10 11 12 |
# File 'lib/gbip/title.rb', line 10 def title @title end |
#warehouses ⇒ Object
Returns the value of attribute warehouses.
15 16 17 |
# File 'lib/gbip/title.rb', line 15 def warehouses @warehouses end |
Instance Method Details
#to_yaml ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/gbip/title.rb', line 44 def to_yaml YAML.dump(:status => self.status, :pubdate => self.publication_date, :binding => self.binding, :publisher => self.publisher, :contributor => self.contributor, :isbn => self.isbn, :edition => self.edition, :market => self.market, :rrp => self.rrp.to_s("F"), :title => self.title, :country => self.country, :pubcode => self.pubcode, :currency => self.currency, :bowker_subject => self.bowker_subject, :bisac_subject => self.bisac_subject, :child_subject => self.child_subject, :bic_subject => self.bic_subject, :supplier => self.supplier, :suppliers_with_stock => self.suppliers_with_stock ) end |