Class: ActiveForce::Field

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Field.



6
7
8
9
10
# File 'lib/active_force/field.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/field.rb', line 4

def as
  @as
end

#local_nameObject

Returns the value of attribute local_name.



4
5
6
# File 'lib/active_force/field.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/field.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/field.rb', line 12

def value_for_hash value
  case as
  when :datetime
    value&.to_fs(:iso8601)
  else
    value
  end
end