Class: DPay::BlikAliasRegistration

Inherits:
Object
  • Object
show all
Defined in:
lib/dpay/blik/blik_alias_registration.rb,
sig/dpay/blik/blik_alias_registration.rbs

Instance Method Summary collapse

Constructor Details

#initialize(label, type = BlikAliasType::UID) ⇒ BlikAliasRegistration

Returns a new instance of BlikAliasRegistration.

Parameters:

  • label (String)
  • type (String) (defaults to: BlikAliasType::UID)


5
6
7
8
9
10
11
12
13
14
15
# File 'lib/dpay/blik/blik_alias_registration.rb', line 5

def initialize(label, type = BlikAliasType::UID)
  unless label.is_a?(String) && !label.empty? && label.length <= 50
    raise InvalidArgumentError, "Alias label must be 1-50 characters"
  end

  BlikAliasType.assert_valid(type)

  @label = label
  @type = type
  freeze
end

Instance Method Details

#to_hHash[String, untyped]

Returns:

  • (Hash[String, untyped])


17
18
19
# File 'lib/dpay/blik/blik_alias_registration.rb', line 17

def to_h
  { "label" => @label, "type" => @type }
end