Class: Saber::Book
- Inherits:
-
Object
- Object
- Saber::Book
- Defined in:
- lib/saber/book.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Class Method Summary collapse
-
.populate(*args) ⇒ Object
delegate to #populate.
Instance Method Summary collapse
-
#initialize ⇒ Book
constructor
A new instance of Book.
-
#populate(isbn, filename) ⇒ Hash
Data.
Constructor Details
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
11 12 13 |
# File 'lib/saber/book.rb', line 11 def client @client end |
Class Method Details
.populate(*args) ⇒ Object
delegate to #populate
7 8 9 |
# File 'lib/saber/book.rb', line 7 def self.populate(*args) new.populate(*args) end |
Instance Method Details
#populate(isbn, filename) ⇒ Hash
Returns data.
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/saber/book.rb', line 23 def populate(isbn, filename) params = {} rep = client.get("/books/#{isbn}", params) data = rep.body if data["status"] == 0 data["tracker"] else Saber.ui.error "Can't populate book -- #{isbn} #{filename}." {} end end |