-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hooks and Notifications: New object to allow management of URL notifications - new payment methods allowing the management of Hook projects with different EventType - documentation: http://docs.mangopay.com/api-references/notifications
- Loading branch information
Sergiusz Woźnicki
committed
Mar 5, 2014
1 parent
55952b1
commit 87f77b2
Showing
4 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module MangoPay | ||
class Hook < Resource | ||
include MangoPay::HTTPCalls::Create | ||
include MangoPay::HTTPCalls::Update | ||
include MangoPay::HTTPCalls::Fetch | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
require_relative '../../spec_helper' | ||
|
||
describe MangoPay::Hook do | ||
include_context 'hooks' | ||
|
||
describe 'CREATE' do | ||
it 'creates a hook' do | ||
expect(new_hook['Id']).to_not be_nil | ||
end | ||
end | ||
|
||
describe 'UPDATE' do | ||
it 'updates a hook' do | ||
new_url = new_hook['Url'] + '.com' | ||
updated_hook = MangoPay::Hook.update(new_hook['Id'], { | ||
Url: new_url, | ||
Tag: 'Updated Tag' | ||
}) | ||
expect(updated_hook['Url']).to eq(new_url) | ||
expect(updated_hook['Tag']).to eq('Updated Tag') | ||
end | ||
end | ||
|
||
describe 'FETCH' do | ||
|
||
it 'fetches a hook' do | ||
hook = MangoPay::Hook.fetch(new_hook['Id']) | ||
expect(hook['Id']).to eq(new_hook['Id']) | ||
end | ||
|
||
it 'fetches all the hooks' do | ||
hooks = MangoPay::Hook.fetch() | ||
expect(hooks).to be_kind_of(Array) | ||
expect(hooks).not_to be_empty | ||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters