tumblr-fu 0.1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +7 -0
  3. data/Rakefile +0 -0
  4. data/lib/tumblr.rb +31 -0
  5. metadata +64 -0
@@ -0,0 +1,20 @@
1
+ Copyright 2012 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,7 @@
1
+ tumblr-fu
2
+ =========
3
+ A lightweight wrapper for Tumblr API
4
+
5
+
6
+ Specs comming soon...
7
+
File without changes
@@ -0,0 +1,31 @@
1
+ require 'oauth'
2
+ require 'open-uri'
3
+ require 'json'
4
+
5
+ module Tumblr
6
+ class Client
7
+ def initialize(opts = {})
8
+ @consumer_key = opts.delete(:consumer_key)
9
+ consumer_secret = opts.delete(:consumer_secret)
10
+ oauth_token = opts.delete(:oauth_token)
11
+ oauth_token_secret = opts.delete(:oauth_token_secret)
12
+ @consumer = OAuth::Consumer.new(@consumer_key, consumer_secret,
13
+ {:site => "http://www.tumblr.com/"})
14
+ token_hash = {:oauth_token => oauth_token,
15
+ :oauth_token_secret => oauth_token_secret}
16
+ @access_token = OAuth::AccessToken.from_hash(@consumer, token_hash)
17
+ end
18
+
19
+ def info(hostname)
20
+ JSON.parse open("http://api.tumblr.com/v2/blog/#{hostname}/info?api_key=#{@consumer_key}").read
21
+ end
22
+
23
+ def followers(hostname)
24
+ response = @access_token.get("http://api.tumblr.com/v2/blog/#{hostname}/followers")
25
+ JSON.parse(response.body)
26
+ end
27
+
28
+ private
29
+
30
+ end
31
+ end
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tumblr-fu
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Mooch
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-12-07 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: oauth
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.4.7
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.4.7
30
+ description: ''
31
+ email:
32
+ executables: []
33
+ extensions: []
34
+ extra_rdoc_files: []
35
+ files:
36
+ - lib/tumblr.rb
37
+ - MIT-LICENSE
38
+ - Rakefile
39
+ - README.rdoc
40
+ homepage: https://github.com/mooch
41
+ licenses: []
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ requirements: []
59
+ rubyforge_project:
60
+ rubygems_version: 1.8.24
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: A Wrapper Tumbler API V2
64
+ test_files: []