Skip to content

Commit

Permalink
WIP - balance basic integration
Browse files Browse the repository at this point in the history
  • Loading branch information
devton committed Jun 26, 2024
1 parent 44b2f54 commit 88c523d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
1 change: 1 addition & 0 deletions lib/blnk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions lib/blnk/balance.rb
Original file line number Diff line number Diff line change
@@ -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
9 changes: 1 addition & 8 deletions lib/blnk/ledger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 2 additions & 3 deletions lib/blnk/resourceable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -37,7 +37,6 @@ def save
self
end

def create_args = {}
def persisted? = raise NotImplementedError
def body_data = raise NotImplementedError
end
Expand Down

0 comments on commit 88c523d

Please sign in to comment.