Class: Finnhub::Webhook
- Inherits:
-
Object
- Object
- Finnhub::Webhook
- Defined in:
- lib/Webhook.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #create(body:) ⇒ Object
- #delete ⇒ Object
-
#initialize(client:, id: nil, hash: nil) ⇒ Webhook
constructor
A new instance of Webhook.
Constructor Details
#initialize(client:, id: nil, hash: nil) ⇒ Webhook
3 4 5 6 7 |
# File 'lib/Webhook.rb', line 3 def initialize(client:, id: nil, hash: nil) @client = client @id = id @hash = hash end |
Instance Attribute Details
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
9 10 11 |
# File 'lib/Webhook.rb', line 9 def hash @hash end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
9 10 11 |
# File 'lib/Webhook.rb', line 9 def id @id end |
Instance Method Details
#create(body:) ⇒ Object
11 12 13 14 15 |
# File 'lib/Webhook.rb', line 11 def create(body:) response = @client.request("/webhook/add", method: :post, body: body) @id = response[:id] response end |
#delete ⇒ Object
17 18 19 20 21 |
# File 'lib/Webhook.rb', line 17 def delete response = @client.request("/webhook/delete", method: :post, body: {id: @id}) @id = nil response end |