Class: RenderRuby::Client
- Inherits:
-
Object
- Object
- RenderRuby::Client
- Defined in:
- lib/render_ruby/client.rb
Constant Summary collapse
- BASE_URL =
'https://api.render.com/v1'
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
- #connection ⇒ Object
- #custom_domains ⇒ Object
- #deploys ⇒ Object
-
#initialize(api_key:, adapter: Faraday.default_adapter, stubs: nil) ⇒ Client
constructor
A new instance of Client.
- #jobs ⇒ Object
- #owners ⇒ Object
- #services ⇒ Object
Constructor Details
#initialize(api_key:, adapter: Faraday.default_adapter, stubs: nil) ⇒ Client
Returns a new instance of Client.
9 10 11 12 13 14 15 |
# File 'lib/render_ruby/client.rb', line 9 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.
7 8 9 |
# File 'lib/render_ruby/client.rb', line 7 def adapter @adapter end |
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
7 8 9 |
# File 'lib/render_ruby/client.rb', line 7 def api_key @api_key end |
Instance Method Details
#connection ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/render_ruby/client.rb', line 37 def connection @connection ||= Faraday.new(BASE_URL) do |conn| conn.request :authorization, :Bearer, api_key conn.request :json conn.response :json, content_type: 'application/json' conn.adapter adapter, @stubs end end |
#custom_domains ⇒ Object
29 30 31 |
# File 'lib/render_ruby/client.rb', line 29 def custom_domains CustomDomainResource.new(self) end |
#deploys ⇒ Object
25 26 27 |
# File 'lib/render_ruby/client.rb', line 25 def deploys DeployResource.new(self) end |
#jobs ⇒ Object
33 34 35 |
# File 'lib/render_ruby/client.rb', line 33 def jobs JobResource.new(self) end |
#owners ⇒ Object
17 18 19 |
# File 'lib/render_ruby/client.rb', line 17 def owners OwnerResource.new(self) end |
#services ⇒ Object
21 22 23 |
# File 'lib/render_ruby/client.rb', line 21 def services ServiceResource.new(self) end |