Sha256: 06b798b82d8e75618cbffd571215460525579b04c352475a33ac98f2232e6c84

Contents?: true

Size: 1.74 KB

Versions: 1

Compression:

Stored size: 1.74 KB

Contents

# encoding: utf-8
#
# Mode Analytics namespace
#
module Mode
  # Official [Mode Analytics](https://modeanalytics.com) Ruby SDK
  #
  module Sdk
    class << self
      # Set Mode configuration values
      #
      # @yield [Mode::Sdk::Configuration] the configuration instance
      #
      # @example
      #   Mode.configure do |config|
      #     config.token  = "token"
      #     config.secret = "secret"
      #   end
      #
      def configure
        yield config
      end

      # The Mode configuration instance
      #
      # @return [Mode::Sdk::Configuration] the configuration instance
      #
      def config
        @config ||= Mode::Sdk::Configuration.new
      end

      # The Mode API representation of the authenticated account
      #
      # @return [Hash] the account representation
      #
      def account
        @account ||= Mode::Sdk::Client.account
      end

      # The username of the authenticated account
      #
      # @return [String] the username
      #
      def username
        account.fetch('username')
      end

      # @see Mode::Sdk::Client.authenticated?
      #
      def authenticated?
        Mode::Sdk::Client.authenticated?
      end

      # Un-memoize everything
      #
      def reset
        %w(config account).each do |name|
          next unless instance_variable_defined?(:"@#{name}")

          remove_instance_variable(:"@#{name}")
        end
      end
    end
  end
end

require 'mode/sdk/cli'
require 'mode/sdk/client'
require 'mode/sdk/column'
require 'mode/sdk/column_set'
require 'mode/sdk/configuration'
require 'mode/sdk/csv_file'
require 'mode/sdk/hash_util'
require 'mode/sdk/table'
require 'mode/sdk/table_import'
require 'mode/sdk/upload'
require 'mode/sdk/version'
require 'mode/sdk/warehouse_util'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mode-sdk-0.1.0 lib/mode/sdk.rb