tumble 0.0.8 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE.md +7 -0
- data/README.md +50 -0
- data/lib/tumble/blog.rb +11 -11
- data/lib/tumble.rb +1 -1
- data/tumble.gemspec +2 -1
- metadata +11 -10
data/LICENSE.md
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright (c) 2012 Aubrey Holland
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,2 +1,52 @@
|
|
1
1
|
# Tumble #
|
2
|
+
A Ruby wrapper for the v2 of Tumblr's API, supporting all endpoints.
|
3
|
+
|
4
|
+
## <a name="installation"></a>Install
|
5
|
+
gem install tumble
|
6
|
+
|
7
|
+
## <a name="configuration"></a>Configure
|
8
|
+
|
9
|
+
The gem is designed to work with Tumblr's OAuth provider for authentication. If you're using omniauth,
|
10
|
+
there's a fine adapter available [here](https://github.com/aub/omniauth-tumblr2). You'll also need to
|
11
|
+
register your app [here](http://www.tumblr.com/oauth/apps) in order to get a consumer key and secret.
|
12
|
+
Once you have those values, you can configure Tumble in an initializer like so:
|
13
|
+
|
14
|
+
require 'tumble'
|
15
|
+
|
16
|
+
Tumble.configure do |tumble|
|
17
|
+
tumble.consumer_key = config['tumblr']['key']
|
18
|
+
tumble.consumer_secret = config['tumblr']['secret']
|
19
|
+
end
|
20
|
+
|
21
|
+
## <a name="usage"></a>Use
|
22
|
+
|
23
|
+
Connections can then be made by creating a client, passing the OAuth token and secret you get back from
|
24
|
+
omniauth:
|
25
|
+
|
26
|
+
client = Tumble::Client.new(access_token, access_secret)
|
27
|
+
|
28
|
+
User-related endpoints can be accessed through the client directly, as documented [here](http://rdoc.info/github/aub/tumble/Tumble/Client).
|
29
|
+
For example:
|
30
|
+
|
31
|
+
client.user_info
|
32
|
+
|
33
|
+
All methods will return a Hashie::Mash of the results. For data about blogs and posts, use the blog() method on
|
34
|
+
the client, passing the name of the blog. The methods for blogs are documented [here](http://rdoc.info/github/aub/tumble/Tumble/Blog).
|
35
|
+
For example, getting posts for a specific blog can be done like this:
|
36
|
+
|
37
|
+
client.blog('www.riotprojects.com').posts
|
38
|
+
|
39
|
+
Most of the calls allow for options to be passed, as a hash. Options are documented in the links above and are consistent
|
40
|
+
with the naming and functionality described in the [Tumblr docs](https://github.com/aub/omniauth-tumblr2).
|
41
|
+
|
42
|
+
## <a name="documentation"></a>Learn
|
43
|
+
[http://rdoc.info/github/aub/tumble][documentation]
|
44
|
+
|
45
|
+
[documentation]: http://rdoc.info/github/aub/tumble
|
46
|
+
|
47
|
+
## <a name="copyright"></a>Copyright
|
48
|
+
Copyright (c) 2012 Aubrey Holland
|
49
|
+
See [LICENSE][] for details.
|
50
|
+
|
51
|
+
[license]: https://github.com/aub/tumble/blob/master/LICENSE.md
|
2
52
|
|
data/lib/tumble/blog.rb
CHANGED
@@ -13,7 +13,7 @@ module Tumble
|
|
13
13
|
# @see http://www.tumblr.com/docs/en/api/v2#blog-info
|
14
14
|
# @requires_authentication Yes
|
15
15
|
def info
|
16
|
-
@connection.get("/blog/#{name}/info")
|
16
|
+
@connection.get("/blog/#{name}/info").response
|
17
17
|
end
|
18
18
|
|
19
19
|
# You can get a blog's avatar in 9 different sizes. The default size is 64x64.
|
@@ -24,7 +24,7 @@ module Tumble
|
|
24
24
|
# @param options [Hash] A customizable set of options.
|
25
25
|
# @option options [Integer] :size The size of the avatar. Must be in 16, 24, 30, 40, 48, 64, 96, 128, or 512
|
26
26
|
def avatar(options={})
|
27
|
-
@connection.get("/blog/#{name}/avatar", options)
|
27
|
+
@connection.get("/blog/#{name}/avatar", options).response
|
28
28
|
end
|
29
29
|
|
30
30
|
# Retrieve a Blog's Followers
|
@@ -36,7 +36,7 @@ module Tumble
|
|
36
36
|
# @option options [Integer] :limit The number of results to return: 1–20, inclusive
|
37
37
|
# @option options [Integer] :offset Result to start at
|
38
38
|
def followers(options={})
|
39
|
-
@connection.get("/blog/#{name}/followers", options)
|
39
|
+
@connection.get("/blog/#{name}/followers", options).response
|
40
40
|
end
|
41
41
|
|
42
42
|
# Retrieve Published Posts
|
@@ -54,7 +54,7 @@ module Tumble
|
|
54
54
|
# @option options [Boolean] :notes_info Indicates whether to return notes information (specify true or false). Returns note count and note metadata.
|
55
55
|
# @option options [String] :format Specifies the post format to return, other than HTML. Must be either text or raw.
|
56
56
|
def posts(options={})
|
57
|
-
@connection.get("/blog/#{name}/posts", options)
|
57
|
+
@connection.get("/blog/#{name}/posts", options).response
|
58
58
|
end
|
59
59
|
|
60
60
|
# Retrieve Queued Posts
|
@@ -62,7 +62,7 @@ module Tumble
|
|
62
62
|
# @see http://www.tumblr.com/docs/en/api/v2#blog-queue
|
63
63
|
# @requires_authentication Yes
|
64
64
|
def queue
|
65
|
-
@connection.get("/blog/#{name}/posts/queue")
|
65
|
+
@connection.get("/blog/#{name}/posts/queue").response
|
66
66
|
end
|
67
67
|
|
68
68
|
# Retreive Draft Posts
|
@@ -70,7 +70,7 @@ module Tumble
|
|
70
70
|
# @see http://www.tumblr.com/docs/en/api/v2#blog-drafts
|
71
71
|
# @requires_authentication Yes
|
72
72
|
def drafts
|
73
|
-
@connection.get("/blog/#{name}/posts/draft")
|
73
|
+
@connection.get("/blog/#{name}/posts/draft").response
|
74
74
|
end
|
75
75
|
|
76
76
|
# Retreive Submission Posts
|
@@ -78,7 +78,7 @@ module Tumble
|
|
78
78
|
# @see http://www.tumblr.com/docs/en/api/v2#blog-submissions
|
79
79
|
# @requires_authentication Yes
|
80
80
|
def submissions
|
81
|
-
@connection.get("/blog/#{name}/posts/submission")
|
81
|
+
@connection.get("/blog/#{name}/posts/submission").response
|
82
82
|
end
|
83
83
|
|
84
84
|
# Create a New Blog Post
|
@@ -121,7 +121,7 @@ module Tumble
|
|
121
121
|
# @option options [String] :embed HTML embed code for the video
|
122
122
|
# @option options [String] :data A video file
|
123
123
|
def create_post(options={})
|
124
|
-
@connection.post("/blog/#{name}/post", options)
|
124
|
+
@connection.post("/blog/#{name}/post", options).response
|
125
125
|
end
|
126
126
|
|
127
127
|
# Edit a Blog Post
|
@@ -166,7 +166,7 @@ module Tumble
|
|
166
166
|
# @option options [String] :data A video file
|
167
167
|
|
168
168
|
def edit_post(id, options={})
|
169
|
-
@connection.post("/blog/#{name}/post/edit", options.merge('id' => id))
|
169
|
+
@connection.post("/blog/#{name}/post/edit", options.merge('id' => id)).response
|
170
170
|
end
|
171
171
|
|
172
172
|
# Reblog a Post
|
@@ -179,7 +179,7 @@ module Tumble
|
|
179
179
|
# @param options [Hash] A customizable set of options
|
180
180
|
# @option options [String] :comment A comment added to the reblogged post
|
181
181
|
def reblog_post(id, reblog_key, options={})
|
182
|
-
@connection.post("/blog/#{name}/post/reblog", options.merge('id' => id, 'reblog_key' => reblog_key))
|
182
|
+
@connection.post("/blog/#{name}/post/reblog", options.merge('id' => id, 'reblog_key' => reblog_key)).response
|
183
183
|
end
|
184
184
|
|
185
185
|
# Delete a Post
|
@@ -189,7 +189,7 @@ module Tumble
|
|
189
189
|
#
|
190
190
|
# @param id [Integer] The ID of the post to delete
|
191
191
|
def delete_post(id)
|
192
|
-
@connection.post("/blog/#{name}/post/delete", :id => id)
|
192
|
+
@connection.post("/blog/#{name}/post/delete", :id => id).response
|
193
193
|
end
|
194
194
|
end
|
195
195
|
end
|
data/lib/tumble.rb
CHANGED
data/tumble.gemspec
CHANGED
@@ -3,7 +3,7 @@ Gem::Specification.new do |s|
|
|
3
3
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.5") if s.respond_to? :required_rubygems_version=
|
4
4
|
|
5
5
|
s.name = 'tumble'
|
6
|
-
s.version = '0.
|
6
|
+
s.version = '0.1.1'
|
7
7
|
|
8
8
|
s.summary = 'Library for accessing the Tumblr api v2'
|
9
9
|
# TODO: s.description
|
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
# = MANIFEST =
|
21
21
|
s.files = %w[
|
22
22
|
Gemfile
|
23
|
+
LICENSE.md
|
23
24
|
README.md
|
24
25
|
Rakefile
|
25
26
|
lib/tumble.rb
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tumble
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-18 00:00:00.000000000 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday
|
17
|
-
requirement: &
|
17
|
+
requirement: &70222430403580 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70222430403580
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: rake
|
28
|
-
requirement: &
|
28
|
+
requirement: &70222430403120 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70222430403120
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: rspec
|
39
|
-
requirement: &
|
39
|
+
requirement: &70222430435700 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70222430435700
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: webmock
|
50
|
-
requirement: &
|
50
|
+
requirement: &70222430435280 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,7 +55,7 @@ dependencies:
|
|
55
55
|
version: '0'
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *70222430435280
|
59
59
|
description:
|
60
60
|
email: aubreyholland@gmail.com
|
61
61
|
executables: []
|
@@ -63,6 +63,7 @@ extensions: []
|
|
63
63
|
extra_rdoc_files: []
|
64
64
|
files:
|
65
65
|
- Gemfile
|
66
|
+
- LICENSE.md
|
66
67
|
- README.md
|
67
68
|
- Rakefile
|
68
69
|
- lib/tumble.rb
|