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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from TypeCast

included

Instance Attribute Details

#soap_client=(value) ⇒ Object (writeonly)

Sets the attribute soap_client

Parameters:

  • value

    the value to set the attribute soap_client to.



11
12
13
# File 'lib/b2b_center_api/web_service/base_type.rb', line 11

def soap_client=(value)
  @soap_client = value
end

Class Method Details

.to_array(obj) ⇒ Object



46
47
48
# File 'lib/b2b_center_api/web_service/base_type.rb', line 46

def self.to_array(obj)
  obj.is_a?(Hash) ? [obj] : obj
end

Instance Method Details

#inspectObject



15
16
17
18
19
20
21
# File 'lib/b2b_center_api/web_service/base_type.rb', line 15

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



23
24
25
26
27
28
29
30
# File 'lib/b2b_center_api/web_service/base_type.rb', line 23

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) }
  hash
end