diff --git a/lib/blnk.rb b/lib/blnk.rb index b32de5b..14bf8e7 100644 --- a/lib/blnk.rb +++ b/lib/blnk.rb @@ -6,6 +6,7 @@ require_relative 'blnk/client' require_relative 'blnk/resourceable' require_relative 'blnk/ledger' +require_relative 'blnk/balance' module Blnk class Error < StandardError; end diff --git a/lib/blnk/balance.rb b/lib/blnk/balance.rb new file mode 100644 index 0000000..4ca7f44 --- /dev/null +++ b/lib/blnk/balance.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Blnk + # Balance representation + class Balance < Resourceable + def self.resource_name = :balances + + def persisted? = !balance_id.nil? + def body_data = { ledger_id:, currency: } + end +end diff --git a/lib/blnk/ledger.rb b/lib/blnk/ledger.rb index c7912ab..815a78c 100644 --- a/lib/blnk/ledger.rb +++ b/lib/blnk/ledger.rb @@ -5,14 +5,7 @@ module Blnk class Ledger < Resourceable def self.resource_name = :ledgers - def create_args = { name:, meta_data: meta_data || nil } def persisted? = !ledger_id.nil? - - def body_data - { - name:, - meta_data: - } - end + def body_data = { name:, meta_data: } end end diff --git a/lib/blnk/resourceable.rb b/lib/blnk/resourceable.rb index 47c9aca..564a8d0 100644 --- a/lib/blnk/resourceable.rb +++ b/lib/blnk/resourceable.rb @@ -23,8 +23,8 @@ def self.all end end - def self.create(**create_args) - new(**create_args).save + def self.create(*) + new(*).save end def save @@ -37,7 +37,6 @@ def save self end - def create_args = {} def persisted? = raise NotImplementedError def body_data = raise NotImplementedError end