-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from hahwul/dev
Release v0.7.3
- Loading branch information
Showing
5 changed files
with
48 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name: noir | ||
version: 0.7.2 | ||
version: 0.7.3 | ||
|
||
authors: | ||
- hahwul <[email protected]> | ||
|
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,10 @@ | ||
require "../../../../src/models/delivers/zap.cr" | ||
require "../../../../src/options.cr" | ||
|
||
describe "Initialize" do | ||
zap = ZAP.new "http://localhost:8090" | ||
|
||
it "init" do | ||
zap.nil?.should eq(false) | ||
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
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,26 @@ | ||
class ZAP | ||
@endpoint : String | ||
@apikey : String | ||
|
||
API_ACCESS = "/JSON/core/action/accessUrl" | ||
|
||
def initialize(@endpoint) | ||
if ENV.keys.includes? "ZAP_API_KEY" | ||
@apikey = ENV["ZAP_API_KEY"].to_s | ||
else | ||
@apikey = "" | ||
end | ||
end | ||
|
||
def add_url(url : String) | ||
call(@endpoint + API_ACCESS + "?url=#{url}") | ||
end | ||
|
||
def call(query : String) | ||
if @apikey == "" | ||
HTTP::Client.get(query) | ||
else | ||
HTTP::Client.get(query, headers: {"X-ZAP-API-Key" => @apikey}) | ||
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