class Strava::Webhooks::Client

Public Class Methods

config() click to toggle source
# File lib/strava/webhooks/client.rb, line 52
def config
  Config
end
configure() { |Config| ... } click to toggle source
# File lib/strava/webhooks/client.rb, line 48
def configure
  block_given? ? yield(Config) : Config
end
new(options = {}) click to toggle source
Calls superclass method Strava::Web::Client::new
# File lib/strava/webhooks/client.rb, line 6
def initialize(options = {})
  Strava::Webhooks::Config::ATTRIBUTES.each do |key|
    send("#{key}=", options[key] || Strava::Webhooks.config.send(key))
  end
  super
end

Public Instance Methods

create_push_subscription(options = {}) click to toggle source

Create a subscription.

@option options [String] :callback_url

Address where webhook events will be sent.

@option options [String] :verify_token

String chosen by the application owner for client security. An identical string should be returned by Strava's subscription service.
# File lib/strava/webhooks/client.rb, line 43
def create_push_subscription(options = {})
  Strava::Webhooks::Models::Subscription.new(post('push_subscriptions', options))
end
delete_push_subscription(id_or_options, options = {}) click to toggle source

Delete an existing push subscription.

# File lib/strava/webhooks/client.rb, line 29
def delete_push_subscription(id_or_options, options = {})
  id, options = parse_args(id_or_options, options)
  delete("push_subscriptions/#{id}", options)
  nil
end
push_subscriptions(options = {}) click to toggle source

Get existing push subscriptions.

# File lib/strava/webhooks/client.rb, line 20
def push_subscriptions(options = {})
  get('push_subscriptions', options).map do |row|
    Strava::Webhooks::Models::Subscription.new(row)
  end
end
request(method, path, options) click to toggle source
Calls superclass method Strava::Web::Request#request
# File lib/strava/webhooks/client.rb, line 13
def request(method, path, options)
  super method, path, { client_id: client_id, client_secret: client_secret }.merge(options)
end