diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..227b25e --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.moarvm +*.swp +lib/.precomp/ +.precomp/ diff --git a/README.md b/README.md index c8036a2..817b5a6 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,13 @@ The idea is to make this module as simple to use as possible. ###`.new` The `.new` method will require an 'incoming webhook' integration link from Slack, this way it knows where to connect and has the correct authentication to do so. One of these links will be given after setting up an integration using [this link](https://my.slack.com/services/new/incoming-webhook/ "New Slack incoming webhook"). If the url is not given an exception will be thrown. The syntax for this will look like this: ``` -my $slack = WebService::Slack::webhook.new($url); +#String containing the URL. +my $slack = WebService::Slack::webhook.new(url => "$url"); + +#Or... + +#Path to a file with the URL. +my $slack = WebService::Slack::webhook.new(path => "/path/to/file"); ``` ###`.send` diff --git a/t/02-make.t b/t/02-make.t new file mode 100755 index 0000000..d5dc61e --- /dev/null +++ b/t/02-make.t @@ -0,0 +1,29 @@ +#!/usr/bin/env perl6 + +use Test; +use lib 'lib'; + +use WebService::Slack::webhook; + +#Make some vars +my $fake-url = "https://host.slack.com/example"; +my $file-name = ".slackurl"; + +#Make a bad object. +dies-ok {WebService::Slack::webhook.new()}, + 'Bad object fails correctly'; + +#Make a good object with a url. +isa-ok WebService::Slack::webhook.new(url => "$fake-url"), + 'WebService::Slack::webhook', + 'Good object can be made with url'; + +#Make a good object with a path. +"$file-name".IO.spurt($fake-url); #Make the file. +isa-ok WebService::Slack::webhook.new(path => "$file-name"), + 'WebService::Slack::webhook', + 'Good object can be made with path'; +"$file-name".IO.unlink; #Remove the file. + + +done-testing; diff --git a/t/02-send.t b/t/02-send.t deleted file mode 100755 index 4f06d52..0000000 --- a/t/02-send.t +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env perl6 - -use Test; -use lib 'lib'; - -use WebService::Slack::webhook; - -#Make a bad object. -dies-ok {WebService::Slack::webhook.new()}, - 'Bad object fails correctly'; - -#Make a good object. -my $slack = WebService::Slack::webhook.new("https://host.slack.com/example"); -isa-ok $slack, - 'WebService::Slack::webhook', - 'Good object can be made'; - -done-testing;