tumblr-api 0.1.3 → 0.1.4

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.
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 1
4
- :patch: 3
4
+ :patch: 4
@@ -7,7 +7,13 @@ require 'tumblr/request'
7
7
  require 'tumblr/post'
8
8
 
9
9
  class Tumblr
10
- class << self; attr_accessor :blog end
10
+ class << self
11
+ attr_reader :blog
12
+
13
+ def blog=(_blog)
14
+ @blog = (_blog =~ /\./) ? _blog : "#{_blog}.tumblr.com"
15
+ end
16
+ end
11
17
 
12
18
  # tumblr errors
13
19
  class TumblrError < StandardError; end
@@ -3,7 +3,7 @@ class Tumblr
3
3
 
4
4
  # a GET request to http://[YOURUSERNAME].tumblr.com/api/read
5
5
  def self.read(options = {})
6
- response = HTTParty.get("http://#{Tumblr::blog ||= 'staff'}.tumblr.com/api/read", options)
6
+ response = HTTParty.get("http://#{Tumblr::blog}/api/read", options)
7
7
  return response unless raise_errors(response)
8
8
  end
9
9
 
@@ -1,10 +1,15 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
3
  describe Tumblr do
4
- it "should set the current blog" do
4
+ it "should set the current blog suffixed with tumblr.com" do
5
5
  Tumblr::blog = 'myblog'
6
- Tumblr::blog.should eql('myblog')
6
+ Tumblr::blog.should eql('myblog.tumblr.com')
7
7
  end
8
+ it "should set the current blog when a full domain is passed" do
9
+ Tumblr::blog = 'myblog.domain.com'
10
+ Tumblr::blog.should eql('myblog.domain.com')
11
+ end
12
+
8
13
  end
9
14
 
10
15
  describe Tumblr::Request, ".read" do
@@ -20,13 +25,13 @@ describe Tumblr::Request, ".read" do
20
25
 
21
26
  it "should return a tumblr object" do
22
27
  response = Tumblr::Request.read
23
- response['tumblr'].is_a?(Hash).should eql(true)
28
+ response['tumblr'].should be_instance_of(Hash)
24
29
  end
25
30
 
26
31
  it "should even return a tumblr object when no blog specified" do
27
32
  Tumblr::blog = nil
28
33
  response = Tumblr::Request.read
29
- response['tumblr'].is_a?(Hash).should eql true
34
+ response['tumblr'].should be_instance_of(Hash)
30
35
  end
31
36
  end
32
37
 
@@ -122,7 +127,7 @@ describe Tumblr::Post, ".all" do
122
127
 
123
128
  it "shoud always return an array" do
124
129
  response = Tumblr::Post.all
125
- response.is_a?(Array).should eql(true)
130
+ response.should be_instance_of(Array)
126
131
  end
127
132
  end
128
133
 
@@ -163,7 +168,7 @@ describe Tumblr::Post, ".first" do
163
168
 
164
169
  it "shoud never return an array" do
165
170
  response = Tumblr::Post.first
166
- response.is_a?(Array).should eql(false)
171
+ response.should_not be_instance_of(Array)
167
172
  end
168
173
  end
169
174
 
@@ -198,7 +203,7 @@ describe Tumblr::Post, ".last" do
198
203
 
199
204
  it "shoud never return an array" do
200
205
  response = Tumblr::Post.last
201
- response.is_a?(Array).should eql(false)
206
+ response.should_not be_instance_of(Array)
202
207
  end
203
208
  end
204
209
 
@@ -220,7 +225,7 @@ describe Tumblr::Post, ".find" do
220
225
 
221
226
  it "shoud never return an array" do
222
227
  response = Tumblr::Post.find(108796131)
223
- response.is_a?(Array).should eql(false)
228
+ response.should_not be_instance_of(Array)
224
229
  end
225
230
  end
226
231
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{tumblr-api}
8
- s.version = "0.1.3"
8
+ s.version = "0.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jeff Kreeftmeijer"]
12
- s.date = %q{2009-11-17}
12
+ s.date = %q{2010-03-08}
13
13
  s.email = %q{jeff@kreeftmeijer.nl}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tumblr-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Kreeftmeijer
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-17 00:00:00 +01:00
12
+ date: 2010-03-08 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency