Class: Brandmaker::CustomStructure

Inherits:
Object
  • Object
show all
Extended by:
Savon::Model
Defined in:
lib/brandmaker/custom_structure.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ CustomStructure

Returns a new instance of CustomStructure.



38
39
40
# File 'lib/brandmaker/custom_structure.rb', line 38

def initialize data
  @data = data
end

Class Method Details

.allObject



25
26
27
28
29
# File 'lib/brandmaker/custom_structure.rb', line 25

def all
  find_all_custom_structures.body[:find_all_custom_structures_response][:return][:custom_structures].collect do |data|
    CustomStructure.new data
  end
end

.clientObject



11
12
13
# File 'lib/brandmaker/custom_structure.rb', line 11

def self.client
  Brandmaker.configuration.dse_client
end

.custom_structure_name_for_mapped_technical_name(technical_name) ⇒ Object



31
32
33
34
35
# File 'lib/brandmaker/custom_structure.rb', line 31

def custom_structure_name_for_mapped_technical_name technical_name
  {
    'anbieter_hinzufgen' => 'PM_ExterneSuppliers_Druckereien'
  }[technical_name]
end

.find_by_technical_name(technical_name) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/brandmaker/custom_structure.rb', line 16

def find_by_technical_name technical_name
  name = custom_structure_name_for_mapped_technical_name(technical_name)
  unless name.nil?
    all.find { |cs| cs.name == name }
  else
    nil
  end
end

Instance Method Details

#labelObject



46
47
48
# File 'lib/brandmaker/custom_structure.rb', line 46

def label
  @data[:name]
end

#nameObject



42
43
44
# File 'lib/brandmaker/custom_structure.rb', line 42

def name
  @data[:name]
end

#objectsObject



50
51
52
# File 'lib/brandmaker/custom_structure.rb', line 50

def objects
  @data[:objects]
end