module Spigot::Base::ClassMethods

Public Instance Methods

new_by_api(params = {}) click to toggle source

self.new_by_api(params) Instantiate a new object mapping the api data to the calling object's attributes

@param params [Hash] Data as received from the api with optional service key

# File lib/spigot/base.rb, line 14
def new_by_api(params = {})
  service, data = Spigot::Map::Service.extract(params)
  translator = Translator.new(self, service, data)
  Record.instantiate(service, self, translator.format)
end
spigot(service = nil) click to toggle source

self.spigot Return a Spigot::Proxy that provides accessor methods to the spigot library

@param service [Symbol] Data for service being processed on the implementation

# File lib/spigot/base.rb, line 24
def spigot(service = nil)
  Spigot::Proxy.new(self, service)
end