Class: GrubY::MaybeInaccessibleMessage

Inherits:
BaseObject
  • Object
show all
Defined in:
lib/gruubY/types/extra.rb

Instance Attribute Summary

Attributes inherited from BaseObject

#api, #client

Instance Method Summary collapse

Methods inherited from BaseObject

#[], #dig, field_names, fields, #method_missing, #respond_to_missing?, #to_h

Constructor Details

#initialize(data) ⇒ MaybeInaccessibleMessage

Returns a new instance of MaybeInaccessibleMessage.



23
24
25
# File 'lib/gruubY/types/extra.rb', line 23

def initialize(data)
  super({ raw: data })
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class GrubY::BaseObject

Instance Method Details

#as_inaccessibleObject



31
32
33
34
35
# File 'lib/gruubY/types/extra.rb', line 31

def as_inaccessible
  return nil unless inaccessible?

  InaccessibleMessage.new(@raw)
end

#inaccessible?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/gruubY/types/extra.rb', line 27

def inaccessible?
  @raw.is_a?(Hash) && @raw["date"].to_i.zero?
end