Class: Strava::Webhooks::Client
- Inherits:
-
Strava::Web::Client
- Object
- Strava::Web::Client
- Strava::Webhooks::Client
- Defined in:
- lib/strava/webhooks/client.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#create_push_subscription(options = {}) ⇒ Object
Create a subscription.
-
#delete_push_subscription(id_or_options, options = {}) ⇒ Object
Delete an existing push subscription.
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
-
#push_subscriptions(options = {}) ⇒ Object
Get existing push subscriptions.
- #request(method, path, options) ⇒ Object
Methods inherited from Strava::Web::Client
Methods included from Strava::Web::Request
Constructor Details
Class Method Details
.config ⇒ Object
54 55 56 |
# File 'lib/strava/webhooks/client.rb', line 54 def config Config end |
Instance Method Details
#create_push_subscription(options = {}) ⇒ Object
Create a subscription.
45 46 47 |
# File 'lib/strava/webhooks/client.rb', line 45 def create_push_subscription( = {}) Strava::Webhooks::Models::Subscription.new(post('push_subscriptions', )) end |
#delete_push_subscription(id_or_options, options = {}) ⇒ Object
Delete an existing push subscription.
31 32 33 34 35 |
# File 'lib/strava/webhooks/client.rb', line 31 def delete_push_subscription(, = {}) id, = parse_args(, ) delete("push_subscriptions/#{id}", ) nil end |
#push_subscriptions(options = {}) ⇒ Object
Get existing push subscriptions.
22 23 24 25 26 |
# File 'lib/strava/webhooks/client.rb', line 22 def push_subscriptions( = {}) get('push_subscriptions', ).map do |row| Strava::Webhooks::Models::Subscription.new(row) end end |
#request(method, path, options) ⇒ Object
15 16 17 |
# File 'lib/strava/webhooks/client.rb', line 15 def request(method, path, ) super(method, path, { client_id: client_id, client_secret: client_secret }.merge()) end |