Initial commit
This commit is contained in:
commit
4b5f7906d7
33 files changed
+933
No files matched your search
@@ -0,0 +1,17 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module StrikeMe
|
||||
module API
|
||||
class Account
|
||||
class Balance < BaseModel
|
||||
attribute :currency
|
||||
attribute :current, :float
|
||||
attribute :pending, :float
|
||||
attribute :outgoing, :float
|
||||
attribute :reserved, :float
|
||||
attribute :available, :float
|
||||
attribute :total, :float
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,27 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module StrikeMe
|
||||
module API
|
||||
class Account
|
||||
class Balances
|
||||
include Enumerable
|
||||
|
||||
attr_reader :account
|
||||
|
||||
def initialize(account, items)
|
||||
@account = account
|
||||
# Map hash to object
|
||||
@items = items.map { |item| Balance.new item }
|
||||
end
|
||||
|
||||
def each(&block)
|
||||
@items.each(&block)
|
||||
end
|
||||
|
||||
def to_a
|
||||
@items.map(&:attributes)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module StrikeMe
|
||||
module API
|
||||
class Account
|
||||
class Profile < BaseModel
|
||||
attribute :account
|
||||
attribute :id
|
||||
attribute :handle
|
||||
attribute :canReceive
|
||||
attribute :currencies
|
||||
|
||||
delegate :balances, to: :account
|
||||
|
||||
def can_receive?
|
||||
canReceive.present?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user