Class: Spaceship::ConnectAPI::Webhook
- Inherits:
-
Object
- Object
- Spaceship::ConnectAPI::Webhook
- Includes:
- Model
- Defined in:
- spaceship/lib/spaceship/connect_api/models/webhook.rb
Defined Under Namespace
Modules: EventType
Instance Attribute Summary collapse
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#event_types ⇒ Object
Returns the value of attribute event_types.
-
#name ⇒ Object
Returns the value of attribute name.
-
#url ⇒ Object
Returns the value of attribute url.
Attributes included from Model
Class Method Summary collapse
-
.all(client: nil, app_id:, filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object
API.
- .create(client: nil, app_id:, enabled: true, event_types:, name:, secret:, url:) ⇒ Object
- .type ⇒ Object
Instance Method Summary collapse
Methods included from Model
#attr_mapping, included, #initialize, #reverse_attr_mapping, #to_json, #update_attributes
Instance Attribute Details
#enabled ⇒ Object
Returns the value of attribute enabled.
8 9 10 |
# File 'spaceship/lib/spaceship/connect_api/models/webhook.rb', line 8 def enabled @enabled end |
#event_types ⇒ Object
Returns the value of attribute event_types.
9 10 11 |
# File 'spaceship/lib/spaceship/connect_api/models/webhook.rb', line 9 def event_types @event_types end |
#name ⇒ Object
Returns the value of attribute name.
10 11 12 |
# File 'spaceship/lib/spaceship/connect_api/models/webhook.rb', line 10 def name @name end |
#url ⇒ Object
Returns the value of attribute url.
11 12 13 |
# File 'spaceship/lib/spaceship/connect_api/models/webhook.rb', line 11 def url @url end |
Class Method Details
.all(client: nil, app_id:, filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object
API
44 45 46 47 48 |
# File 'spaceship/lib/spaceship/connect_api/models/webhook.rb', line 44 def self.all(client: nil, app_id:, filter: {}, includes: nil, limit: nil, sort: nil) client ||= Spaceship::ConnectAPI resps = client.get_webhooks(app_id: app_id, filter: filter, includes: includes, limit: limit, sort: sort).all_pages return resps.flat_map(&:to_models) end |
.create(client: nil, app_id:, enabled: true, event_types:, name:, secret:, url:) ⇒ Object
50 51 52 53 54 |
# File 'spaceship/lib/spaceship/connect_api/models/webhook.rb', line 50 def self.create(client: nil, app_id:, enabled: true, event_types:, name:, secret:, url:) client ||= Spaceship::ConnectAPI resp = client.post_webhook(app_id: app_id, enabled: enabled, event_types: event_types, name: name, secret: secret, url: url) return resp.to_models.first end |
.type ⇒ Object
36 37 38 |
# File 'spaceship/lib/spaceship/connect_api/models/webhook.rb', line 36 def self.type return "webhooks" end |
Instance Method Details
#delete!(client: nil) ⇒ Object
56 57 58 59 |
# File 'spaceship/lib/spaceship/connect_api/models/webhook.rb', line 56 def delete!(client: nil) client ||= Spaceship::ConnectAPI return client.delete_webhook(webhook_id: id) end |