Class: B2bCenterApi::WebService::BaseType

Inherits:
Object
  • Object
show all
Includes:
TypeCast
Defined in:
lib/b2b_center_api/web_service/base_type.rb

Constant Summary collapse

NO_INSPECT_ATTRS =
[:@soap_client]

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TypeCast

included

Instance Attribute Details

#date_fieldsObject (readonly)

Returns the value of attribute date_fields.



15
16
17
# File 'lib/b2b_center_api/web_service/base_type.rb', line 15

def date_fields
  @date_fields
end

#soap_client=(value) ⇒ Object (writeonly)

Sets the attribute soap_client

Parameters:

  • value

    the value to set the attribute soap_client to.



13
14
15
# File 'lib/b2b_center_api/web_service/base_type.rb', line 13

def soap_client=(value)
  @soap_client = value
end

Instance Method Details

#inspectObject



19
20
21
22
23
24
25
# File 'lib/b2b_center_api/web_service/base_type.rb', line 19

def inspect
  vars = instance_variables
  NO_INSPECT_ATTRS.each { |a| vars.delete(a) }
  vars = vars.map { |v| "#{v}=#{instance_variable_get(v).inspect}" }
  vars = vars.join(', ')
  "<#{self.class}: #{vars}>"
end

#to_hObject



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/b2b_center_api/web_service/base_type.rb', line 27

def to_h
  hash = {}
  vars = instance_variables
  NO_INSPECT_ATTRS.each { |a| vars.delete(a) }

  vars.each { |var| hash[var.to_s.delete('@').to_sym] = instance_variable_get(var) }

  date_fields.each { |d| hash[d] = parse_date(hash[d]) } if date_fields

  hash
end