Class: DevRuby::Client
- Inherits:
-
Object
- Object
- DevRuby::Client
- Defined in:
- lib/dev_ruby/client.rb
Constant Summary collapse
- BASE_URL =
'https://dev.to/api'- API_KEY =
'api-key'
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
Instance Method Summary collapse
- #articles ⇒ Object
- #connection ⇒ Object
-
#initialize(api_key:, adapter: Faraday.default_adapter, stubs: nil) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(api_key:, adapter: Faraday.default_adapter, stubs: nil) ⇒ Client
Returns a new instance of Client.
10 11 12 13 14 15 16 |
# File 'lib/dev_ruby/client.rb', line 10 def initialize(api_key:, adapter: Faraday.default_adapter, stubs: nil) @api_key = api_key @adapter = adapter # Test stubs for requests @stubs = stubs end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
8 9 10 |
# File 'lib/dev_ruby/client.rb', line 8 def adapter @adapter end |
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
8 9 10 |
# File 'lib/dev_ruby/client.rb', line 8 def api_key @api_key end |
Instance Method Details
#articles ⇒ Object
18 19 20 |
# File 'lib/dev_ruby/client.rb', line 18 def articles DevRuby::Resources::ArticlesResource.new(self) end |