fsquare 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/fsquare/version.rb +1 -1
- data/lib/fsquare.rb +8 -22
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e30a8229e5a3a223879b232b2c9b0fd2912fe0a0
|
|
4
|
+
data.tar.gz: a69acf448b1f367e1f76f170d067955b302879fe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3d854e4a3c3e88e9213e90e7f0448186561895a5a444507ebf7bf50160c8bab8b14ef3ffbb6d84a420f99f21a6f6abb3a175ab832f41ad1104c074725145ab21
|
|
7
|
+
data.tar.gz: a5c1a21b02486e6e2ebf33e26701181a59347bcba7517deb31c492e1013482df9382e18764f7cc926283d0e65da77040a1dc1d296e7cdbd051ac48727cd7d15a
|
data/lib/fsquare/version.rb
CHANGED
data/lib/fsquare.rb
CHANGED
|
@@ -1,22 +1,12 @@
|
|
|
1
1
|
require "fsquare/version"
|
|
2
2
|
|
|
3
3
|
module Fsquare
|
|
4
|
-
@@
|
|
5
|
-
@@
|
|
4
|
+
@@clientId = nil
|
|
5
|
+
@@clientSecret = nil
|
|
6
6
|
|
|
7
|
-
def self.
|
|
8
|
-
@@
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def self.get_client_id
|
|
12
|
-
return @@client_id
|
|
13
|
-
end
|
|
14
|
-
def self.set_client_secret(clientSecret)
|
|
15
|
-
@@client_secret = clientSecret
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def self.get_client_secret
|
|
19
|
-
return @@client_secret
|
|
7
|
+
def self.initialize(clientId, clientSecret)
|
|
8
|
+
@@clientId = clientId
|
|
9
|
+
@@clientSecret = clientSecret
|
|
20
10
|
end
|
|
21
11
|
|
|
22
12
|
def self.request_data(path, data)
|
|
@@ -24,14 +14,10 @@ module Fsquare
|
|
|
24
14
|
Rails.cache.fetch(cacheKey, :expires => 24.hour) do
|
|
25
15
|
v = currentTime.strftime "%Y%m%d"
|
|
26
16
|
|
|
27
|
-
clientId
|
|
28
|
-
|
|
29
|
-
raise "client_id is not defined. Please call set_client_id()"
|
|
30
|
-
end
|
|
31
|
-
if clientSecret.nil?
|
|
32
|
-
raise "client_secret is not defined. Please call set_client_secret()"
|
|
17
|
+
if @@clientId.nil? || @clientSecret.nil?
|
|
18
|
+
raise "client_id or client_secret is not defined. Please call initialize()"
|
|
33
19
|
end
|
|
34
|
-
search_url = "https://api.foursquare.com#{path}&client_id=#{clientId}&client_secret=#{@@clientSecret}&" + JSON.parse(data)
|
|
20
|
+
search_url = "https://api.foursquare.com#{path}&client_id=#{@@clientId}&client_secret=#{@@clientSecret}&" + JSON.parse(data)
|
|
35
21
|
result = HTTParty.get(search_url)
|
|
36
22
|
result['response']
|
|
37
23
|
end
|