class Sistrix::Links::List

Attributes

credits[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/sistrix/links/list.rb, line 11
def initialize(options = {})
  @options = {
    'domain' => nil,
    'api_key' => Sistrix.config.api_key,
  }.merge(options)

  if Sistrix.config.proxy
    RestClient.proxy = Sistrix.config.proxy
  end
end

Public Instance Methods

call(options = {}) click to toggle source
# File lib/sistrix/links/list.rb, line 22
def call(options = {})
  data = fetch(options)

  @credits = data.xpath('/response/credits').first['used'].to_i

  @links = []
  data.xpath('/response/answer/link').each do |r|
    @links << Record.new(r)
  end

  self
end