class AstroPay::Model
Attributes
error[RW]
message[RW]
Public Class Methods
new(attributes = {})
click to toggle source
Creates a new instance of [AstroPay::Model].
@param attributes [Hash] with the following fields: :error, :message. @return [AstroPay::Model] object.
# File lib/astro_pay/model.rb, line 13 def initialize(attributes = {}) self.attributes = attributes end
Public Instance Methods
attributes()
click to toggle source
Gets the instance attributes.
@return [Hash] with the attribute name as key, and the attribute value as
value.
# File lib/astro_pay/model.rb, line 37 def attributes Hash[instance_variables.map { |name| [name, instance_variable_get(name)] }] end
attributes=(attributes = {})
click to toggle source
Sets a given hash values as attribute values for the class. It will try to match the keys of the hash to existent attributes that have accessors.
@param attributes [Hash] @note If raised, [NoMethodError] will be caught and a message will be
printed to the standard output.
# File lib/astro_pay/model.rb, line 23 def attributes=(attributes = {}) attributes.each do |name, value| begin send("#{name.to_s.underscore}=", value) rescue NoMethodError => e puts "Unable to assign #{name.to_s.underscore} with value #{value}. No such method." end end end