This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[3] pry(main)> batch_res = client.read_batch(2582427) | |
=> {"content_created"=>nil, | |
"children_ids"=>[2591014], | |
"reject_reasons"=>[], | |
"is_digitized"=>false, | |
"related_job_id"=>nil, | |
"created_with"=>"auto", | |
=> {"content_created"=>nil, | |
"children_ids"=>[2591014], | |
"reject_reasons"=>[], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
report: 'Packet Report', | |
tabs: { | |
1: { | |
name: 'Packet Information', | |
columnNames: ['organization', 'packet_name', 'status', 'total_forms', 'created_at', 'collection_date', 'days_since_collection'] | |
}, | |
2: { | |
name: 'Data entry', | |
columnNames: ['organization', 'packet_name', 'packet_upload_date', 'staff', 'data_entry_completed'] | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "base64" | |
require 'net/http' | |
require 'json' | |
# Base 64 the input image | |
b64_data = Base64.encode64(File.open(ARGV[0], "rb").read) | |
# Stuff we need | |
api_key = "<YOUR_GOOGLE_API_KEY>" | |
content_type = "Content-Type: application/json" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def update_card(subscription_params) | |
customer = Stripe::Customer.retrieve(self.stripe_customer_token) | |
card = customer.sources.create(source: subscription_params[:stripe_card_token]) | |
card.save | |
customer.default_source = card.id | |
customer.save | |
rescue Stripe::InvalidRequestError => e | |
logger.error "Stripe error while updating card info: #{e.message}" | |
errors.add :base, "#{e.message}" | |
false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.from_omniauth(auth, ref) | |
where(provider: auth.provider, uid: auth.uid).first_or_create do |user| | |
user.email = "#{auth.info.nickname}@twitter.com" | |
user.password = Devise.friendly_token[0,20] | |
user.username = auth.info.nickname # assuming the user model has a name | |
user.referrer_token = ref.to_s | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby -run -e httpd . -p5000 |