class Sistrix::Credits

Attributes

credits[R]
credits_available[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/sistrix/credits.rb, line 10
def initialize(options = {})
  @options = {
    'api_key' => Sistrix.config.api_key,
  }

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

Public Instance Methods

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

  @credits = data.xpath('/response/credits').first['used'].to_i
  @credits_available = data.xpath('/response/answer/credits').first['value'].to_s.strip.to_i

  self
end