posterous 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -3,5 +3,5 @@ Gemfile.lock
3
3
  test.log
4
4
  .DS_Store
5
5
  config/flowb.yml
6
- spec/postly.yml
6
+ spec/posterous.yml
7
7
  pkg/
data/bin/posterous CHANGED
@@ -37,8 +37,12 @@ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
37
37
 
38
38
  %w{posterous irb}.each { |f| require f }
39
39
 
40
- rc = File.open(RC_PATH,File::RDWR|File::APPEND|File::CREAT)
41
- yml = YAML.load_file(rc)
40
+ if File.exists?(RC_PATH)
41
+ rc = File.open(RC_PATH, 'r')
42
+ yml = YAML.load_file(RC_PATH)
43
+ else
44
+ rc = File.open(RC_PATH, 'w')
45
+ end
42
46
 
43
47
  if yml.is_a?(Hash)
44
48
  cfg = yml
@@ -30,7 +30,10 @@ module Posterous
30
30
  end
31
31
 
32
32
  [:get, :post, :put, :delete].each do |verb|
33
- define_method verb do |path, params={}|
33
+ define_method verb do |path, *args|
34
+
35
+ params = args.last || {}
36
+
34
37
  puts "POSTLY :: #{verb.upcase} #{path} #{params}\n\n" if ENV['POSTLY_DEBUG']
35
38
 
36
39
  response = http.send(verb, "#{Posterous::BASE_API_URL}#{path}",
@@ -4,6 +4,11 @@ module Posterous
4
4
  extend Connection
5
5
 
6
6
  attr_reader :struct
7
+
8
+ # hack for ruby 1.8.7
9
+ def id
10
+ self.struct.send(:table)[:id]
11
+ end
7
12
 
8
13
  # Get a collection for a model
9
14
  #
@@ -108,7 +113,7 @@ module Posterous
108
113
  end
109
114
 
110
115
  def inspect
111
- "<#{self} #{struct.send(:table).to_s}>"
116
+ "<#{self} #{struct.send(:table).inspect}>"
112
117
  end
113
118
 
114
119
  end
@@ -1,3 +1,3 @@
1
1
  module Posterous
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/lib/posterous.rb CHANGED
@@ -1,5 +1,28 @@
1
1
  %w[typhoeus yaml json ostruct].each { |lib| require lib }
2
2
 
3
+ require 'pathname'
4
+
5
+ dir = Pathname(__FILE__).dirname.expand_path
6
+
7
+ require dir + 'posterous/connection'
8
+ require dir + 'posterous/inheritable'
9
+ require dir + 'posterous/model'
10
+ require dir + 'posterous/models/tag'
11
+ require dir + 'posterous/models/subscriber'
12
+ require dir + 'posterous/models/subscription'
13
+ require dir + 'posterous/models/comment'
14
+ require dir + 'posterous/models/like'
15
+ require dir + 'posterous/models/post'
16
+ require dir + 'posterous/models/page'
17
+ require dir + 'posterous/models/link'
18
+ require dir + 'posterous/models/link_category'
19
+ require dir + 'posterous/models/external_site'
20
+ require dir + 'posterous/models/user'
21
+ require dir + 'posterous/models/profile'
22
+ require dir + 'posterous/models/site'
23
+ require dir + 'posterous/association_proxy'
24
+
25
+
3
26
  module Posterous
4
27
  BASE_API_URL = 'http://posterous.com/api/v2'
5
28
 
@@ -28,7 +51,7 @@ module Posterous
28
51
 
29
52
  def config=(cfg)
30
53
  @config = case
31
- when cfg.is_a?(File)
54
+ when cfg.is_a?(String)
32
55
  YAML.load_file(cfg)
33
56
  when cfg.is_a?(Hash)
34
57
  cfg
@@ -37,3 +60,5 @@ module Posterous
37
60
  end
38
61
  end
39
62
  end
63
+
64
+
data/spec/helper.rb CHANGED
@@ -2,10 +2,11 @@ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
2
2
 
3
3
  require 'posterous'
4
4
 
5
- SAMPLE_CONFIG = File.open(File.dirname(__FILE__) + '/posterous.yml')
5
+ SAMPLE_CONFIG = File.dirname(__FILE__) + '/posterous.yml'
6
6
  SAMPLE_IMAGE = File.open(File.dirname(__FILE__) + '/fixtures/metal.png')
7
7
  Posterous.config = SAMPLE_CONFIG
8
-
8
+ include Posterous
9
9
  RSpec.configure do |config|
10
+
10
11
  end
11
12
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 0
9
- version: 0.2.0
8
+ - 1
9
+ version: 0.2.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Christopher Burnett @twoism