Class: DPay::Bank

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Bank

Returns a new instance of Bank.

Parameters:

  • data (Hash[String, untyped])


11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/dpay/bank/bank.rb', line 11

def initialize(data)
  @raw = data
  @id = Internal::Coerce.string(data["id"]) || ""
  @name = Internal::Coerce.string(data["name"]) || ""
  @image = data["image"].is_a?(String) ? data["image"] : nil
  @on_from = Internal::Coerce.integer(data["on_from"])
  @on_to = Internal::Coerce.integer(data["on_to"])
  @iterator = data["iterator"].nil? ? nil : Internal::Coerce.integer(data["iterator"])
  @test = Internal::Coerce.boolean(data["test"])
  @type = data["type"].is_a?(String) ? data["type"] : nil
  freeze
end

Instance Attribute Details

#idString (readonly)

Returns the value of attribute id.

Returns:

  • (String)


5
6
7
# File 'lib/dpay/bank/bank.rb', line 5

def id
  @id
end

#imageString? (readonly)

Returns the value of attribute image.

Returns:

  • (String, nil)


5
6
7
# File 'lib/dpay/bank/bank.rb', line 5

def image
  @image
end

#iteratorInteger? (readonly)

Returns the value of attribute iterator.

Returns:

  • (Integer, nil)


5
6
7
# File 'lib/dpay/bank/bank.rb', line 5

def iterator
  @iterator
end

#nameString (readonly)

Returns the value of attribute name.

Returns:

  • (String)


5
6
7
# File 'lib/dpay/bank/bank.rb', line 5

def name
  @name
end

#on_fromInteger (readonly)

Returns the value of attribute on_from.

Returns:

  • (Integer)


5
6
7
# File 'lib/dpay/bank/bank.rb', line 5

def on_from
  @on_from
end

#on_toInteger (readonly)

Returns the value of attribute on_to.

Returns:

  • (Integer)


5
6
7
# File 'lib/dpay/bank/bank.rb', line 5

def on_to
  @on_to
end

#rawHash[String, untyped] (readonly)

Returns the value of attribute raw.

Returns:

  • (Hash[String, untyped])


5
6
7
# File 'lib/dpay/bank/bank.rb', line 5

def raw
  @raw
end

#typeString? (readonly)

Returns the value of attribute type.

Returns:

  • (String, nil)


5
6
7
# File 'lib/dpay/bank/bank.rb', line 5

def type
  @type
end

Class Method Details

.from_api(data) ⇒ Bank

Parameters:

  • data (Hash[String, untyped])

Returns:



7
8
9
# File 'lib/dpay/bank/bank.rb', line 7

def self.from_api(data)
  new(data)
end

Instance Method Details

#test?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/dpay/bank/bank.rb', line 24

def test?
  @test
end