module Sentimeta

Constants

DEFAULT_ENV
VERSION

Attributes

endpoint[W]
env[RW]
lang[W]
logger[W]
server_token[RW]
sphere[RW]

Public Class Methods

endpoint() click to toggle source
# File lib/sentimeta/init.rb, line 10
def endpoint
  @endpoint ||= ENV['SENTIMETA_API_URL'] || begin
    config_path = File.join(File.dirname(File.expand_path(__FILE__)), '../../config/endpoint.yml')
    config = YAML.load_file(config_path)[env.to_s]
    config['url']
  end
end
init(options) click to toggle source
# File lib/sentimeta/init.rb, line 25
def init options
  options.each do |option, value|
    public_send("#{ option }=", value) if respond_to?("#{ option }=")
  end
end
lang() click to toggle source
# File lib/sentimeta/init.rb, line 18
def lang
  if defined?(::I18n) and ::I18n.respond_to?(:locale)
    self.lang = I18n.locale
  end
  @lang || :en
end
logger() click to toggle source
# File lib/sentimeta/init.rb, line 31
def logger
  @logger ||= Logger.new STDOUT
end

Public Instance Methods

logger() click to toggle source
# File lib/sentimeta/logger.rb, line 6
def logger
  @logger ||= defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
end