Class: Zeit::API
- Inherits:
-
Object
- Object
- Zeit::API
- Defined in:
- lib/zeit/api.rb
Instance Method Summary collapse
- #author(opts = {}) ⇒ Object
- #client(opts = {}) ⇒ Object
- #connection ⇒ Object
- #content(opts = {}) ⇒ Object
- #department(opts = {}) ⇒ Object
-
#initialize(params = {}) ⇒ API
constructor
A new instance of API.
- #keyword(opts = {}) ⇒ Object
- #product(opts = {}) ⇒ Object
- #series(opts = {}) ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ API
Returns a new instance of API.
4 5 6 7 8 9 10 11 12 |
# File 'lib/zeit/api.rb', line 4 def initialize(params = {}) @api_key = params[:api_key] @debug = params[:debug] @base_url = params[:base_url] || 'http://api.zeit.de/' @faraday_adapter = params[:faraday_adapter] || Faraday.default_adapter @faraday = params[:faraday] || default_faraday raise ArgumentError, ':api_key missing' unless @api_key end |
Instance Method Details
#author(opts = {}) ⇒ Object
18 19 20 |
# File 'lib/zeit/api.rb', line 18 def (opts = {}) Zeit::Resources::Author.new(connection, opts) end |
#client(opts = {}) ⇒ Object
22 23 24 |
# File 'lib/zeit/api.rb', line 22 def client(opts = {}) Zeit::Resources::Client.new(connection, opts) end |
#connection ⇒ Object
14 15 16 |
# File 'lib/zeit/api.rb', line 14 def connection @faraday end |
#content(opts = {}) ⇒ Object
26 27 28 |
# File 'lib/zeit/api.rb', line 26 def content(opts = {}) Zeit::Resources::Content.new(connection, opts) end |
#department(opts = {}) ⇒ Object
30 31 32 |
# File 'lib/zeit/api.rb', line 30 def department(opts = {}) Zeit::Resources::Department.new(connection, opts) end |
#keyword(opts = {}) ⇒ Object
34 35 36 |
# File 'lib/zeit/api.rb', line 34 def keyword(opts = {}) Zeit::Resources::Keyword.new(connection, opts) end |
#product(opts = {}) ⇒ Object
38 39 40 |
# File 'lib/zeit/api.rb', line 38 def product(opts = {}) Zeit::Resources::Product.new(connection, opts) end |
#series(opts = {}) ⇒ Object
42 43 44 |
# File 'lib/zeit/api.rb', line 42 def series(opts = {}) Zeit::Resources::Series.new(connection, opts) end |