module SmartHR::Client::WebhookMethods

Public Instance Methods

create_webhook(body:, &block) click to toggle source

Create a new webhook

@see developer.smarthr.jp/api/index.html#!/Webhook/postV1Webhooks

@param body [Hash]

@yield [response_body, response_header] if block was given, return response body and response header through block arguments @yieldparam response_body [Hashie::Mash] response body @yieldparam response_header [Hash<String, String>] response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)

@return [Hashie::Mash]

# File lib/smarthr/client/webhook_methods.rb, line 77
def create_webhook(body:, &block)
  post("/webhooks", body, &block)
end
destroy_webhook(id:, &block) click to toggle source

Delete the webhook

@see developer.smarthr.jp/api/index.html#!/Webhook/deleteV1WebhooksId

@param id [String]

@yield [response_body, response_header] if block was given, return response body and response header through block arguments @yieldparam response_body [Hashie::Mash] response body @yieldparam response_header [Hash<String, String>] response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)

# File lib/smarthr/client/webhook_methods.rb, line 11
def destroy_webhook(id:, &block)
  delete("/webhooks/#{id}", &block)
end
find_webhook(id:, &block) click to toggle source

Get the webhook

@see developer.smarthr.jp/api/index.html#!/Webhook/getV1WebhooksId

@param id [String]

@yield [response_body, response_header] if block was given, return response body and response header through block arguments @yieldparam response_body [Hashie::Mash] response body @yieldparam response_header [Hash<String, String>] response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)

@return [Hashie::Mash]

# File lib/smarthr/client/webhook_methods.rb, line 26
def find_webhook(id:, &block)
  get("/webhooks/#{id}", &block)
end
get_webhooks(page: 1, per_page: 10, &block) click to toggle source

Get the list of webhooks

@see developer.smarthr.jp/api/index.html#!/Webhook/getV1Webhooks

@param page [Integer] @param per_page [Integer]

@yield [response_body, response_header] if block was given, return response body and response header through block arguments @yieldparam response_body [Array<Hashie::Mash>] response body @yieldparam response_header [Hash<String, String>] response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)

@return [Array<Hashie::Mash>]

# File lib/smarthr/client/webhook_methods.rb, line 58
def get_webhooks(page: 1, per_page: 10, &block)
  get("/webhooks",
    page: page,
    per_page: per_page,
    &block
  )
end
update_webhook(id:, body:, &block) click to toggle source

Change the data of the specified webhook

@see developer.smarthr.jp/api/index.html#!/Webhook/patchV1WebhooksId

@param id [String] @param body [Hash]

@yield [response_body, response_header] if block was given, return response body and response header through block arguments @yieldparam response_body [Hashie::Mash] response body @yieldparam response_header [Hash<String, String>] response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)

@return [Hashie::Mash]

# File lib/smarthr/client/webhook_methods.rb, line 42
def update_webhook(id:, body:, &block)
  patch("/webhooks/#{id}", body, &block)
end