class Sentimeta::Model

Public Class Methods

endpoint(endpoint) click to toggle source
# File lib/sentimeta/model.rb, line 12
def self.endpoint endpoint
  @endpoint = endpoint
end
new(params = {}) click to toggle source
# File lib/sentimeta/model.rb, line 4
def initialize params = {}
  (params || {}).each do |key, value|
    method = "#{key}="
    public_send(method, value) if respond_to?(method)
  end
end

Protected Class Methods

fetch(options={}) click to toggle source
# File lib/sentimeta/model.rb, line 19
def self.fetch options={}
  response = Sentimeta::Client.public_send @endpoint, options
  if response.kind_of? Array
    response.map { |entry| new entry }
  elsif response.kind_of? Hash
    new response
  end
end