Class: ArrowPayments::Entity

Inherits:
Hashie::Trash
  • Object
show all
Includes:
Hashie::Extensions::Coercion
Defined in:
lib/arrow_payments/entity.rb

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.properties_mapObject (readonly)

Returns the value of attribute properties_map.



8
9
10
# File 'lib/arrow_payments/entity.rb', line 8

def properties_map
  @properties_map
end

Class Method Details

.property(property_name, options = {}) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/arrow_payments/entity.rb', line 24

def self.property(property_name, options = {})
  super(property_name, options)

  if options[:from]
    @properties_map ||= {}
    @properties_map[property_name.to_sym] = options[:from].to_s
  end
end

Instance Method Details

#to_source_hash(options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/arrow_payments/entity.rb', line 13

def to_source_hash(options={})
  hash = {}

  self.class.properties_map.each_pair do |k, v|
    val = send(k)
    hash[v] = val unless val.nil?
  end

  hash
end