diffbot_client 1.0.0

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.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YjJlZjEzZTA0ZGY4MzkzMGU3MzM3NDVmNGQ3ZmVmZTVmMDRkNWRkNg==
5
+ data.tar.gz: !binary |-
6
+ NzVlMjExNDIxMzk0Y2M1OWE0MTJiNmY3MzQ2Nzk1ZjU2M2E2YzM2Nw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NWZhMjE1MzE5ZGVkNDJjMmNkZDMyZTc0M2NiNWJjMTM1ZGM2YmE0NTVhMjI5
10
+ NzQwOGYxYmEyYWM2M2U0ZGMyOGI0OWZmNDA1YjA0NzEyZDNkYmY1YzA0NTQz
11
+ YzZlNDdjMmZhMDJiODFiZjU3YTllYzJjYWY1MDkzOTFhODBiODQ=
12
+ data.tar.gz: !binary |-
13
+ MDU2Zjc4MDk3OTE3NWQ1YmIxYzhjZTdjM2ZlYTQ4ODE1OGVkODIwZWQxN2U3
14
+ YTVjODNjN2I5YWFjNWNhNDc5NzAyOWNhMjU4ZDhlZDgyNjMyYTgxZDY0NGNl
15
+ ZTkxYmQ1NzlmMjRhNTEwMmY5ODdlMjAwZmQ1YzJhYmZhODljYjY=
@@ -0,0 +1 @@
1
+ require "diffbot_client/article.rb"
@@ -0,0 +1,29 @@
1
+ require 'httparty'
2
+ require 'json'
3
+ module DiffbotClient
4
+ class Article
5
+ include HTTParty
6
+ self.base_uri 'http://api.diffbot.com'
7
+
8
+ def get(options)
9
+ options = {:query => {:token => 'b395cbccaede5e80b564633092bda889'}.merge!(options)}
10
+ unless error_response = invalid_params?(options[:query])
11
+ response = self.class.get('/v2/article',options)
12
+ if response.success?
13
+ JSON.parse(response.body)
14
+ else
15
+ JSON.parse({:error => "Failed to fetch the content from the url", :errorCode => 500})
16
+ end
17
+ else
18
+ JSON.parse(error_response)
19
+ end
20
+ end
21
+
22
+ def invalid_params?(options)
23
+ error_message = nil
24
+ error_message = {:error => "Not authorized API token.",:errorCode => 401} if options[:token].nil?
25
+ error_message = {:error => "Missing url query string argument",:errorCode => 500} if options[:url].nil?
26
+ error_message
27
+ end
28
+ end
29
+ end
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: diffbot_client
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Mitesh Jain
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: A simple diffbot client lib
42
+ email: mitijain123@gmail.com
43
+ executables: []
44
+ extensions: []
45
+ extra_rdoc_files: []
46
+ files:
47
+ - lib/diffbot_client/article.rb
48
+ - lib/diffbot_client.rb
49
+ homepage: http://rubygems.org/gems/diffbot_client
50
+ licenses:
51
+ - MIT
52
+ metadata: {}
53
+ post_install_message:
54
+ rdoc_options: []
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ requirements: []
68
+ rubyforge_project:
69
+ rubygems_version: 2.1.11
70
+ signing_key:
71
+ specification_version: 4
72
+ summary: Diffbot Client!
73
+ test_files: []