Module: SquareRails
- Defined in:
- lib/square_rails.rb,
lib/square_rails/engine.rb,
lib/square_rails/version.rb,
app/controllers/square_rails/square_integration_controller.rb
Defined Under Namespace
Classes: Engine, SquareIntegrationController
Constant Summary
collapse
- VERSION =
"0.1.5"
Class Method Summary
collapse
Class Method Details
.get_data_from_square ⇒ Object
33
34
35
36
37
|
# File 'lib/square_rails.rb', line 33
def self.get_data_from_square
= {'Authorization' => 'Bearer ' + @token, 'Accept' => 'application/json', "Content-Type"=> "application/json"}
res = Unirest.get @url, headers:
res.body
end
|
.locations(token) ⇒ Object
9
10
11
12
13
|
# 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) ⇒ Object
27
28
29
30
31
|
# 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) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
|
# 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
|