urbanesia 0.0.1.3 → 0.0.1.4
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.
- data/lib/urbanesia/agent.rb +2 -2
- data/lib/urbanesia.rb +12 -6
- metadata +1 -1
data/lib/urbanesia/agent.rb
CHANGED
@@ -4,10 +4,10 @@ module Urbanesia
|
|
4
4
|
|
5
5
|
def initialize(consumer_key, consumer_secret, base_url)
|
6
6
|
|
7
|
-
raise ArgumentError, "Missing Consumer Key" if consumer_key.nil? or consumer_key == 0
|
7
|
+
raise ArgumentError, "Missing Consumer Key: Add Urbanesia.consumer_key = 'your-key-here' to an initializer" if consumer_key.nil? or consumer_key == 0
|
8
8
|
@consumer_key = consumer_key
|
9
9
|
|
10
|
-
raise ArgumentError, "Missing Consumer Secret" if consumer_secret.nil? or consumer_secret == 0
|
10
|
+
raise ArgumentError, "Missing Consumer Secret: Add Urbanesia.consumer_secret = 'your-secret-here' to an initializer" if consumer_secret.nil? or consumer_secret == 0
|
11
11
|
@consumer_secret = consumer_secret
|
12
12
|
|
13
13
|
@base_url = base_url || "http://api1.urbanesia.com/"
|
data/lib/urbanesia.rb
CHANGED
@@ -6,12 +6,18 @@ module Urbanesia
|
|
6
6
|
mattr_accessor :consumer_secret
|
7
7
|
mattr_accessor :base_url
|
8
8
|
|
9
|
-
#
|
9
|
+
# Makes a request to the API.
|
10
10
|
#
|
11
|
-
# @param [
|
12
|
-
# @
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
# @param [String] endpoint API endpoint according to the API docs, eg "get/super_search"
|
12
|
+
# @param [String] post Any required post variables, eg "year=2011"
|
13
|
+
# @param [String] get Any required get variables, eg "what=culinary&where=jakarta&row=1&offset=1000"
|
14
|
+
# @return [String] response The output of a Mechanize agent.post to the API endpoint
|
15
|
+
def request( endpoint = "get/super_search", post = "", get = "" )
|
16
|
+
|
17
|
+
@@agent = Agent.new(@@consumer_key, @@consumer_secret, @@base_url) if @@agent.nil?
|
18
|
+
|
19
|
+
p @@agent.hi
|
20
|
+
|
16
21
|
end
|
22
|
+
|
17
23
|
end
|