Class: Symgate::Wordlist::GraphicAttachment

Inherits:
Type
  • Object
show all
Defined in:
lib/symgate/wordlist/graphic_attachment.rb

Overview

contains an embedded wordlist entry graphic

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Type

#==, hash_value_with_optional_namespace, #initialize

Constructor Details

This class inherits a constructor from Symgate::Type

Class Method Details

.from_soap(hash) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/symgate/wordlist/graphic_attachment.rb', line 8

def self.from_soap(hash)
  data = hash_value_with_optional_namespace(:wl, :data, hash)

  Symgate::Wordlist::GraphicAttachment.new(
    type: hash_value_with_optional_namespace(:wl, :type, hash),
    uuid: hash_value_with_optional_namespace(:wl, :uuid, hash),
    data: data ? Base64.decode64(data) : nil
  )
end

Instance Method Details

#to_sObject



26
27
28
# File 'lib/symgate/wordlist/graphic_attachment.rb', line 26

def to_s
  "{#{@type} Attachment: #{@uuid} (#{@data.length} bytes)}"
end

#to_soapObject



18
19
20
21
22
23
24
# File 'lib/symgate/wordlist/graphic_attachment.rb', line 18

def to_soap
  {
    %s(wl:type) => @type,
    %s(wl:uuid) => @uuid,
    %s(wl:data) => @data ? Base64.encode64(@data) : nil
  }
end