module SquareRails
Constants
- VERSION
Public Class Methods
get_data_from_square()
click to toggle source
# File lib/square_rails.rb, line 33 def self.get_data_from_square headers = {'Authorization' => 'Bearer ' + @token, 'Accept' => 'application/json', "Content-Type"=> "application/json"} res = Unirest.get @url, headers: headers res.body end
locations(token)
click to toggle source
TODO: error handling
# File lib/square_rails.rb, line 9 def self.locations(token) @url = "#{SQUARE_CONNECT_HOST}/v1/me/locations" @token = token self.get_data_from_square end
merchant(token)
click to toggle source
# File lib/square_rails.rb, line 27 def self.merchant(token) @url = "#{SQUARE_CONNECT_HOST}/v1/me" @token = token self.get_data_from_square end
payments(token,location)
click to toggle source
# File lib/square_rails.rb, line 15 def self.payments(token,location) if location.is_a?(Hash) loc_id = location['id'] else loc_id = location end @url = "#{SQUARE_CONNECT_HOST}/v1/#{loc_id}/payments" @token =token self.get_data_from_square end