Class: DistributedPress::V1::Social::ReferencedObject

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/distributed_press/v1/social/referenced_object.rb

Overview

TODO:

Merge with Reference

An object with external references

Direct Known Subclasses

Collection

Constant Summary collapse

URI_FIXES =

Mastodon hides self-replies

%r{&?only_other_accounts=true&?}
REFERENTIABLE_ATTRIBUTES =
%w[
  actor
  owner
  attributedTo
  cc
  inReplyTo
  object
  replies
  likes
  shares
  to
  publicKey
  audience

  alsoKnownAs
  devices
  featured
  featuredTags
  followers
  following
  inbox
  movedTo
  outbox

  first
  items
  next
  orderedItems
  partOf
  prev
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object:, dereferencer:, referenced: nil) ⇒ ReferencedObject

Returns a new instance of ReferencedObject.



53
54
55
56
57
# File 'lib/distributed_press/v1/social/referenced_object.rb', line 53

def initialize(object:, dereferencer:, referenced: nil)
  @object = object
  @dereferencer = dereferencer
  @referenced = referenced || reference_object(object)
end

Instance Attribute Details

#dereferencerObject (readonly)

Returns the value of attribute dereferencer.



48
49
50
# File 'lib/distributed_press/v1/social/referenced_object.rb', line 48

def dereferencer
  @dereferencer
end

#objectObject (readonly)

Returns the value of attribute object.



47
48
49
# File 'lib/distributed_press/v1/social/referenced_object.rb', line 47

def object
  @object
end

#referencedObject (readonly)

Returns the value of attribute referenced.



49
50
51
# File 'lib/distributed_press/v1/social/referenced_object.rb', line 49

def referenced
  @referenced
end

Class Method Details

._load(array) ⇒ Object



63
64
65
66
67
# File 'lib/distributed_press/v1/social/referenced_object.rb', line 63

def self._load(array)
  object, dereferencer = Marshal.load(array)

  new(object: object, dereferencer: dereferencer)
end

Instance Method Details

#_dump(_) ⇒ Object



59
60
61
# File 'lib/distributed_press/v1/social/referenced_object.rb', line 59

def _dump(_)
  Marshal.dump([object, dereferencer])
end

#parsed_responseObject



73
74
75
# File 'lib/distributed_press/v1/social/referenced_object.rb', line 73

def parsed_response
  self
end

#success?Boolean

Returns:

  • (Boolean)


69
70
71
# File 'lib/distributed_press/v1/social/referenced_object.rb', line 69

def success?
  true
end