fbrails 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,4 +1,7 @@
1
1
  source "http://rubygems.org"
2
2
 
3
+
4
+ #gem 'httpclient', '>= 2.2.2'
5
+
3
6
  # Specify your gem's dependencies in fbrails.gemspec
4
7
  gemspec
data/Gemfile~ ADDED
@@ -0,0 +1,7 @@
1
+ source "http://rubygems.org"
2
+
3
+
4
+ gem 'httpclient'
5
+
6
+ # Specify your gem's dependencies in fbrails.gemspec
7
+ gemspec
data/fbrails.gemspec CHANGED
@@ -22,4 +22,6 @@ Gem::Specification.new do |s|
22
22
  # specify any dependencies here; for example:
23
23
  # s.add_development_dependency "rspec"
24
24
  # s.add_runtime_dependency "rest-client"
25
+ #s.add_dependency "httpclient", '>= 2.2.2'
26
+ #s.add_development_dependency "httpclient"
25
27
  end
data/fbrails.gemspec~ ADDED
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "fbrails/version"
4
+
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "fbrails"
8
+ s.version = Fbrails::VERSION
9
+ s.authors = ["Dmitry Gruzd", "Vitaly Mineev", "Ivan Shamatov"]
10
+ s.email = ["donotsendhere@gmail.com"]
11
+ s.homepage = ""
12
+ s.summary = %q{Small gem for auth & getting info from facebook}
13
+ s.description = %q{Small gem for auth & getting info from facebook}
14
+
15
+ s.rubyforge_project = "fbrails"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ # specify any dependencies here; for example:
23
+ # s.add_development_dependency "rspec"
24
+ # s.add_runtime_dependency "rest-client"
25
+ #s.add_dependency "httpclient", '>= 2.2.2'
26
+ s.add_development_dependency "httpclient"
27
+ end
@@ -0,0 +1,34 @@
1
+ module Fbrails
2
+
3
+
4
+
5
+ class FailedToGet < StandardError
6
+ end
7
+ class Parse
8
+ def self.get (url,raw = false)
9
+ # uri = URI.parse(url)
10
+ # http = Net::HTTP.new(uri.host,uri.port)
11
+ # http.use_ssl = true if url =~ /^https/
12
+ # http.verify_mode = OpenSSL::SSL::VERIFY_NONE if url =~ /^https/
13
+ # request = Net::HTTP::Get.new(uri.request_uri)
14
+ # resp = http.request(request).body
15
+ resp = HTTPClient.new.get_content(url)
16
+ if raw
17
+ return resp
18
+ end
19
+ result = JSON.parse(resp)
20
+ if result.has_key?("error")
21
+ raise FailedToGet, "Failed to get, probably token expired"
22
+ else
23
+ return result
24
+ end
25
+ end
26
+
27
+ def self.put(url)
28
+
29
+ end
30
+
31
+
32
+
33
+ end
34
+ end
@@ -1,3 +1,3 @@
1
1
  module Fbrails
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/fbrails.rb CHANGED
@@ -2,32 +2,39 @@ require "fbrails/version"
2
2
  require 'net/https'
3
3
  require 'json'
4
4
 
5
+
5
6
  module Fbrails
7
+
6
8
  class FailedToGet < StandardError
7
9
  end
8
-
9
-
10
- def self.get (url,raw = false)
10
+ def self.get (url,raw = false)
11
11
  uri = URI.parse(url)
12
12
  http = Net::HTTP.new(uri.host,uri.port)
13
13
  http.use_ssl = true if url =~ /^https/
14
14
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE if url =~ /^https/
15
15
  request = Net::HTTP::Get.new(uri.request_uri)
16
- resp = http.request(request)
17
- if raw
18
- return resp.body
19
- end
20
- result = JSON.parse(resp.body)
21
- if result.has_key?("error")
22
- raise FailedToGet, "Failed to get, probably token expired"
23
- else
24
- return result
25
- end
16
+ resp = http.request(request).body
17
+ # resp = HTTPClient.new.get_content(url)
18
+ if raw
19
+ return resp
20
+ end
21
+ result = JSON.parse(resp)
22
+ if result.has_key?("error")
23
+ raise FailedToGet, "Failed to get, probably token expired"
24
+ else
25
+ return result
26
+ end
26
27
  end
27
28
 
28
29
  def self.put(url)
29
30
 
30
- end
31
+ end
32
+
33
+
34
+
35
+
36
+
37
+
31
38
 
32
39
  require 'fbrails/auth'
33
40
 
data/lib/fbrails.rb~ ADDED
@@ -0,0 +1,44 @@
1
+ require "fbrails/version"
2
+ require 'net/https'
3
+ require 'json'
4
+
5
+
6
+ module Fbrails
7
+
8
+ class FailedToGet < StandardError
9
+ end
10
+ class Parse
11
+ def self.get (url,raw = false)
12
+ uri = URI.parse(url)
13
+ http = Net::HTTP.new(uri.host,uri.port)
14
+ http.use_ssl = true if url =~ /^https/
15
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE if url =~ /^https/
16
+ request = Net::HTTP::Get.new(uri.request_uri)
17
+ resp = http.request(request).body
18
+ # resp = HTTPClient.new.get_content(url)
19
+ if raw
20
+ return resp
21
+ end
22
+ result = JSON.parse(resp)
23
+ if result.has_key?("error")
24
+ raise FailedToGet, "Failed to get, probably token expired"
25
+ else
26
+ return result
27
+ end
28
+ end
29
+
30
+ def self.put(url)
31
+
32
+ end
33
+
34
+
35
+
36
+ end
37
+
38
+
39
+
40
+ require 'fbrails/auth'
41
+
42
+ require 'fbrails/graph'
43
+
44
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fbrails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -22,12 +22,16 @@ extra_rdoc_files: []
22
22
  files:
23
23
  - .gitignore
24
24
  - Gemfile
25
+ - Gemfile~
25
26
  - README
26
27
  - Rakefile
27
28
  - fbrails.gemspec
29
+ - fbrails.gemspec~
28
30
  - lib/fbrails.rb
31
+ - lib/fbrails.rb~
29
32
  - lib/fbrails/auth.rb
30
33
  - lib/fbrails/graph.rb
34
+ - lib/fbrails/parse.rb~
31
35
  - lib/fbrails/version.rb
32
36
  homepage: ''
33
37
  licenses: []