Class: Torckapi::Tracker::Base
- Inherits:
-
Object
- Object
- Torckapi::Tracker::Base
- Defined in:
- lib/torckapi/tracker/base.rb
Overview
Public interface for torrent trackers
Instance Attribute Summary collapse
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#announce(info_hash, peer_id = SecureRandom.random_bytes(20)) ⇒ Torckapi::Response::Announce
Announce request.
-
#scrape(info_hashes = []) ⇒ Torckapi::Response::Scrape
Scrape request.
Instance Attribute Details
#url ⇒ Object (readonly)
Returns the value of attribute url.
6 7 8 |
# File 'lib/torckapi/tracker/base.rb', line 6 def url @url end |
Instance Method Details
#announce(info_hash, peer_id = SecureRandom.random_bytes(20)) ⇒ Torckapi::Response::Announce
Announce request
15 16 17 |
# File 'lib/torckapi/tracker/base.rb', line 15 def announce info_hash, peer_id=SecureRandom.random_bytes(20) raise Torckapi::InvalidInfohashError if info_hash !~ /\A[0-9a-f]{40}\z/i end |
#scrape(info_hashes = []) ⇒ Torckapi::Response::Scrape
Scrape request
25 26 27 |
# File 'lib/torckapi/tracker/base.rb', line 25 def scrape info_hashes=[] raise Torckapi::InvalidInfohashError if info_hashes.any? { |i| i !~ /\A[0-9a-f]{40}\z/i } end |