class Account
Constants
- BASEURL
- DIMENSIONS
- DIMENSION_FILTER
Public Class Methods
new(api_key, site_token, client = Client.new)
click to toggle source
# File lib/gosquared/account.rb, line 10 def initialize(api_key, site_token, client = Client.new) @site_token = site_token @api_key = api_key @client = client @bots= "" @ips = "" @visitor = "" @dimension_filter = "" end
Public Instance Methods
bots()
click to toggle source
# File lib/gosquared/account.rb, line 60 def bots @bots = "/bots" end
build_url(ips = @ips)
click to toggle source
# File lib/gosquared/account.rb, line 74 def build_url(ips = @ips) array = [""] @url = BASEURL + @dimension + @dimension_filter + @visitor + @bots + ips + "?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
delete()
click to toggle source
# File lib/gosquared/account.rb, line 54 def delete response = @client.post(build_url, @data) @@filters.each{|key, value| @@filters[key]=nil} if response.code === '200' response end
fetch()
click to toggle source
# File lib/gosquared/account.rb, line 42 def fetch data = @client.get(build_url) @@filters.each{|key, value| @@filters[key]=nil} if data data end
ips()
click to toggle source
# File lib/gosquared/account.rb, line 64 def ips @ips = "/ips" self end
post()
click to toggle source
# File lib/gosquared/account.rb, line 48 def post response = @client.post(build_url, @data) @@filters.each{|key, value| @@filters[key]=nil} if response.code === '200' response end
visitors(id="")
click to toggle source
# File lib/gosquared/account.rb, line 69 def visitors(id="") @visitor = "/visitors/#{id}" self end