rfgraph 0.2 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +12 -13
  2. data/lib/rfgraph/request.rb +2 -2
  3. metadata +2 -2
data/README.md CHANGED
@@ -16,6 +16,16 @@ gem install rfgraph
16
16
  Example
17
17
  -------
18
18
 
19
+ Without auth token
20
+
21
+ require 'rfgraph'
22
+ req = RFGraph::Request.new
23
+ req.get_object("19292868552")
24
+ req.get_object("99394368305/photos")
25
+ req.get_object("331218348435", "metadata" => "1")
26
+
27
+ With auth token
28
+
19
29
  require 'rfgraph'
20
30
  fauth = RFGraph::Auth.new(APP_ID, APP_SECRET)
21
31
 
@@ -25,21 +35,10 @@ Example
25
35
  # Get the code that facebook returns after the user auths your app and turn that into a auth token
26
36
  auth_token = fauth.authorize("http://yourwebsite.com/callback", FACEBOOK_CODE)
27
37
 
28
- # Make some requests
38
+ # Make some requests, auth token is only required if you are doing requests that need it.
29
39
  request = RFGraph::Request.new(auth_token)
30
40
  request.get_object("me")
31
-
32
- # Returns something like
33
- #{
34
- # "id" => "57373737593",
35
- # "name" => "Some User",
36
- # "first_name" => "Some",
37
- # "last_name" => "User",
38
- # "link" => "http://www.facebook.com/someuser",
39
- # "timezone" => -4,
40
- # "verified" => true,
41
- # "updated_time" => "2010-03-30T01:27:19+0000"
42
- # }
41
+ request.get_object("me/friends")
43
42
 
44
43
  request.put_wall_post("Awesome message!")
45
44
 
@@ -57,14 +57,14 @@ module RFGraph
57
57
  end
58
58
  end
59
59
 
60
- encoded_url_args = url_args.collect {|k,v| "#{CGI.escape k}=#{CGI.escape v}" }.join("&")
60
+ encoded_url_args = url_args.collect {|k,v| "#{CGI.escape k.to_s}=#{CGI.escape v.to_s}" }.join("&")
61
61
  url = URI.parse("#{BASE_URL}/#{path}?#{encoded_url_args}")
62
62
  http = Net::HTTP.new(url.host, url.port)
63
63
  http.use_ssl = true
64
64
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
65
65
 
66
66
  response = if post_args
67
- encoded_post_args = post_args.collect {|k,v| "#{CGI.escape k}=#{CGI.escape v}" }.join("&")
67
+ encoded_post_args = post_args.collect {|k,v| "#{CGI.escape k.to_s}=#{CGI.escape v.to_s}" }.join("&")
68
68
  http.post("#{url.path}?#{url.query}", encoded_post_args)
69
69
  else
70
70
  http.get("#{url.path}?#{url.query}")
metadata CHANGED
@@ -4,8 +4,8 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
8
- version: "0.2"
7
+ - 3
8
+ version: "0.3"
9
9
  platform: ruby
10
10
  authors:
11
11
  - Conor Hunt