Module: CoinsPaid

Defined in:
lib/coins_paid.rb,
lib/coins_paid/address.rb,
lib/coins_paid/coins_paid_address.rb,
lib/generators/coins_paid/migration_data.rb,
lib/generators/coins_paid/migration_generator.rb

Defined Under Namespace

Modules: Generators, MigrationData Classes: Address, CoinsPaidAddress

Constant Summary collapse

UnknownCurrency =
Class.new RuntimeError

Class Method Summary collapse

Class Method Details

.address(foreign_id, currency:, convert_to: currency) ⇒ Object



12
13
14
# File 'lib/coins_paid.rb', line 12

def address(foreign_id, currency:, convert_to: currency)
  Address.new(foreign_id: foreign_id, currency: currency, convert_to: convert_to).call
end

.currency(name) ⇒ Object



16
17
18
# File 'lib/coins_paid.rb', line 16

def currency(name)
  CoinsPaid::API.currencies_list.find { |item| item.currency == name } || raise(UnknownCurrency, name)
end

.issued_addresses(foreign_id) ⇒ Object



20
21
22
# File 'lib/coins_paid.rb', line 20

def issued_addresses(foreign_id)
  CoinsPaidAddress.where(foreign_id: foreign_id).order(:currency, :convert_to)
end