Class: Zm::Client::TagJsnsBuilder

Inherits:
BaseAccountJsnsBuilder show all
Defined in:
lib/zm/client/tag/tag_jsns_builder.rb

Overview

class for account tag jsns builder

Instance Method Summary collapse

Methods inherited from BaseAccountJsnsBuilder

#build, #initialize, #to_color, #to_delete, #to_move, #to_patch, #to_rename, #to_tag, #to_trash

Constructor Details

This class inherits a constructor from Zm::Client::BaseAccountJsnsBuilder

Instance Method Details

#to_jsnsObject Also known as: to_create



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/zm/client/tag/tag_jsns_builder.rb', line 7

def to_jsns
  attrs = {
    name: @item.name,
    color: @item.color,
    rgb: @item.rgb
  }.delete_if { |_, v| v.nil? }

  soap_request = SoapElement.mail(SoapMailConstants::CREATE_TAG_REQUEST)
  node_tag = SoapElement.create(SoapConstants::TAG).add_attributes(attrs)
  soap_request.add_node(node_tag)
  soap_request
end

#to_updateObject



22
23
24
25
26
27
28
29
30
31
# File 'lib/zm/client/tag/tag_jsns_builder.rb', line 22

def to_update
  attrs = {
    op: :update,
    id: @item.id,
    color: @item.color,
    rgb: @item.rgb
  }.reject { |_, v| v.nil? }

  build(attrs)
end