Sha256: 555fcc58e4044803164c37f935b08309ce49adb302cac487b92d476f5dbd02bd

Contents?: true

Size: 544 Bytes

Versions: 1

Compression:

Stored size: 544 Bytes

Contents

# frozen_string_literal: true

module SimpleAnalyticsApi
  class Client

    attr_accessor :api_key, :user_id, :domain

    def initialize(api_key: nil, user_id: nil, domain: nil)
      @api_key = api_key.to_s
      @user_id = user_id.to_s
      @domain  = domain.to_s
    end

    def valid?
      run.ok rescue false
    end

    def websites 
      Website.new(client: self).run
    end

    def run(fields: [], filters: {}, debug: false)
      Resource.new(client: self, fields: fields, filters: filters, debug: debug).run
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_analytics_api-0.0.3 lib/simple_analytics_api/client.rb