class Etwin::User::User
Main user class
Attributes
display_name[R]
id[R]
is_administrator[R]
links[R]
Public Class Methods
deserialize(raw)
click to toggle source
# File lib/etwin/user/user.rb, line 113 def deserialize(raw) id = UserId.new(raw['id']) display_name = UserDisplayNameVersions.deserialize(raw['display_name']) is_administrator = raw['is_administrator'] links = Etwin::Link::VersionedLinks.deserialize(raw['links']) new(id, display_name, is_administrator, links) end
from_json(json_str)
click to toggle source
# File lib/etwin/user/user.rb, line 108 def from_json(json_str) deserialize JSON.parse(json_str) end
new(id, display_name, is_administrator, links)
click to toggle source
# File lib/etwin/user/user.rb, line 33 def initialize(id, display_name, is_administrator, links) @id = T.let(id, UserId) @display_name = T.let(display_name, UserDisplayNameVersions) @is_administrator = T.let(is_administrator, T::Boolean) @links = T.let(links, Etwin::Link::VersionedLinks) freeze end
Public Instance Methods
==(other)
click to toggle source
# File lib/etwin/user/user.rb, line 42 def ==(other) case other when User @id == other.id && @display_name == other.display_name && @is_administrator == other.is_administrator && @links == other.links else false end end
as_json()
click to toggle source
# File lib/etwin/user/user.rb, line 66 def as_json { 'id' => @id.as_json, 'display_name' => @display_name.as_json, 'is_administrator' => @is_administrator, 'links' => @links.as_json } end
hash()
click to toggle source
# File lib/etwin/user/user.rb, line 55 def hash [@id, @display_name, @is_administrator, @links].hash end
inspect()
click to toggle source
# File lib/etwin/user/user.rb, line 76 def inspect PP.singleline_pp(self, String.new) end
pretty_print(pp)
click to toggle source
# File lib/etwin/user/user.rb, line 81 def pretty_print(pp) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength pp.group(0, "#{self.class.name}(", ')') do pp.nest 1 do pp.breakable '' pp.text 'id=' pp.pp @id pp.text ',' pp.breakable '' pp.text 'display_name=' pp.pp @display_name pp.text ',' pp.breakable '' pp.text 'is_administrator=' pp.pp @is_administrator pp.text ',' pp.breakable '' pp.text 'links=' pp.pp @links end pp.breakable '' end end
to_json(opts = nil)
click to toggle source
# File lib/etwin/user/user.rb, line 61 def to_json(opts = nil) JSON.generate(as_json, opts) end