share_checker 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,5 +1,7 @@
1
1
  source "http://rubygems.org"
2
2
 
3
+ gemspec
4
+
3
5
  gem "activesupport"
4
6
  gem "i18n"
5
7
  gem "crack"
@@ -14,7 +14,15 @@ module ShareChecker
14
14
  autoload :Tweetracker, 'share_checker/providers/tweetracker'
15
15
 
16
16
  def self.get(provider)
17
- "ShareChecker::Providers::#{provider.to_s.classify}".constantize
17
+ case provider.to_s.downcase
18
+ when "facebook" then ShareChecker::Providers::Facebook
19
+ when "twitter" then ShareChecker::Providers::Twitter
20
+ when "vkontakte" then ShareChecker::Providers::Vkontakte
21
+ when "odnoklassniki" then ShareChecker::Providers::Odnoklassniki
22
+ when "tweetracker" then ShareChecker::Providers::Tweetracker
23
+ else
24
+ "ShareChecker::Providers::#{provider.to_s.classify}".constantize
25
+ end
18
26
  end
19
27
 
20
28
  def self.avariable
@@ -1,5 +1,6 @@
1
1
  require 'curb'
2
- require 'crack'
2
+ require 'multi_xml'
3
+ require 'multi_json'
3
4
 
4
5
  module ShareChecker
5
6
  class Provider
@@ -28,7 +29,7 @@ module ShareChecker
28
29
 
29
30
  def parse_xml(body)
30
31
  begin
31
- content = Crack::XML.parse(body)
32
+ content = MultiXml.parse(body)
32
33
  rescue Exception => e
33
34
  puts "#{@name} error parse xml: #{body}, #{e.message}, #{@link}"
34
35
  content = nil
@@ -39,7 +40,7 @@ module ShareChecker
39
40
 
40
41
  def parse_json(body)
41
42
  begin
42
- content = Crack::JSON.parse(body)
43
+ content = MultiJson.decode(body)
43
44
  rescue Exception => e
44
45
  puts "#{@name} error parse xml: #{body}, #{e.message}, #{@link}"
45
46
  content = nil
@@ -1,3 +1,5 @@
1
+ require 'nokogiri'
2
+
1
3
  module ShareChecker
2
4
  module Providers
3
5
  class Tweetracker < Provider
@@ -1,5 +1,3 @@
1
- require 'crack/json'
2
-
3
1
  module ShareChecker
4
2
  module Providers
5
3
  class Twitter < Provider
@@ -1,3 +1,3 @@
1
1
  module ShareChecker
2
- VERSION = "0.1.6".freeze
2
+ VERSION = "0.1.7".freeze
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: share_checker
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 6
10
- version: 0.1.6
9
+ - 7
10
+ version: 0.1.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Igor Galeta
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-11-02 00:00:00 +02:00
19
+ date: 2011-11-03 00:00:00 +02:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -34,7 +34,7 @@ dependencies:
34
34
  type: :runtime
35
35
  version_requirements: *id001
36
36
  - !ruby/object:Gem::Dependency
37
- name: crack
37
+ name: multi_json
38
38
  prerelease: false
39
39
  requirement: &id002 !ruby/object:Gem::Requirement
40
40
  none: false
@@ -48,7 +48,7 @@ dependencies:
48
48
  type: :runtime
49
49
  version_requirements: *id002
50
50
  - !ruby/object:Gem::Dependency
51
- name: nokogiri
51
+ name: multi_xml
52
52
  prerelease: false
53
53
  requirement: &id003 !ruby/object:Gem::Requirement
54
54
  none: false
@@ -62,7 +62,7 @@ dependencies:
62
62
  type: :runtime
63
63
  version_requirements: *id003
64
64
  - !ruby/object:Gem::Dependency
65
- name: curb
65
+ name: nokogiri
66
66
  prerelease: false
67
67
  requirement: &id004 !ruby/object:Gem::Requirement
68
68
  none: false
@@ -75,6 +75,20 @@ dependencies:
75
75
  version: "0"
76
76
  type: :runtime
77
77
  version_requirements: *id004
78
+ - !ruby/object:Gem::Dependency
79
+ name: curb
80
+ prerelease: false
81
+ requirement: &id005 !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ hash: 3
87
+ segments:
88
+ - 0
89
+ version: "0"
90
+ type: :runtime
91
+ version_requirements: *id005
78
92
  description: Insert ShareChecker description.
79
93
  email: galeta.igor@gmail.com
80
94
  executables: []