Class: EverSdk::Utils::AddressStringFormat

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

Overview

types

Constant Summary collapse

TYPES =
[:account_id, :hex, :base64]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type_:, url: nil, test_: nil, bounce: nil) ⇒ AddressStringFormat

Returns a new instance of AddressStringFormat.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ever_sdk_client/utils.rb', line 12

def initialize(type_:, url: nil, test_: nil, bounce: nil)
  unless TYPES.include?(type_)
    raise ArgumentError.new("type #{type_} is unknown; known types: #{TYPES}")
  end

  @type_ = type_
  if @type_ == :base64
    @url = url
    @test_ = test_
    @bounce = bounce
  end
end

Instance Attribute Details

#bounceObject (readonly)

Returns the value of attribute bounce.



10
11
12
# File 'lib/ever_sdk_client/utils.rb', line 10

def bounce
  @bounce
end

#test_Object (readonly)

Returns the value of attribute test_.



10
11
12
# File 'lib/ever_sdk_client/utils.rb', line 10

def test_
  @test_
end

#type_Object (readonly)

Returns the value of attribute type_.



10
11
12
# File 'lib/ever_sdk_client/utils.rb', line 10

def type_
  @type_
end

#urlObject (readonly)

Returns the value of attribute url.



10
11
12
# File 'lib/ever_sdk_client/utils.rb', line 10

def url
  @url
end

Instance Method Details

#to_hObject



25
26
27
28
29
30
31
32
# File 'lib/ever_sdk_client/utils.rb', line 25

def to_h
  {
    type: Helper.sym_to_capitalized_case_str(@type_),
    url: @url,
    test: @test_,
    bounce: @bounce
  }
end