broolik-crystal
Broolik: Affiliate Links Checker for Crystal
TODO: Write a description here
Installation
-
Add the dependency to your
shard.yml
:dependencies: broolik: github: jetthoughts/broolik-crystal
-
Run
shards install
Usage
- Single link real-time verification:
require "broolik"
client = Broolik.client
link = client.create_link({
"url" => "http://jetthoughts.com",
"device" => "iphone",
"country" => "UKR"
})
puts "Link validation status is: #{link.status}"
link.redirects.each do |redirect|
puts "Following '#{redirect.url}' got '#{redirect.status_code}'
end
client.close
- Schedule bulk verification:
require "broolik"
client = Broolik.client
batch = client.create_batch(
{
"url" => "http://jetthoughts.com",
"device" => "iphone",
"country" => "UKR"
},
{
"url" => "http://jtway.co",
"device" => "android",
"country" => "USA"
}
)
puts "Batch validation state is: #{batch.status}"
until batch.report_completed?
sleep 5 * 60 # 5 minutes
# Poll batch result each 5 minutes
batch = client.find_batch(batch.id)
puts "Batch validation state is: #{batch.status}"
end
# Show batch report content
unless batch.links_report.nil?
puts "Verification report:"
HTTP::Client.get(batch.links_report.as(String)) do |response|
puts response.body_io.gets_to_end
end
puts "=" * 10
end
client.close
Development
TODO: Write development instructions here
Contributing
- Fork it (https://github.com/your-github-user/broolik-crystal/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Paul Keen - creator and maintainer
Repository
broolik-crystal
Owner
Statistic
- 0
- 0
- 0
- 0
- 1
- almost 6 years ago
- May 29, 2019
License
MIT License
Links
Synced at
Wed, 01 Oct 2025 14:24:06 GMT
Languages