module Typekit::Client::InstanceMethods

Attributes

options[RW]

Public Instance Methods

configure(options) click to toggle source
# File lib/typekit/client.rb, line 20
def configure(options)
  self.options = options
end

Private Instance Methods

build_engine() click to toggle source
# File lib/typekit/client.rb, line 32
def build_engine
  engine_options = options.merge(dictionary: Typekit.dictionary,
    headers: Typekit.headers.call(options[:token]))

  version = options[:version]
  format = options[:format]

  Apitizer::Base.new(engine_options) do
    instance_exec(version, format, &Typekit.schema)
  end
end
const_missing(name) click to toggle source
# File lib/typekit/client.rb, line 52
def const_missing(name)
  record_class(name)
end
converter(name) click to toggle source
# File lib/typekit/client.rb, line 56
def converter(name)
  (@converters ||= {})[name] ||= Converter.build(name, self)
end
engine() click to toggle source
# File lib/typekit/client.rb, line 28
def engine
  @engine ||= build_engine
end
record_class(name) click to toggle source
# File lib/typekit/client.rb, line 60
def record_class(name)
  (@record_classes ||= {})[name] ||= Record.build(name, self)
end
translate(result) click to toggle source
# File lib/typekit/client.rb, line 44
def translate(result)
  unless result.is_a?(Hash) && result.length == 1
    raise ServerError.new(result.code)
  end
  name, object = *result.first
  converter(name).process(result, object)
end