jordandobson-posterous 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -10,3 +10,10 @@
10
10
 
11
11
  * Updated the class to accept date, private, autopost, tags
12
12
 
13
+
14
+ === 0.1.3 / 2009-06-01
15
+
16
+ * 1 major enhancement
17
+
18
+ * Updated Readme and DRYed up a method to use symbols
19
+
data/README.txt CHANGED
@@ -6,7 +6,7 @@ http://github.com/jordandobson/Posterous/tree/master
6
6
 
7
7
  The Posterous gem provides posting to Posterous.com using your email, password, site id(if you have multiple sites) and your blog content. With this gem, you have access to add an entry on posterous by providing these options a title, body text, date, tags, set to autopost, set private, posted by source name and a posted by source link to Posterous. You can include no options or all options.
8
8
 
9
- Posting images with posts, posting only images and pulling down your posts will be available soon. The Posterous API was unstable when this version of the gem was created.
9
+ Posting images with posts, posting only images and pulling down your posts will be available soon.
10
10
 
11
11
  == FEATURES/PROBLEMS:
12
12
 
@@ -17,7 +17,7 @@ Posting images with posts, posting only images and pulling down your posts will
17
17
  * Check if a user has a valid site
18
18
  * Check if a specified site_id is valid for their account
19
19
  * Get their primary Site ID
20
- * This is very well throughly tested
20
+ * This is very throughly tested
21
21
 
22
22
  == SYNOPSIS:
23
23
 
@@ -38,11 +38,11 @@ Posting images with posts, posting only images and pulling down your posts will
38
38
 
39
39
  account.valid_user?
40
40
 
41
- * Check if the user has a site and if they specified a Site ID check it's valid
41
+ * Check if the user has a site AND if you've entered a Site ID, check it's valid too
42
42
 
43
43
  account.has_site?
44
44
 
45
- * Get the users primary site ID (In case they have two)
45
+ * Get the users primary site ID (In case they have multiple sites)
46
46
 
47
47
  account.get_primary_site
48
48
 
@@ -52,7 +52,7 @@ Posting images with posts, posting only images and pulling down your posts will
52
52
 
53
53
  3. Setup your post with any or all of these optional fields
54
54
 
55
- * You can set your id at this point or when it's instantiated
55
+ * You can set your id at this point or at the begining when it's instantiated
56
56
 
57
57
  account.site_id = account.get_primary_site or specific site ID
58
58
 
@@ -65,10 +65,10 @@ Posting images with posts, posting only images and pulling down your posts will
65
65
  account.tags = ["Glue", "Posterous", "Ruby", "Made By Squad"]
66
66
  account.date = Time.now
67
67
 
68
- * Call these methods to set them
68
+ * Call the set_to method with either :private or :autopost to apply that setting
69
69
 
70
- account.set_to_private
71
- account.set_to_autopost
70
+ account.set_to :private
71
+ account.set_to :autopost
72
72
 
73
73
  4. Add your post to Posterous.com
74
74
 
data/lib/posterous.rb CHANGED
@@ -15,7 +15,7 @@ class PosterousSiteError < StandardError; end
15
15
 
16
16
  class Posterous
17
17
 
18
- VERSION = '0.1.2'
18
+ VERSION = '0.1.3'
19
19
  DOMAIN = 'posterous.com'
20
20
  POST_PATH = '/api/newpost'
21
21
  AUTH_PATH = '/api/getsites'
@@ -71,15 +71,12 @@ class Posterous
71
71
  site_list.each do |site|
72
72
  return site["id"] if site["primary"] == "true"
73
73
  end
74
- return nil
74
+ nil
75
75
  end
76
-
77
- def set_to_private
78
- @private_post = 1
79
- end
80
-
81
- def set_to_autopost
82
- @autopost = 1
76
+
77
+ def set_to on
78
+ @private_post = 1 if on == :private
79
+ @autopost = 1 if on == :autopost
83
80
  end
84
81
 
85
82
  def build_query
@@ -316,13 +316,13 @@ class TestPosterous < Test::Unit::TestCase
316
316
  end
317
317
 
318
318
  def test_builds_query_with_private_option
319
- @new_obj.set_to_private
319
+ @new_obj.set_to :private
320
320
  expected = { :source => nil, :body => nil, :sourceLink => nil, :title => nil, :private => 1 }
321
321
  assert_equal expected, @new_obj.build_query
322
322
  end
323
323
 
324
324
  def test_builds_query_with_autopost_option
325
- @new_obj.set_to_autopost
325
+ @new_obj.set_to :autopost
326
326
  expected = { :source => nil, :body => nil, :sourceLink => nil, :title => nil, :autopost => 1 }
327
327
  assert_equal expected, @new_obj.build_query
328
328
  end
@@ -337,7 +337,7 @@ class TestPosterous < Test::Unit::TestCase
337
337
  date = Time.now
338
338
  @new_obj.date = date
339
339
  @new_obj.site_id = 20
340
- @new_obj.set_to_private
340
+ @new_obj.set_to :private
341
341
  expected = { :source => nil, :body => nil, :sourceLink => nil, :site_id => "20", :title => nil, :private => 1, :date => date }
342
342
  assert_equal expected, @new_obj.build_query
343
343
  end
@@ -405,7 +405,7 @@ class TestPosterous < Test::Unit::TestCase
405
405
 
406
406
  def test_add_post_is_made_private
407
407
  Posterous.stubs(:post).returns(@post_private_good)
408
- @new_obj.set_to_private
408
+ @new_obj.set_to :private
409
409
  actual = @new_obj.add_post
410
410
  assert_equal "ok", actual["rsp"]["stat"]
411
411
  assert_match @private_url_path, actual["rsp"]["post"]["longurl"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jordandobson-posterous
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Dobson
@@ -67,6 +67,6 @@ rubyforge_project: posterous
67
67
  rubygems_version: 1.2.0
68
68
  signing_key:
69
69
  specification_version: 2
70
- summary: The Posterous gem provides posting to Posterous.com using your email, password, site id(if you have multiple sites) and your blog content. With this gem, you have access to post a title, body text, posting source and a source link to Posterous. Posting images and pulling down your posts will be available soon. They were made available a day before this was completed.
70
+ summary: The Posterous gem provides posting to Posterous.com using your email, password, site id(if you have multiple sites) and your blog content. With this gem, you have access to add an entry on posterous by providing these options a title, body text, date, tags, set to autopost, set private, posted by source name and a posted by source link to Posterous. You can include no options or all options.
71
71
  test_files:
72
72
  - test/test_posterous.rb