class Gosquared::Now

Constants

BASEURL
DIMENSIONS

Public Class Methods

new(api_key, site_token, client = Gosquared::Client.new) click to toggle source
# File lib/gosquared/now.rb, line 14
def initialize(api_key, site_token, client = Gosquared::Client.new)
  @site_token = site_token
  @api_key = api_key
  @client = client
end

Public Instance Methods

fetch() click to toggle source
# File lib/gosquared/now.rb, line 34
def fetch
  data = @client.get(url)
  @@filters.each { |key, _value| @@filters[key] = nil } if data
  data
end

Private Instance Methods

url() click to toggle source
# File lib/gosquared/now.rb, line 42
def url
  array = ['']
  @url = BASEURL + @dimension + "?api_key=#{@api_key}" + "&site_token=#{@site_token}"
  @@filters.each { |key, value| array << "#{key}=#{value}" if value }
  parameters = array.join('&')
  @url = @url.concat(parameters)
end