Class: Pin::WebhookEndpoints

Inherits:
Base
  • Object
show all
Defined in:
lib/pin_up/webhook_endpoints.rb

Overview

This class models Pin’s WebhookEndpoints API

Instance Attribute Summary

Attributes inherited from Base

#key

Class Method Summary collapse

Methods inherited from Base

#base_uri, build_collection_response, build_response, #initialize, make_request

Constructor Details

This class inherits a constructor from Pin::Base

Class Method Details

.all(page = nil, pagination = false) ⇒ Object

Lists all webhook endpoints for your account args: page (Fixnum), pagination (Boolean) returns: a collection of webhook endpoint objects

if pagination is passed, access the response hash with [:response] and the pagination hash with [:pagination]

pinpayments.com/docs/api/webhook_endpoints#get-webhook_endpoints



14
15
16
# File 'lib/pin_up/webhook_endpoints.rb', line 14

def self.all(page = nil, pagination = false)
  build_collection_response(make_request(:get, {url: "webhook_endpoints?page=#{page}" } ), pagination)
end

.create(options) ⇒ Object

creates a webhook endpoint given a hash of options pinpayments.com/docs/api/webhook_endpoints args: url (Hash) returns: webhook object



23
24
25
# File 'lib/pin_up/webhook_endpoints.rb', line 23

def self.create(options)
  build_response(make_request(:post, { url: 'webhook_endpoints', options: options }))
end

.delete(token) ⇒ Object

Delete a webhook endpoint for your account given a token args: token (String) returns: nil pinpayments.com/docs/api/webhook_endpoints#delete-webhook_endpoints



41
42
43
# File 'lib/pin_up/webhook_endpoints.rb', line 41

def self.delete(token)
  build_response(make_request(:delete, {url: "webhook_endpoints/#{token}" } ))
end

.find(token) ⇒ Object

Find a webhook endpoint for your account given a token args: token (String) returns: a webhook endpoint object pinpayments.com/docs/api/webhook_endpoints#get-webhook_endpoints



32
33
34
# File 'lib/pin_up/webhook_endpoints.rb', line 32

def self.find(token)
  build_response(make_request(:get, {url: "webhook_endpoints/#{token}" } ))
end