Skip to content

Instantly share code, notes, and snippets.

View samschirmer's full-sized avatar

Sam Schirmer samschirmer

View GitHub Profile
@samschirmer
samschirmer / account_searcher.rb
Last active February 8, 2019 15:24
CLI script that accepts email addresses as arguments and parses a CSV of account names/api keys to returns matches within associated Hatchbuck accounts.
#!/usr/bin/env ruby
require 'httparty'
# pulling csv into array so it only needs to be read once
accounts = CSV.open('./keys.csv', headers: :first_row, header_converters: :symbol) { |f| f.map(&:to_h) }
matches = Array.new
ARGV.each do |email|
accounts.each do |a|
payload = { emails: [ address: email ] }.to_json