class Symgate::Wordlist::Entry

a wordlist entry

Public Class Methods

from_soap(hash) click to toggle source
# File lib/symgate/wordlist/entry.rb, line 11
def self.from_soap(hash)
  Symgate::Wordlist::Entry.new(
    word: hash_value_with_optional_namespace(:wl, :word, hash),
    uuid: hash_value_with_optional_namespace(:wl, :uuid, hash),
    priority: hash_value_with_optional_namespace(:wl, :priority, hash).to_i,
    concept_code: hash_value_with_optional_namespace(:wl, :conceptcode, hash),
    symbols: Symgate::Client.savon_array(hash, :symbol,
                                         Symgate::Cml::Symbol),
    custom_graphics: Symgate::Client.savon_array(hash, :customgraphic,
                                                 Symgate::Wordlist::GraphicAttachment),
    last_change: hash_value_with_optional_namespace(:wl, :lastchange, hash)
  )
end

Public Instance Methods

to_s() click to toggle source
# File lib/symgate/wordlist/entry.rb, line 37
def to_s
  "{Entry: #{@word}[#{@priority}]/#{@uuid} (#{@symbols.count}+#{@custom_graphics.count})}"
end
to_soap() click to toggle source
# File lib/symgate/wordlist/entry.rb, line 25
def to_soap
  {
    :wl:word => word,
    :wl:uuid => uuid,
    :wl:priority => priority,
    :wl:conceptcode => value_or_nil(concept_code),
    :cml:symbol => @symbols.tryit { map(&:to_soap) },
    :wl:customgraphic => @custom_graphics.tryit { map(&:to_soap) },
    :wl:lastchange => last_change.to_s
  }.delete_if { |_, v| v.nil? }
end

Protected Instance Methods

attributes() click to toggle source
# File lib/symgate/wordlist/entry.rb, line 43
def attributes
  %i[word uuid priority concept_code symbols custom_graphics last_change]
end