Class: ActiveForce::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/active_force/attribute.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}) ⇒ Attribute

Returns a new instance of Attribute.



6
7
8
9
10
# File 'lib/active_force/attribute.rb', line 6

def initialize name, options = {}
  self.local_name = name
  self.sfdc_name  = options[:sfdc_name] || options[:from] || default_api_name
  self.as         = options[:as]        || :string
end

Instance Attribute Details

#asObject

Returns the value of attribute as.



4
5
6
# File 'lib/active_force/attribute.rb', line 4

def as
  @as
end

#local_nameObject

Returns the value of attribute local_name.



4
5
6
# File 'lib/active_force/attribute.rb', line 4

def local_name
  @local_name
end

#sfdc_nameObject

Returns the value of attribute sfdc_name.



4
5
6
# File 'lib/active_force/attribute.rb', line 4

def sfdc_name
  @sfdc_name
end

Instance Method Details

#value_for_hash(value) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/active_force/attribute.rb', line 12

def value_for_hash value
  case as
  when :multi_picklist
    value.reject(&:empty?).join(';')
  else
    value
  end
end