urbanesia 0.0.1.3 → 0.0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/urbanesia/agent.rb +2 -2
  2. data/lib/urbanesia.rb +12 -6
  3. metadata +1 -1
@@ -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
- # Outputs either the key or the secret depending on the input
9
+ # Makes a request to the API.
10
10
  #
11
- # @param [Symbol] input variable to be printed, ':key' or any other value
12
- # @return [String] The printed variable
13
- def self.hi(input = :key)
14
- agent = Agent.new(@@consumer_key, @@consumer_secret, @@base_url)
15
- p agent.hi(input)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: urbanesia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.3
4
+ version: 0.0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: