Class: Zm::Client::DataSourceJsnsBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/zm/client/datasource/datasource_jsns_builder.rb

Overview

class for account data source jsns builder

Instance Method Summary collapse

Constructor Details

#initialize(item) ⇒ DataSourceJsnsBuilder

Returns a new instance of DataSourceJsnsBuilder.



7
8
9
# File 'lib/zm/client/datasource/datasource_jsns_builder.rb', line 7

def initialize(item)
  @item = item
end

Instance Method Details

#to_deleteObject



24
25
26
27
28
29
# File 'lib/zm/client/datasource/datasource_jsns_builder.rb', line 24

def to_delete
  soap_request = SoapElement.mail(SoapMailConstants::DELETE_DATA_SOURCE_REQUEST)
  node_action = SoapElement.create(@item.type).add_attributes(id: @item.id)
  soap_request.add_node(node_action)
  soap_request
end

#to_patch(hash) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/zm/client/datasource/datasource_jsns_builder.rb', line 11

def to_patch(hash)
  attrs = {
    id: @item.id
  }.merge(hash)

  attrs.reject! { |_, v| v.nil? }

  soap_request = SoapElement.mail(SoapMailConstants::MODIFY_DATA_SOURCE_REQUEST)
  node_action = SoapElement.create(@item.type).add_attributes(attrs)
  soap_request.add_node(node_action)
  soap_request
end