Skip to content

Instantly share code, notes, and snippets.

@shal
Created August 12, 2019 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shal/a544533b096e0777621e664f4de21f04 to your computer and use it in GitHub Desktop.
Save shal/a544533b096e0777621e664f4de21f04 to your computer and use it in GitHub Desktop.
Import users generated by barong rake task to peatio
#!/usr/bin/env ruby
# Author: Ali Shanaakh <hi@shal.dev>
# Usage: import_members.rb --path=users.yml
require 'optparse'
options = {}
option_parser = OptionParser.new do |opts|
opts.banner = 'Usage: import_members.rb [options]'
opts.on '-path', '--path=PATH', String
end
option_parser.parse!(into: options)
path = File.join(__dir__, options[:path])
members = YAML::load_file(path)
members.each do |user|
member = Member.create!(uid: user['uid'], email: user['email'], level: 3, role: 'admin', state: 'active')
Currency.fiats.each do |currency|
Deposits::Fiat.create!(member_id: member.id, currency_id: currency.id, amount: 10000000).tap(&:accept!)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment