Class: Paspartout
- Inherits:
-
Object
- Object
- Paspartout
- Defined in:
- lib/paspartout-api.rb
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(api_key) ⇒ Paspartout
constructor
A new instance of Paspartout.
- #loaded? ⇒ Boolean
- #page(id) ⇒ Object
- #pages ⇒ Object
- #site ⇒ Object
Constructor Details
#initialize(api_key) ⇒ Paspartout
Returns a new instance of Paspartout.
6 7 8 9 |
# File 'lib/paspartout-api.rb', line 6 def initialize api_key @api_key = api_key @loaded = {} end |
Instance Method Details
#errors ⇒ Object
11 12 13 |
# File 'lib/paspartout-api.rb', line 11 def errors @errors end |
#loaded? ⇒ Boolean
15 16 17 |
# File 'lib/paspartout-api.rb', line 15 def loaded? @errors.empty? end |
#page(id) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/paspartout-api.rb', line 35 def page id return @loaded[:"page_#{ id }"] if @loaded[:"page_#{ id }"] if result = get("/pages/#{ id }") @loaded[:"page_#{ id }"] = result end end |
#pages ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/paspartout-api.rb', line 27 def pages return @loaded[:pages] if @loaded[:pages] if result = get('/pages') @loaded[:pages] = result end end |
#site ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/paspartout-api.rb', line 19 def site return @loaded[:site] if @loaded[:site] if result = get @loaded[:site] = result end end |