Initial commit
This commit is contained in:
169
app/api/v2/admin/entities/adjustment.rb
Normal file
169
app/api/v2/admin/entities/adjustment.rb
Normal file
@@ -0,0 +1,169 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module API
|
||||
module V2
|
||||
module Admin
|
||||
module Entities
|
||||
class Adjustment < API::V2::Entities::Base
|
||||
expose(
|
||||
:id,
|
||||
documentation: {
|
||||
type: Integer,
|
||||
desc: 'Unique adjustment identifier in database.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:reason,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Adjustment reason.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:description,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Adjustment description.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:category,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Adjustment category'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:amount,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Adjustment amount.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:validator_uid,
|
||||
documentation: {
|
||||
type: Integer,
|
||||
desc: 'Unique adjustment validator identifier in database.'
|
||||
},
|
||||
if: ->(adjustment, _options) { adjustment.validator }
|
||||
) do |adjustment, _options|
|
||||
adjustment.validator.uid
|
||||
end
|
||||
|
||||
expose(
|
||||
:creator_uid,
|
||||
documentation: {
|
||||
type: Integer,
|
||||
desc: 'Unique adjustment creator identifier in database.'
|
||||
},
|
||||
) do |adjustment, _options|
|
||||
adjustment.creator.uid
|
||||
end
|
||||
|
||||
expose(
|
||||
:currency_id,
|
||||
as: :currency,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Adjustment currency ID.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:asset,
|
||||
using: API::V2::Admin::Entities::Operation,
|
||||
if: ->(adjustment, _options) { adjustment.fetch_asset }
|
||||
) do |adjustment, _options|
|
||||
adjustment.fetch_asset
|
||||
end
|
||||
|
||||
expose(
|
||||
:liability,
|
||||
using: API::V2::Admin::Entities::Operation,
|
||||
if: ->(adjustment, _options) { adjustment.fetch_liability }
|
||||
) do |adjustment, _options|
|
||||
adjustment.fetch_liability
|
||||
end
|
||||
|
||||
expose(
|
||||
:revenue,
|
||||
using: API::V2::Admin::Entities::Operation,
|
||||
if: ->(adjustment, _options) { adjustment.fetch_revenue }
|
||||
) do |adjustment, _options|
|
||||
adjustment.fetch_revenue
|
||||
end
|
||||
|
||||
expose(
|
||||
:expense,
|
||||
using: API::V2::Admin::Entities::Operation,
|
||||
if: ->(adjustment, _options) { adjustment.fetch_expense }
|
||||
) do |adjustment, _options|
|
||||
adjustment.fetch_expense
|
||||
end
|
||||
|
||||
expose(
|
||||
:state,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Adjustment\'s state.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:asset_account_code,
|
||||
documentation: {
|
||||
type: Integer,
|
||||
desc: 'Adjustment asset account code.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:receiving_account_code,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Adjustment receiving account code.'
|
||||
}
|
||||
) do |adjustment, _options|
|
||||
::Operations.split_account_number(account_number: adjustment.receiving_account_number)[:code]
|
||||
end
|
||||
|
||||
expose(
|
||||
:receiving_member_uid,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Adjustment receiving member uid.'
|
||||
},
|
||||
if: ->(adjustment, _options) { adjustment.fetch_liability.present? }
|
||||
) do |adjustment, _options|
|
||||
::Operations.split_account_number(account_number: adjustment.receiving_account_number)[:member_uid]
|
||||
end
|
||||
|
||||
expose(
|
||||
:created_at,
|
||||
format_with: :iso8601,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'The datetime when operation was created.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:updated_at,
|
||||
format_with: :iso8601,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'The datetime when operation was updated.'
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
20
app/api/v2/admin/entities/beneficiary.rb
Normal file
20
app/api/v2/admin/entities/beneficiary.rb
Normal file
@@ -0,0 +1,20 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module API
|
||||
module V2
|
||||
module Admin
|
||||
module Entities
|
||||
class Beneficiary < API::V2::Entities::Beneficiary
|
||||
expose(
|
||||
:data,
|
||||
documentation: {
|
||||
desc: 'Bank Account details for fiat Beneficiary in JSON format.'\
|
||||
'For crypto it\'s blockchain address.',
|
||||
type: JSON
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
102
app/api/v2/admin/entities/blockchain.rb
Normal file
102
app/api/v2/admin/entities/blockchain.rb
Normal file
@@ -0,0 +1,102 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module API
|
||||
module V2
|
||||
module Admin
|
||||
module Entities
|
||||
class Blockchain < API::V2::Entities::Base
|
||||
expose(
|
||||
:id,
|
||||
documentation:{
|
||||
type: Integer,
|
||||
desc: 'Unique blockchain identifier in database.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:key,
|
||||
documentation:{
|
||||
type: String,
|
||||
desc: 'Unique key to identify blockchain.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:name,
|
||||
documentation:{
|
||||
type: String,
|
||||
desc: 'A name to identify blockchain.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:client,
|
||||
documentation:{
|
||||
type: String,
|
||||
desc: 'Integrated blockchain client.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:height,
|
||||
documentation:{
|
||||
type: Integer,
|
||||
desc: 'The number of blocks preceding a particular block on blockchain.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:explorer_address,
|
||||
documentation:{
|
||||
type: String,
|
||||
desc: 'Blockchain explorer address template.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:explorer_transaction,
|
||||
documentation:{
|
||||
type: String,
|
||||
desc: 'Blockchain explorer transaction template.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:min_confirmations,
|
||||
documentation:{
|
||||
type: Integer,
|
||||
desc: 'Minimum number of confirmations.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:status,
|
||||
documentation:{
|
||||
type: String,
|
||||
desc: 'Blockchain status (active/disabled).'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:created_at,
|
||||
format_with: :iso8601,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Blockchain created time in iso8601 format.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:updated_at,
|
||||
format_with: :iso8601,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Blockchain updated time in iso8601 format.'
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
123
app/api/v2/admin/entities/currency.rb
Normal file
123
app/api/v2/admin/entities/currency.rb
Normal file
@@ -0,0 +1,123 @@
|
||||
# enco ding: UTF-8
|
||||
# froz en_string_literal: true
|
||||
|
||||
module API
|
||||
module V2
|
||||
module Admin
|
||||
module Entities
|
||||
class Currency < API::V2::Entities::Currency
|
||||
unexpose(:id)
|
||||
|
||||
expose(
|
||||
:code,
|
||||
documentation: {
|
||||
desc: 'Unique currency code.',
|
||||
type: String
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:blockchain_key,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Associated blockchain key which will perform transactions synchronization for currency.'
|
||||
},
|
||||
if: -> (currency){ currency.coin? }
|
||||
)
|
||||
|
||||
expose(
|
||||
:parent_id,
|
||||
documentation: {
|
||||
desc: 'Parent currency id.',
|
||||
type: String
|
||||
},
|
||||
if: -> (currency){ currency.token? }
|
||||
)
|
||||
|
||||
expose(
|
||||
:min_collection_amount,
|
||||
documentation: {
|
||||
type: BigDecimal,
|
||||
desc: 'Minimal collection amount.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:position,
|
||||
documentation: {
|
||||
type: Integer,
|
||||
desc: 'Currency position.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:visible,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Currency display status (true/false).'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:base_factor,
|
||||
documentation: {
|
||||
type: Integer,
|
||||
desc: 'Currency base factor.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:subunits,
|
||||
documentation: {
|
||||
type: Integer,
|
||||
desc: 'Fraction of the basic monetary unit.'
|
||||
}
|
||||
) { |currency| currency.subunits }
|
||||
|
||||
expose(
|
||||
:options,
|
||||
documentation: {
|
||||
type: JSON,
|
||||
desc: 'Currency options.'
|
||||
},
|
||||
if: -> (currency){ currency.coin? }
|
||||
)
|
||||
|
||||
expose(
|
||||
:precision,
|
||||
documentation: {
|
||||
type: Integer,
|
||||
desc: 'Currency precision.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:price,
|
||||
documentation: {
|
||||
type: BigDecimal,
|
||||
desc: 'Currency price.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:created_at,
|
||||
format_with: :iso8601,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Currency created time in iso8601 format.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:updated_at,
|
||||
format_with: :iso8601,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Currency updated time in iso8601 format.'
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
108
app/api/v2/admin/entities/deposit.rb
Normal file
108
app/api/v2/admin/entities/deposit.rb
Normal file
@@ -0,0 +1,108 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module API
|
||||
module V2
|
||||
module Admin
|
||||
module Entities
|
||||
class Deposit < API::V2::Entities::Deposit
|
||||
expose(
|
||||
:member_id,
|
||||
as: :member,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'The member id.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:uid,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Deposit member uid.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:email,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'The deposit member email.'
|
||||
}
|
||||
) { |d| d.member.email }
|
||||
|
||||
expose(
|
||||
:address,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Deposit blockchain address.'
|
||||
},
|
||||
if: ->(deposit) { deposit.currency.coin? }
|
||||
)
|
||||
|
||||
expose(
|
||||
:txout,
|
||||
documentation: {
|
||||
type: Integer,
|
||||
desc: 'Deposit blockchain transaction output.'
|
||||
},
|
||||
if: ->(deposit) { deposit.currency.coin? }
|
||||
)
|
||||
|
||||
expose(
|
||||
:block_number,
|
||||
documentation: {
|
||||
type: Integer,
|
||||
desc: 'Deposit blockchain block number.'
|
||||
},
|
||||
if: ->(deposit) { deposit.currency.coin? }
|
||||
)
|
||||
|
||||
expose(
|
||||
:type,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Deposit type (fiat or coin).'
|
||||
}
|
||||
) { |d| d.currency.fiat? ? :fiat : :coin }
|
||||
|
||||
expose(
|
||||
:tid,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Deposit tid.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:spread,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Deposit collection spread.'
|
||||
},
|
||||
if: -> (deposit) { !deposit.spread.empty? }
|
||||
)
|
||||
|
||||
expose(
|
||||
:updated_at,
|
||||
format_with: :iso8601,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'The datetime when deposit was updated.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:completed_at,
|
||||
format_with: :iso8601,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'The datetime when deposit was completed.'
|
||||
},
|
||||
if: ->(deposit) { deposit.completed? }
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
51
app/api/v2/admin/entities/engine.rb
Normal file
51
app/api/v2/admin/entities/engine.rb
Normal file
@@ -0,0 +1,51 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module API
|
||||
module V2
|
||||
module Admin
|
||||
module Entities
|
||||
class Engine < API::V2::Entities::Base
|
||||
expose(
|
||||
:id,
|
||||
documentation: {
|
||||
type: Integer,
|
||||
desc: 'Engine uniq id'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:name,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Engine name'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:driver,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Engine driver'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:uid,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Owner of a engine'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:state,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Engine state'
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
20
app/api/v2/admin/entities/internal_transfer.rb
Normal file
20
app/api/v2/admin/entities/internal_transfer.rb
Normal file
@@ -0,0 +1,20 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module API
|
||||
module V2
|
||||
module Admin
|
||||
module Entities
|
||||
class InternalTransfer < API::V2::Entities::InternalTransfer
|
||||
expose(
|
||||
:id,
|
||||
documentation: {
|
||||
type: Integer,
|
||||
desc: 'Internal transfer uniq id'
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
54
app/api/v2/admin/entities/market.rb
Normal file
54
app/api/v2/admin/entities/market.rb
Normal file
@@ -0,0 +1,54 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module API
|
||||
module V2
|
||||
module Admin
|
||||
module Entities
|
||||
class Market < API::V2::Entities::Market
|
||||
expose(
|
||||
:engine_id,
|
||||
documentation: {
|
||||
type: Integer,
|
||||
desc: 'Engine id for this market.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:position,
|
||||
documentation: {
|
||||
type: Integer,
|
||||
desc: 'Market position.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:data,
|
||||
documentation: {
|
||||
type: JSON,
|
||||
desc: 'Market additional data.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:created_at,
|
||||
format_with: :iso8601,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Market created time in iso8601 format.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:updated_at,
|
||||
format_with: :iso8601,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Market updated time in iso8601 format.'
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
104
app/api/v2/admin/entities/member.rb
Normal file
104
app/api/v2/admin/entities/member.rb
Normal file
@@ -0,0 +1,104 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module API
|
||||
module V2
|
||||
module Admin
|
||||
module Entities
|
||||
class Member < API::V2::Entities::Member
|
||||
expose(
|
||||
:id,
|
||||
documentation: {
|
||||
type: Integer,
|
||||
desc: 'Unique member identifier in database.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:level,
|
||||
documentation: {
|
||||
type: Integer,
|
||||
desc: 'Member\'s level.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:role,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Member\'s role.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:group,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Member\'s group.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:state,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Member\'s state.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:created_at,
|
||||
format_with: :iso8601,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Member created time in iso8601 format.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:updated_at,
|
||||
format_with: :iso8601,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Member updated time in iso8601 format.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:beneficiaries,
|
||||
using: API::V2::Admin::Entities::Beneficiary,
|
||||
documentation: {
|
||||
type: 'API::V2::Admin::Entities::Beneficiary',
|
||||
is_array: true,
|
||||
desc: 'Member Beneficiary.'
|
||||
}
|
||||
) do |m|
|
||||
m.beneficiaries
|
||||
end
|
||||
|
||||
expose(
|
||||
:accounts,
|
||||
using: API::V2::Entities::Account,
|
||||
documentation: {
|
||||
type: 'API::V2::Entities::Account',
|
||||
is_array: true,
|
||||
desc: 'Member accounts.'
|
||||
}
|
||||
) do |m|
|
||||
m.accounts.includes(:currency)
|
||||
end
|
||||
|
||||
expose(
|
||||
:payment_addresses,
|
||||
as: :deposit_addresses,
|
||||
using: API::V2::Entities::PaymentAddress,
|
||||
documentation: {
|
||||
type: 'API::V2::Entities::PaymentAddress',
|
||||
is_array: true,
|
||||
desc: 'Member deposits addresses'
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
94
app/api/v2/admin/entities/operation.rb
Normal file
94
app/api/v2/admin/entities/operation.rb
Normal file
@@ -0,0 +1,94 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module API
|
||||
module V2
|
||||
module Admin
|
||||
module Entities
|
||||
class Operation < API::V2::Entities::Base
|
||||
expose(
|
||||
:id,
|
||||
documentation: {
|
||||
type: Integer,
|
||||
desc: 'Unique operation identifier in database.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:code,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'The Account code which this operation related to.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:currency_id,
|
||||
as: :currency,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Operation currency ID.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:credit,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Operation credit amount.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:debit,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Operation debit amount.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:uid,
|
||||
if: ->(operation) { operation.try(:member).try(:uid) },
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'The shared user ID.'
|
||||
}) { |operation| operation.try(:member).try(:uid) }
|
||||
|
||||
expose(
|
||||
:account_kind,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Operation\'s account kind (locked or main).'
|
||||
}
|
||||
) { |operation| operation.account.kind }
|
||||
|
||||
expose(
|
||||
:reference_id,
|
||||
as: :rid,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'The id of operation reference.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:reference_type,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'The type of operations.'
|
||||
}) { |operation| operation.reference_type.downcase if operation.reference_type.present? }
|
||||
|
||||
expose(
|
||||
:created_at,
|
||||
format_with: :iso8601,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'The datetime when operation was created.'
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
30
app/api/v2/admin/entities/order.rb
Normal file
30
app/api/v2/admin/entities/order.rb
Normal file
@@ -0,0 +1,30 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module API
|
||||
module V2
|
||||
module Admin
|
||||
module Entities
|
||||
class Order < API::V2::Entities::Order
|
||||
unexpose(:trades)
|
||||
|
||||
expose(
|
||||
:email,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'The shared user email.'
|
||||
}
|
||||
) { |w| w.member.email }
|
||||
|
||||
expose(
|
||||
:uid,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'The shared user ID.'
|
||||
}
|
||||
) { |w| w.member.uid }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
33
app/api/v2/admin/entities/refund.rb
Normal file
33
app/api/v2/admin/entities/refund.rb
Normal file
@@ -0,0 +1,33 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module API
|
||||
module V2
|
||||
module Admin
|
||||
module Entities
|
||||
class Refund < API::V2::Entities::Base
|
||||
expose(
|
||||
:id,
|
||||
documentation: {
|
||||
type: Integer,
|
||||
desc: 'The refund id'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:address,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Refund address'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:deposit,
|
||||
using: API::V2::Admin::Entities::Deposit
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
112
app/api/v2/admin/entities/trade.rb
Normal file
112
app/api/v2/admin/entities/trade.rb
Normal file
@@ -0,0 +1,112 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module API
|
||||
module V2
|
||||
module Admin
|
||||
module Entities
|
||||
class Trade < API::V2::Entities::Trade
|
||||
unexpose(:side)
|
||||
unexpose(:order_id)
|
||||
unexpose(:fee_currency)
|
||||
unexpose(:fee)
|
||||
unexpose(:fee_amount)
|
||||
|
||||
expose(
|
||||
:maker_order_email,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Trade maker member email.'
|
||||
}
|
||||
) { |trade| trade.maker.email }
|
||||
|
||||
expose(
|
||||
:maker_uid,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Trade maker member uid.'
|
||||
}
|
||||
) { |trade| trade.maker.uid }
|
||||
|
||||
expose(
|
||||
:maker_fee,
|
||||
documentation: {
|
||||
type: BigDecimal,
|
||||
desc: 'Trade maker fee percentage.',
|
||||
},
|
||||
if: ->(object, options) { options[:extended] }
|
||||
) { |trade| trade.maker_order.maker_fee }
|
||||
|
||||
expose(
|
||||
:maker_fee_amount,
|
||||
documentation: {
|
||||
type: BigDecimal,
|
||||
desc: 'Trade maker fee amount.',
|
||||
}
|
||||
) { |trade| fee_amount(trade, trade.maker_order) }
|
||||
|
||||
expose(
|
||||
:maker_fee_currency,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Trade maker fee currency code.'
|
||||
}
|
||||
) { |trade| fee_currency(trade.maker_order) }
|
||||
|
||||
expose(
|
||||
:maker_order,
|
||||
using: API::V2::Admin::Entities::Order,
|
||||
if: ->(object, options) { options[:extended] }
|
||||
)
|
||||
|
||||
expose(
|
||||
:taker_order_email,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Trade taker member email.'
|
||||
}
|
||||
) { |trade| trade.taker.email }
|
||||
|
||||
expose(
|
||||
:taker_uid,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Trade taker member uid.'
|
||||
}
|
||||
) { |trade| trade.taker.uid }
|
||||
|
||||
expose(
|
||||
:taker_fee_currency,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Trade taker fee currency code.'
|
||||
}
|
||||
) { |trade| fee_currency(trade.taker_order) }
|
||||
|
||||
expose(
|
||||
:taker_fee,
|
||||
documentation: {
|
||||
type: BigDecimal,
|
||||
desc: 'Trade taker fee percentage.',
|
||||
},
|
||||
if: ->(object, options) { options[:extended] }
|
||||
) { |trade| trade.taker_order.taker_fee }
|
||||
|
||||
expose(
|
||||
:taker_fee_amount,
|
||||
documentation: {
|
||||
type: BigDecimal,
|
||||
desc: 'Trade taker fee amount.',
|
||||
}
|
||||
) { |trade| fee_amount(trade, trade.taker_order) }
|
||||
|
||||
expose(
|
||||
:taker_order,
|
||||
using: API::V2::Admin::Entities::Order,
|
||||
if: ->(object, options) { options[:extended] }
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
112
app/api/v2/admin/entities/wallet.rb
Normal file
112
app/api/v2/admin/entities/wallet.rb
Normal file
@@ -0,0 +1,112 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module API
|
||||
module V2
|
||||
module Admin
|
||||
module Entities
|
||||
class Wallet < API::V2::Entities::Base
|
||||
expose(
|
||||
:id,
|
||||
documentation:{
|
||||
type: Integer,
|
||||
desc: 'Unique wallet identifier in database.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:name,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Wallet name.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:kind,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: "Kind of wallet 'deposit','fee','hot','warm' or 'cold'."
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:currency_ids,
|
||||
as: :currencies,
|
||||
documentation: {
|
||||
is_array: true,
|
||||
desc: 'Wallet currency code.',
|
||||
example: -> { ::Currency.visible.codes }
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:address,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Wallet address.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:gateway,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Wallet gateway.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:max_balance,
|
||||
documentation: {
|
||||
type: BigDecimal,
|
||||
desc: 'Wallet max balance.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:balance,
|
||||
documentation: {
|
||||
type: BigDecimal,
|
||||
desc: 'Wallet balance'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:blockchain_key,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Wallet blockchain key.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:status,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Wallet status (active/disabled).'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:created_at,
|
||||
format_with: :iso8601,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Wallet created time in iso8601 format.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:updated_at,
|
||||
format_with: :iso8601,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Wallet updated time in iso8601 format.'
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
69
app/api/v2/admin/entities/whitelisted_smart_contract.rb
Normal file
69
app/api/v2/admin/entities/whitelisted_smart_contract.rb
Normal file
@@ -0,0 +1,69 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module API
|
||||
module V2
|
||||
module Admin
|
||||
module Entities
|
||||
class WhitelistedSmartContract < API::V2::Entities::Base
|
||||
expose(
|
||||
:id,
|
||||
documentation: {
|
||||
type: Integer,
|
||||
desc: 'Unique whitelisted smart contract identifier in database.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:address,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Whitelisted smart contract address.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:description,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Whitelisted smart contract description.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:blockchain_key,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Whitelisted smart contract blockchain key.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:state,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Whitelisted smart contract status (active/disabled).'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:created_at,
|
||||
format_with: :iso8601,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Whitelisted smart contract created time in iso8601 format.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:updated_at,
|
||||
format_with: :iso8601,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Whitelisted smart contract updated time in iso8601 format.'
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
87
app/api/v2/admin/entities/withdraw.rb
Normal file
87
app/api/v2/admin/entities/withdraw.rb
Normal file
@@ -0,0 +1,87 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module API
|
||||
module V2
|
||||
module Admin
|
||||
module Entities
|
||||
class Withdraw < API::V2::Entities::Withdraw
|
||||
expose(
|
||||
:member_id,
|
||||
as: :member,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'The member id.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:beneficiary,
|
||||
using: API::V2::Entities::Beneficiary,
|
||||
if: ->(withdraw, options) do
|
||||
options[:with_beneficiary] && withdraw.beneficiary.present?
|
||||
end
|
||||
)
|
||||
|
||||
expose(
|
||||
:uid,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'The withdrawal member uid.'
|
||||
}
|
||||
) { |w| w.member.uid }
|
||||
|
||||
expose(
|
||||
:email,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'The withdrawal member email.'
|
||||
}
|
||||
) { |w| w.member.email }
|
||||
|
||||
expose(
|
||||
:account,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'The account code.'
|
||||
}
|
||||
) { |w| w.account.id }
|
||||
|
||||
expose(
|
||||
:block_number,
|
||||
documentation: {
|
||||
type: Integer,
|
||||
desc: 'The withdrawal block_number.'
|
||||
},
|
||||
if: ->(w) { w.currency.coin? }
|
||||
)
|
||||
|
||||
expose(
|
||||
:tid,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Withdraw tid.'
|
||||
}
|
||||
)
|
||||
|
||||
expose(
|
||||
:error,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Withdraw error.'
|
||||
},
|
||||
unless: ->(w) { w.succeed? }
|
||||
)
|
||||
|
||||
expose(
|
||||
:metadata,
|
||||
documentation: {
|
||||
type: String,
|
||||
desc: 'Optional metadata to be applied to the transaction.'
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user