Class: Hurriyet::Service::Base
- Inherits:
-
Object
- Object
- Hurriyet::Service::Base
- Defined in:
- lib/hurriyet/service/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
- #execute(endpoint) ⇒ Object
-
#initialize(client) ⇒ Base
constructor
A new instance of Base.
- #version ⇒ Object
Constructor Details
#initialize(client) ⇒ Base
Returns a new instance of Base.
7 8 9 10 |
# File 'lib/hurriyet/service/base.rb', line 7 def initialize(client) @client = client @conn = Faraday.new(url: 'https://api.hurriyet.com.tr', headers: { apikey: @client.apikey }) end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
5 6 7 |
# File 'lib/hurriyet/service/base.rb', line 5 def client @client end |
Instance Method Details
#execute(endpoint) ⇒ Object
12 13 14 15 16 |
# File 'lib/hurriyet/service/base.rb', line 12 def execute(endpoint) p @conn p "/#{version}/#{endpoint}" @conn.get("/#{version}/#{endpoint}").body end |
#version ⇒ Object
18 19 20 |
# File 'lib/hurriyet/service/base.rb', line 18 def version 'v1' end |