Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add destroy method for Link #39

Merged
merged 1 commit into from
Feb 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
*.o
*.a
mkmf.log
.DS_Store
4 changes: 4 additions & 0 deletions lib/omise/link.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def reload(attributes = {})
assign_attributes resource(attributes).get(attributes)
end

def destroy(attributes = {})
assign_attributes resource(attributes).delete
end

def charges(options = {})
if options.empty?
list_attribute ChargeList, "charges"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"object": "link",
"id": "link_test_55pcclmznvrv9lc7r9s",
"livemode": false,
"deleted": true
}
7 changes: 7 additions & 0 deletions test/omise/test_link.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ def test_that_we_can_retrieve_a_link
assert_equal "link_test_55pcclmznvrv9lc7r9s", @link.id
end

def test_that_we_can_destroy_a_link
@link.destroy

assert @link.deleted
assert @link.destroyed?
end

def test_that_we_can_list_all_links
links = Omise::Link.list

Expand Down