module Typhoid::Attributes
Public Class Methods
included(base)
click to toggle source
# File lib/typhoid/attributes.rb, line 26 def self.included(base) base.extend(ClassMethods) end
Public Instance Methods
after_build(response, exception = nil)
click to toggle source
# File lib/typhoid/attributes.rb, line 17 def after_build(response, exception = nil) assign_request_error(exception) if !response.success? || !exception.nil? end
attributes()
click to toggle source
# File lib/typhoid/attributes.rb, line 7 def attributes @attributes ||= {} @attributes end
load_values(params = {})
click to toggle source
# File lib/typhoid/attributes.rb, line 3 def load_values(params = {}) @attributes = Hash[params.map { |key, value| [key.to_s, value] }] end
read_attribute(name)
click to toggle source
# File lib/typhoid/attributes.rb, line 12 def read_attribute(name) attributes[name.to_s] end
Also aliased as: []
Private Instance Methods
assign_request_error(exception = nil)
click to toggle source
# File lib/typhoid/attributes.rb, line 21 def assign_request_error(exception = nil) self.resource_exception = exception || StandardError.new("Could not retrieve data from remote service") end