Class: Openpix::RubySdk::Resources::Webhook

Inherits:
Resource
  • Object
show all
Defined in:
lib/openpix/ruby_sdk/resources/webhook.rb

Overview

Make API operations on Webhook resource

Constant Summary collapse

ATTRS =
%w[
  name
  event
  url
  authorization
  isActive
].freeze

Instance Method Summary collapse

Methods inherited from Resource

#destroy, #destroy!, #fetch, #fetch!, #fetch_next_page!, #fetch_previous_page!, #initialize, #save, #save!, #to_collection_resource, #to_single_resource

Constructor Details

This class inherits a constructor from Openpix::RubySdk::Resources::Resource

Instance Method Details

#create_attributesObject



26
27
28
# File 'lib/openpix/ruby_sdk/resources/webhook.rb', line 26

def create_attributes
  ATTRS
end

#find(id:, extra_headers: {}) ⇒ Object

rubocop:disable Lint/UnusedMethodArgument



41
42
43
44
45
46
# File 'lib/openpix/ruby_sdk/resources/webhook.rb', line 41

def find(id:, extra_headers: {})
  raise(
    ActionNotImplementedError,
    'webhook does not implement GET show action'
  )
end

#find!(id:, extra_headers: {}) ⇒ Object



48
49
50
51
52
53
# File 'lib/openpix/ruby_sdk/resources/webhook.rb', line 48

def find!(id:, extra_headers: {})
  raise(
    ActionNotImplementedError,
    'webhook does not implement GET show action'
  )
end

#init_body(params: {}, rest: {}) ⇒ Object

Parameters:

  • params (Hash{String => String, Number, Hash{String, Number}, Array<Hash{String, String}>}) (defaults to: {})

    the attributes for creating a Charge

  • rest (Hash) (defaults to: {})

    more attributes to be merged at the body, use this only for unsupported fields



22
23
24
# File 'lib/openpix/ruby_sdk/resources/webhook.rb', line 22

def init_body(params: {}, rest: {})
  super(base_attrs: ATTRS, params: params, rest: rest)
end

#to_bodyObject



34
35
36
37
38
# File 'lib/openpix/ruby_sdk/resources/webhook.rb', line 34

def to_body
  body = super

  { webhook: body }
end

#to_urlObject



30
31
32
# File 'lib/openpix/ruby_sdk/resources/webhook.rb', line 30

def to_url
  'webhook'
end