class Etwin::Link::TwinoidLink
Attributes
link[R]
unlink[R]
user[R]
Public Class Methods
deserialize(raw)
click to toggle source
# File lib/etwin/link/twinoid_link.rb, line 96 def deserialize(raw) link = LinkAction.deserialize(raw['link']) raw_unlink = raw['unlink'] unlink = raw_unlink.nil? ? nil : LinkAction.deserialize(raw_unlink) user = Etwin::Twinoid::ShortTwinoidUser.deserialize(raw['user']) new(link, unlink, user) end
from_json(json_str)
click to toggle source
# File lib/etwin/link/twinoid_link.rb, line 91 def from_json(json_str) deserialize JSON.parse(json_str) end
new(link, unlink, user)
click to toggle source
# File lib/etwin/link/twinoid_link.rb, line 25 def initialize(link, unlink, user) @link = T.let(link, LinkAction) @unlink = T.let(unlink, T.nilable(LinkAction)) @user = T.let(user, Etwin::Twinoid::ShortTwinoidUser) freeze end
Public Instance Methods
==(other)
click to toggle source
# File lib/etwin/link/twinoid_link.rb, line 33 def ==(other) case other when TwinoidLink @link == other.link && @unlink == other.unlink && @user == other.user else false end end
as_json()
click to toggle source
# File lib/etwin/link/twinoid_link.rb, line 54 def as_json { 'link' => @link.as_json, 'unlink' => @unlink.nil? ? nil : @unlink.as_json, 'user' => @user.as_json } end
hash()
click to toggle source
# File lib/etwin/link/twinoid_link.rb, line 43 def hash [@link, @unlink, @user].hash end
inspect()
click to toggle source
# File lib/etwin/link/twinoid_link.rb, line 63 def inspect PP.singleline_pp(self, String.new) end
pretty_print(pp)
click to toggle source
# File lib/etwin/link/twinoid_link.rb, line 68 def pretty_print(pp) # rubocop:disable Metrics/MethodLength pp.group(0, "#{self.class.name}(", ')') do pp.nest 1 do pp.breakable '' pp.text 'link=' pp.pp @link pp.text ',' pp.breakable '' pp.text 'unlink=' pp.pp @unlink pp.text ',' pp.breakable '' pp.text 'user=' pp.pp @user end pp.breakable '' end end
to_json(opts = nil)
click to toggle source
# File lib/etwin/link/twinoid_link.rb, line 49 def to_json(opts = nil) JSON.generate(as_json, opts) end