Class: LeanpubAPI::Base
- Inherits:
-
Object
show all
- Includes:
- HTTParty
- Defined in:
- lib/leanpub_api/base.rb
Instance Method Summary
collapse
Constructor Details
#initialize(book_slug, api_key) ⇒ Base
6
7
8
9
|
# File 'lib/leanpub_api/base.rb', line 6
def initialize(book_slug, api_key)
@book_slug = book_slug
@api_key = api_key
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
15
16
17
|
# File 'lib/leanpub_api/base.rb', line 15
def method_missing(name, *args, &block)
info.has_key?(name.to_s) ? info[name.to_s] : super
end
|
Instance Method Details
#info(force = false) ⇒ Object
11
12
13
|
# File 'lib/leanpub_api/base.rb', line 11
def info(force = false)
force ? @info = get_info : @info ||= get_info
end
|