Module: MangoApi::Hooks
- Extended by:
- UriProvider
- Defined in:
- lib/mangopay/api/service/hooks.rb
Overview
Provides API method delegates concerning the Hook
entity
Class Method Summary collapse
-
.all ⇒ Array
Retrieves all hooks.
-
.create(hook, id_key = nil) ⇒ Hook
Creates a new hook entity.
-
.get(id) ⇒ Hook
Retrieves a hook entity.
-
.update(hook) ⇒ Hook
Updates the hook entity identifiable by the provided Hook object’s ID.
Methods included from UriProvider
Class Method Details
.all ⇒ Array
Retrieves all hooks.
Allowed FilterRequest
params:
-
page
-
per_page
-
sort_field and sort_direction
64 65 66 67 68 |
# File 'lib/mangopay/api/service/hooks.rb', line 64 def all uri = provide_uri(:get_hooks) results = HttpClient.get(uri) parse_results results end |
.create(hook, id_key = nil) ⇒ Hook
Creates a new hook entity.
Hook
properties:
-
Required
-
event_type
-
url
-
-
Optional
-
tag
-
23 24 25 26 27 |
# File 'lib/mangopay/api/service/hooks.rb', line 23 def create(hook, id_key = nil) uri = provide_uri(:create_hook) response = HttpClient.post(uri, hook, id_key) parse response end |
.get(id) ⇒ Hook
Retrieves a hook entity.
50 51 52 53 54 |
# File 'lib/mangopay/api/service/hooks.rb', line 50 def get(id) uri = provide_uri(:get_hook, id) response = HttpClient.get(uri) parse response end |
.update(hook) ⇒ Hook
Updates the hook entity identifiable by the provided Hook object’s ID.
Hook
optional properties:
-
tag
-
status
-
url
and updated data
40 41 42 43 44 |
# File 'lib/mangopay/api/service/hooks.rb', line 40 def update(hook) uri = provide_uri(:update_hook, hook.id) response = HttpClient.put(uri, hook) parse response end |