class Sistrix::Keyword::Sem
Attributes
credits[R]
date[R]
results[R]
Public Class Methods
new(options = {})
click to toggle source
# File lib/sistrix/keyword/sem.rb, line 11 def initialize(options = {}) @options = { 'kw' => nil, 'num' => 5, 'date' => 'today', '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/keyword/sem.rb, line 25 def call(options = {}) data = fetch(options) @credits = data.xpath('/response/credits').first['used'].to_i @date = Time.parse(data.xpath('/response/date').first.to_s) @results = [] data.xpath('/response/answer/result').each do |r| @results << Record.new(r) end self end