Skip to content

Instantly share code, notes, and snippets.

Last active Jan 1, 2016
What would you like to do?
Ideal implementation of TradeAPI - factors out details of retrieving key/secret
#! /usr/bin/env ruby
class TradeAPI
attr_accessor :key
attr_accessor :secret
def initialize(key, secret)
@key = key
@secret = secret
unless @key && @secret
# throw exception, key and secret must be set
raise ArgumentError, "Both key and secret must be set."
#t1 =
t2 ='keyisthekey', 'übersecret')
puts "t2 key = #{t2.key}"
puts "t2 secret = #{t2.secret}"
t2.key = 'GrandMasterKey!'
puts "t2 key = #{t2.key}"
puts "t2 secret = #{t2.secret}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment