Module: Torznab::Client::Caps

Included in:
Torznab::Client
Defined in:
lib/torznab/client/caps.rb,
lib/torznab/client/caps/category.rb,
lib/torznab/client/caps/instance.rb,
lib/torznab/client/caps/search_mode.rb,
lib/torznab/client/caps/subcategory.rb,
lib/torznab/client/caps/search_modes.rb,
lib/torznab/client/caps/mappers/category_mapper.rb,
lib/torznab/client/caps/mappers/instance_mapper.rb,
lib/torznab/client/caps/mappers/categories_mapper.rb,
lib/torznab/client/caps/mappers/search_mode_mapper.rb,
lib/torznab/client/caps/mappers/subcategory_mapper.rb,
lib/torznab/client/caps/mappers/search_modes_mapper.rb,
lib/torznab/client/caps/mappers/category_or_subcategory_mapper.rb

Overview

Capacities handling from the remote Torznab API

Defined Under Namespace

Modules: Mappers Classes: Category, Instance, SearchMode, SearchModes, Subcategory

Constant Summary collapse

HTTP_CAPS_PARAMS =

Default struct for caps fetching

{ t: :caps }.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#capsObject (readonly)

Returns the value of attribute caps


12
13
14
# File 'lib/torznab/client/caps.rb', line 12

def caps
  @caps
end

Instance Method Details

#fetch_caps_from_url(api_url, api_key = nil) ⇒ Object

Fetch and validate Torznab API capabilities from base url Initialize caps attribute if the capabilities could be parsed successfully

Parameters:

  • api_url (String)
  • api_key (String) (defaults to: nil)

Raises:


23
24
25
26
27
28
# File 'lib/torznab/client/caps.rb', line 23

def fetch_caps_from_url(api_url, api_key = nil)
  validate_url api_url
  caps_xml = get_caps_xml api_url, api_key
  nokogiri_xml_document = parse_xml caps_xml
  @caps = map_caps nokogiri_xml_document
end