tumblr_client 0.6.6 → 0.6.7

Sign up to get free protection for your applications and to get access to all the features.
data/lib/tumblr/client.rb CHANGED
@@ -3,6 +3,7 @@ require 'tumblr/user'
3
3
  require 'tumblr/request'
4
4
  require 'tumblr/connection'
5
5
  require 'tumblr/post'
6
+ require 'tumblr/tagged'
6
7
  require 'tumblr/helpers'
7
8
 
8
9
  module Tumblr
@@ -11,6 +12,7 @@ module Tumblr
11
12
  include Tumblr::Client::Blog
12
13
  include Tumblr::Client::User
13
14
  include Tumblr::Client::Post
15
+ include Tumblr::Client::Tagged
14
16
  include Tumblr::Client::Helper
15
17
  include Tumblr::Connection
16
18
 
data/lib/tumblr/post.rb CHANGED
@@ -18,12 +18,20 @@ module Tumblr
18
18
  end
19
19
 
20
20
  def photo(blog_name, options={})
21
- valid_opts = @@standard_post_options + [:caption, :link, :data, :source]
21
+ valid_opts = @@standard_post_options + [:caption, :link, :data, :source, :photoset_layout]
22
22
  if valid_options(valid_opts, options)
23
23
  options[:type] = "photo"
24
24
  if (options.has_key?(:data) && options.has_key?(:source))
25
25
  raise Exception, "You can only use one parameter, either source or data."
26
26
  end
27
+ if options.has_key?(:source) && options[:source].kind_of?(Array)
28
+ count = 0
29
+ options[:source].each do |src|
30
+ options["source[#{count}]"] = src
31
+ count += 1
32
+ end
33
+ options.delete(:source)
34
+ end
27
35
  if options.has_key?(:data)
28
36
  #Probably can be refactored
29
37
  if options[:data].kind_of?(Array)
@@ -0,0 +1,18 @@
1
+ module Tumblr
2
+ class Client
3
+ module Tagged
4
+
5
+ @@standard_options = [:before, :limit, :filter]
6
+
7
+ def tagged(tag, options={})
8
+ params = {:tag => tag, :api_key => Tumblr::consumer_key}
9
+ unless options.empty?
10
+ params.merge!(options)
11
+ end
12
+ if valid_options(@@standard_options, options)
13
+ get("v2/tagged", params)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
data/tumblr.gemspec CHANGED
@@ -18,5 +18,5 @@ Gem::Specification.new do |gem|
18
18
  gem.required_rubygems_version = Gem::Requirement.new('>= 1.3.6')
19
19
  gem.summary = %q{Tumblr API wrapper}
20
20
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
- gem.version = "0.6.6"
21
+ gem.version = "0.6.7"
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tumblr_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.6
4
+ version: 0.6.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-30 00:00:00.000000000 Z
12
+ date: 2012-09-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -128,6 +128,7 @@ files:
128
128
  - lib/tumblr/post.rb
129
129
  - lib/tumblr/request.rb
130
130
  - lib/tumblr/request/oauth.rb
131
+ - lib/tumblr/tagged.rb
131
132
  - lib/tumblr/user.rb
132
133
  - lib/tumblr_client.rb
133
134
  - tumblr.gemspec