Sha256: 97a73bcef6495634b6f7ea0b4004df0810e4250841ad7f21b7b7440bf5d46110
Contents?: true
Size: 811 Bytes
Versions: 11
Compression:
Stored size: 811 Bytes
Contents
require_relative './entities/balance' require_relative './entities/order' module Bitstampede class Mapper def initialize end def map_balance(json) Entities::Balance.new(parsed(json)) end def map_orders(json) parsed(json).map{|o| map_order(o) } end def map_order(order) Entities::Order.new(parsed(order)) end def map_cancel(result) parsed(result) == 'true' end private # Allow passing either a String or anything else in. If it's not a string, # we assume we've already parsed it and just give it back to you. This # allows us to handle things like collections more easily. def parsed(json) if(json.is_a?(String)) Bitstampede::Helpers.json_parse(json) else json end end end end
Version data entries
11 entries across 11 versions & 1 rubygems