class AlchemyLanguage::ActiveModel::Base

Attributes

auth_token[RW]
json_result[RW]
options[RW]
path[RW]
prefix[RW]
type[RW]

Public Class Methods

new(path, type, options={}) click to toggle source
# File lib/alchemy_language/active_model/base.rb, line 11
def initialize(path, type, options={})
  @path = path
  @auth_token = AlchemyLanguage.secret_token
  @type = type
  @options = options
  check_prefix
  @json_result = request
end

Public Instance Methods

check_prefix() click to toggle source
# File lib/alchemy_language/active_model/base.rb, line 30
def check_prefix
  @type == "text" ? @prefix = @type.capitalize : @prefix = @type.upcase
end
params_addressable() click to toggle source
# File lib/alchemy_language/active_model/base.rb, line 24
def params_addressable
  uri = Addressable::URI.new
  uri.query_values = @options
  uri.query
end
request() click to toggle source
# File lib/alchemy_language/active_model/base.rb, line 20
def request
  json_parser(endpoint)
end