Class: Sistrix::Links::Overview
- Inherits:
-
Object
- Object
- Sistrix::Links::Overview
- Includes:
- Base
- Defined in:
- lib/sistrix/links/overview.rb
Instance Attribute Summary collapse
-
#class_c ⇒ Object
readonly
Returns the value of attribute class_c.
-
#credits ⇒ Object
readonly
Returns the value of attribute credits.
-
#domains ⇒ Object
readonly
Returns the value of attribute domains.
-
#hosts ⇒ Object
readonly
Returns the value of attribute hosts.
-
#networks ⇒ Object
readonly
Returns the value of attribute networks.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
- #call(options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Overview
constructor
A new instance of Overview.
Methods included from Base
#base_uri, #fetch, #method_name
Constructor Details
#initialize(options = {}) ⇒ Overview
Returns a new instance of Overview.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/sistrix/links/overview.rb', line 11 def initialize( = {}) @options = { 'domain' => nil, 'api_key' => Sistrix.config.api_key, }.merge() if Sistrix.config.proxy RestClient.proxy = Sistrix.config.proxy end end |
Instance Attribute Details
#class_c ⇒ Object (readonly)
Returns the value of attribute class_c.
9 10 11 |
# File 'lib/sistrix/links/overview.rb', line 9 def class_c @class_c end |
#credits ⇒ Object (readonly)
Returns the value of attribute credits.
9 10 11 |
# File 'lib/sistrix/links/overview.rb', line 9 def credits @credits end |
#domains ⇒ Object (readonly)
Returns the value of attribute domains.
9 10 11 |
# File 'lib/sistrix/links/overview.rb', line 9 def domains @domains end |
#hosts ⇒ Object (readonly)
Returns the value of attribute hosts.
9 10 11 |
# File 'lib/sistrix/links/overview.rb', line 9 def hosts @hosts end |
#networks ⇒ Object (readonly)
Returns the value of attribute networks.
9 10 11 |
# File 'lib/sistrix/links/overview.rb', line 9 def networks @networks end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
9 10 11 |
# File 'lib/sistrix/links/overview.rb', line 9 def total @total end |
Instance Method Details
#call(options = {}) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/sistrix/links/overview.rb', line 22 def call( = {}) data = fetch() @credits = data.xpath('//credits').first['used'].to_i @total = data.xpath('/response/answer/total').first['num'].to_s.strip.to_i @hosts = data.xpath('/response/answer/hosts').first['num'].to_s.strip.to_i @domains = data.xpath('/response/answer/domains').first['num'].to_s.strip.to_i @networks = data.xpath('/response/answer/networks').first['num'].to_s.strip.to_i @class_c = data.xpath('/response/answer/class_c').first['num'].to_s.strip.to_i self end |