Class: EverSdk::Boc::BocCacheType

Inherits:
Object
  • Object
show all
Defined in:
lib/ever_sdk_client/boc.rb

Constant Summary collapse

TYPES =
[
  :pinned,
  :unpinned
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, pin: nil) ⇒ BocCacheType

Returns a new instance of BocCacheType.



34
35
36
37
38
39
40
# File 'lib/ever_sdk_client/boc.rb', line 34

def initialize(type:, pin: nil)
  unless TYPES.include?(type)
    raise ArgumentError.new("type #{type} is unknown; known types: #{TYPES}")
  end
  @type = type
  @pin = pin
end

Instance Attribute Details

#pinObject (readonly)

Returns the value of attribute pin.



32
33
34
# File 'lib/ever_sdk_client/boc.rb', line 32

def pin
  @pin
end

#typeObject (readonly)

Returns the value of attribute type.



32
33
34
# File 'lib/ever_sdk_client/boc.rb', line 32

def type
  @type
end

Instance Method Details

#to_hObject



42
43
44
45
46
# File 'lib/ever_sdk_client/boc.rb', line 42

def to_h
  hash = {type: Helper.sym_to_capitalized_case_str(type)}
  hash[:pin] = pin if type == :pinned
  hash
end