Class: Layer::Webhooks::Client
- Inherits:
-
BaseClient
- Object
- BaseClient
- Layer::Webhooks::Client
- Defined in:
- lib/layer/webhooks/client.rb
Constant Summary
Constants inherited from BaseClient
Instance Attribute Summary collapse
-
#api_token ⇒ Object
Returns the value of attribute api_token.
-
#app_id ⇒ Object
Returns the value of attribute app_id.
Instance Method Summary collapse
- #base_url ⇒ Object
- #default_headers ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #inspect ⇒ Object (also: #to_s)
- #webhooks ⇒ Object
Methods inherited from BaseClient
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
6 7 8 9 10 |
# File 'lib/layer/webhooks/client.rb', line 6 def initialize( = {}) id = [:app_id] || ENV['LAYER_APP_ID'] @api_token = [:api_token] || ENV['LAYER_API_TOKEN'] @app_id = strip_layer_prefix(id) end |
Instance Attribute Details
#api_token ⇒ Object
Returns the value of attribute api_token.
4 5 6 |
# File 'lib/layer/webhooks/client.rb', line 4 def api_token @api_token end |
#app_id ⇒ Object
Returns the value of attribute app_id.
4 5 6 |
# File 'lib/layer/webhooks/client.rb', line 4 def app_id @app_id end |
Instance Method Details
#base_url ⇒ Object
25 26 27 |
# File 'lib/layer/webhooks/client.rb', line 25 def base_url "#{DEFAULT_HOST}/apps/#{app_id}" end |
#default_headers ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/layer/webhooks/client.rb', line 16 def default_headers super.merge( { "Authorization" => "Bearer #{api_token}", "Accept" => "application/vnd.layer.webhooks+json; version=1.0" } ) end |
#inspect ⇒ Object Also known as: to_s
29 30 31 |
# File 'lib/layer/webhooks/client.rb', line 29 def inspect "#<#{self.class} api_token=\"#{@api_token}\" app_id=\"#{@app_id}\">" end |