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
| window.location.href = <%= root_url %> |
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
| class BankacctsController < ApplicationController | |
| def addbank | |
| @account_uri = (params['account_uri']) | |
| current_user.customer_uri = @account_uri | |
| current_user.save! | |
| 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
| def current_path | |
| current_url = request.original_url | |
| end_of_string = current_url.length | |
| regex_index = (Rails.env.production?) ? /.\.com\// : /:\d\d\d\d\// | |
| regex_after_index = (regex_index =~ current_url) + 5 # production 7 | |
| path= end_of_string - regex_after_index | |
| if path == 0 | |
| "/" | |
| else | |
| current_url[-path..-1] |
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 render_option(url_options) | |
| custom_render = false | |
| url_options[:custom][:urls].each do |url| | |
| if current_path == url | |
| custom_render = true | |
| break | |
| elsif [current_path] == url_options[:custom][:other_urls] | |
| custom_render = "other" | |
| break | |
| elsif [current_path] == ["/articles"] or current_path[0,17] == "/carbon_projects/" or current_path[0,10] == "/articles/" |
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 create_button(id) | |
| button = { | |
| :name => 'test', | |
| :type => 'buy_now', | |
| :price_string => '1.23', | |
| :price_currency_iso => "USD", | |
| :custom => 'Order123', | |
| :callback_url => 'http://www.example.com/my_custom_button_callback', | |
| :description => 'sample description', | |
| :style => 'custom_large', |
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
| uri = URI.parse("https://coinbase.com/api/v1/buttons") | |
| button = { :name => 'test', :type => 'buy_now', :description => 'sample description', :include_email => true } | |
| http = Net::HTTP.new(uri.host, uri.port) | |
| http.use_ssl = true | |
| http.verify_mode = OpenSSL::SSL::VERIFY_NONE | |
| response = Net::HTTP.post_form(uri,button) | |
| response | |
| #<Net::HTTPBadRequest 400 Bad Request readbody=true> |
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
| uri = URI.parse("https://coinbase.com/api/v1/buttons") | |
| http = Net::HTTP.new(uri.host, uri.port) | |
| http.use_ssl = true | |
| http.verify_mode = OpenSSL::SSL::VERIFY_NONE | |
| request = Net::HTTP::Post.new(uri.request_uri) | |
| request.add_field('Content-Type', 'application/json') | |
| button = { :name => 'test', :type => 'buy_now', :description => 'sample description', :include_email => true } | |
| request.body = button.to_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
| uri = URI.parse("https://coinbase.com/api/v1/buttons") | |
| http = Net::HTTP.new(uri.host, uri.port) | |
| http.use_ssl = true | |
| http.verify_mode = OpenSSL::SSL::VERIFY_NONE | |
| request = Net::HTTP::Post.new(uri.request_uri) | |
| request.add_field('Content-Type', 'application/json') | |
| button = { :name => 'test', :type => 'buy_now', :description => 'sample description', :include_email => true } | |
| request.body = button.to_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
| @API_KEY = 'asdfghj' | |
| @API_SECRET = 'asdfghjklfrgh' | |
| def get_http(url, body=nil) | |
| @nonce = (Time.now.to_f * 1e6).to_i | |
| @message = @nonce.to_s + url + body.to_s | |
| @signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest::Digest.new('sha256'), @API_SECRET, @message) | |
| @headers = {"ACCESS_KEY" => @API_KEY, "ACCESS_SIGNATURE" => @signature, "ACCESS_NONCE" => @nonce} | |
| begin | |
| if body.nil? |
OlderNewer