posterrrrous 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,11 @@
1
+ # .document is used by rdoc and yard to know how to generate documentation
2
+ # for example, it can be used to control how rdoc gets built when you do `gem install foo`
3
+
4
+ README.rdoc
5
+ lib/**/*.rb
6
+ bin/*
7
+
8
+ # Files below this - are treated as 'extra files', and aren't parsed for ruby code
9
+ -
10
+ features/**/*.feature
11
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,42 @@
1
+ # rcov generated
2
+ coverage
3
+
4
+ # rdoc generated
5
+ rdoc
6
+
7
+ # yard generated
8
+ doc
9
+ .yardoc
10
+
11
+ # bundler
12
+ .bundle
13
+
14
+ # jeweler generated
15
+ pkg
16
+
17
+ # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
18
+ #
19
+ # * Create a file at ~/.gitignore
20
+ # * Include files you want ignored
21
+ # * Run: git config --global core.excludesfile ~/.gitignore
22
+ #
23
+ # After doing this, these files will be ignored in all your git projects,
24
+ # saving you from having to 'pollute' every project you touch with them
25
+ #
26
+ # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
27
+ #
28
+ # For MacOS:
29
+ #
30
+ #.DS_Store
31
+ #
32
+ # For TextMate
33
+ #*.tmproj
34
+ #tmtags
35
+ #
36
+ # For emacs:
37
+ #*~
38
+ #\#*
39
+ #.\#*
40
+ #
41
+ # For vim:
42
+ #*.swp
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source "http://rubygems.org"
2
+ gem "httparty"
3
+
4
+ # Add dependencies to develop your gem here.
5
+ # Include everything needed to run rake, tests, features, etc.
6
+ group :development do
7
+ gem "rspec", ">= 2.0.0.beta.19"
8
+ gem "bundler", "~> 1.0.0"
9
+ gem "jeweler", "~> 1.5.0.pre3"
10
+ gem "rcov", ">= 0"
11
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,32 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ crack (0.1.8)
5
+ diff-lcs (1.1.2)
6
+ git (1.2.5)
7
+ httparty (0.6.1)
8
+ crack (= 0.1.8)
9
+ jeweler (1.5.0.pre2)
10
+ bundler (~> 1.0.0)
11
+ git (>= 1.2.5)
12
+ rake
13
+ rake (0.8.7)
14
+ rcov (0.9.8)
15
+ rspec (2.0.0.beta.20)
16
+ rspec-core (= 2.0.0.beta.20)
17
+ rspec-expectations (= 2.0.0.beta.20)
18
+ rspec-mocks (= 2.0.0.beta.20)
19
+ rspec-core (2.0.0.beta.20)
20
+ rspec-expectations (2.0.0.beta.20)
21
+ diff-lcs (>= 1.1.2)
22
+ rspec-mocks (2.0.0.beta.20)
23
+
24
+ PLATFORMS
25
+ ruby
26
+
27
+ DEPENDENCIES
28
+ bundler (~> 1.0.0)
29
+ httparty
30
+ jeweler (~> 1.5.0.pre3)
31
+ rcov
32
+ rspec (>= 2.0.0.beta.19)
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Joshua Nichols
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,37 @@
1
+ = posterrrrous
2
+
3
+ Quick and dirty ruby wrapper for the Posterous API: http://posterous.com/api/
4
+
5
+ Install with the usual deal:
6
+
7
+ gem install posterrrrous
8
+
9
+
10
+ Basically, it's a glorified combo of method_missing and httparty to hit the API endpoints.
11
+
12
+ # Your credentials here
13
+ Posterrrrous.email = "you@example.com"
14
+ Posterrrrous.email = "so sekrit"
15
+
16
+ # Refer to http://posterous.com/api for API methods, and pass in any parameters as an options hash
17
+
18
+ Posterrrrous.getsites
19
+ Posterrrrous.readposts :site_id => "1234"
20
+ Posterrrrous.newpost :site_id => "5678", :title => 'posterrrrous', :body => "oh yeah"
21
+
22
+ last_post = Posterrrrous.readposts.first # last is first, on account of ordered by date descending
23
+ Posterrrrous.updatepost :post_id => last_post['id'], :body => "#{last_post['body']}... BREAKING UPDATE: wooo!"
24
+
25
+ == Contributing to posterrrrous
26
+
27
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
28
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
29
+ * Fork the project
30
+ * Start a feature/bugfix branch
31
+ * Commit and push until you are happy with your contribution
32
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
33
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
34
+
35
+ == Copyright
36
+
37
+ Copyright (c) 2010 Joshua Nichols. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,46 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'rake'
11
+
12
+ require 'jeweler'
13
+ Jeweler::Tasks.new do |gem|
14
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
+ gem.name = "posterrrrous"
16
+ gem.version = "0.0.1"
17
+ gem.summary = %Q{Quick and dirty Ruby API wrapper for Posterous}
18
+ gem.description = %Q{Quick and dirty Ruby API wrapper for Posterous}
19
+ gem.email = "josh@technicalpickles.com"
20
+ gem.homepage = "http://github.com/technicalpickles/posterrrrous"
21
+ gem.authors = ["Joshua Nichols"]
22
+ end
23
+ Jeweler::RubygemsDotOrgTasks.new
24
+
25
+ require 'rspec/core'
26
+ require 'rspec/core/rake_task'
27
+ RSpec::Core::RakeTask.new(:spec) do |spec|
28
+ spec.pattern = FileList['spec/**/*_spec.rb']
29
+ end
30
+
31
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
32
+ spec.pattern = 'spec/**/*_spec.rb'
33
+ spec.rcov = true
34
+ end
35
+
36
+ task :default => :spec
37
+
38
+ require 'rake/rdoctask'
39
+ Rake::RDocTask.new do |rdoc|
40
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
41
+
42
+ rdoc.rdoc_dir = 'rdoc'
43
+ rdoc.title = "posterrrrous #{version}"
44
+ rdoc.rdoc_files.include('README*')
45
+ rdoc.rdoc_files.include('lib/**/*.rb')
46
+ end
@@ -0,0 +1,38 @@
1
+ require 'httparty'
2
+ require 'active_support/core_ext/array/extract_options'
3
+
4
+ class Posterrrrous
5
+ include HTTParty
6
+
7
+ base_uri 'http://posterous.com/api'
8
+
9
+ class << self
10
+ attr_accessor :email, :password
11
+ end
12
+
13
+ def self.method_missing(method_sym, *arguments, &block)
14
+ attributes = arguments.pop
15
+
16
+ options = {
17
+ :query => attributes,
18
+ :basic_auth => {
19
+ :username => email,
20
+ :password => password
21
+ }
22
+ }
23
+
24
+ response = get "/#{method_sym}", options
25
+ response = response["rsp"]
26
+
27
+ status = response.delete('stat')
28
+ if status != "ok"
29
+ error = response['err']
30
+ require 'ruby-debug'; breakpoint
31
+ raise "Posterous Error #{error['code']}: #{error['msg']}"
32
+ else
33
+ response.values.first
34
+ end
35
+ end
36
+
37
+
38
+ end
@@ -0,0 +1,67 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{posterrrrous}
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Joshua Nichols"]
12
+ s.date = %q{2010-09-07}
13
+ s.description = %q{Quick and dirty Ruby API wrapper for Posterous}
14
+ s.email = %q{josh@technicalpickles.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "lib/posterrrrous.rb",
28
+ "posterrrrous.gemspec",
29
+ "spec/.rspec",
30
+ "spec/posterrrrous_spec.rb",
31
+ "spec/spec_helper.rb"
32
+ ]
33
+ s.homepage = %q{http://github.com/technicalpickles/posterrrrous}
34
+ s.require_paths = ["lib"]
35
+ s.rubygems_version = %q{1.3.6}
36
+ s.summary = %q{Quick and dirty Ruby API wrapper for Posterous}
37
+ s.test_files = [
38
+ "spec/posterrrrous_spec.rb",
39
+ "spec/spec_helper.rb"
40
+ ]
41
+
42
+ if s.respond_to? :specification_version then
43
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
44
+ s.specification_version = 3
45
+
46
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
47
+ s.add_runtime_dependency(%q<httparty>, [">= 0"])
48
+ s.add_development_dependency(%q<rspec>, [">= 2.0.0.beta.19"])
49
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
50
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.0.pre3"])
51
+ s.add_development_dependency(%q<rcov>, [">= 0"])
52
+ else
53
+ s.add_dependency(%q<httparty>, [">= 0"])
54
+ s.add_dependency(%q<rspec>, [">= 2.0.0.beta.19"])
55
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
56
+ s.add_dependency(%q<jeweler>, ["~> 1.5.0.pre3"])
57
+ s.add_dependency(%q<rcov>, [">= 0"])
58
+ end
59
+ else
60
+ s.add_dependency(%q<httparty>, [">= 0"])
61
+ s.add_dependency(%q<rspec>, [">= 2.0.0.beta.19"])
62
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
63
+ s.add_dependency(%q<jeweler>, ["~> 1.5.0.pre3"])
64
+ s.add_dependency(%q<rcov>, [">= 0"])
65
+ end
66
+ end
67
+
data/spec/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Posterrrrous" do
4
+ it "fails" do
5
+ fail "hey buddy, you should probably rename this file and start specing for real"
6
+ end
7
+ end
@@ -0,0 +1,21 @@
1
+ require 'bundler'
2
+ begin
3
+ Bundler.setup(:default, :development)
4
+ rescue Bundler::BundlerError => e
5
+ $stderr.puts e.message
6
+ $stderr.puts "Run `bundle install` to install missing gems"
7
+ exit e.status_code
8
+ end
9
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
10
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
11
+ require 'posterrrrous'
12
+ require 'rspec'
13
+ require 'rspec/autorun'
14
+
15
+ # Requires supporting files with custom matchers and macros, etc,
16
+ # in ./support/ and its subdirectories.
17
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
18
+
19
+ RSpec.configure do |config|
20
+
21
+ end
metadata ADDED
@@ -0,0 +1,143 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: posterrrrous
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Joshua Nichols
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-09-07 00:00:00 -04:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ type: :runtime
22
+ version_requirements: &id001 !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ segments:
27
+ - 0
28
+ version: "0"
29
+ name: httparty
30
+ requirement: *id001
31
+ prerelease: false
32
+ - !ruby/object:Gem::Dependency
33
+ type: :development
34
+ version_requirements: &id002 !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ segments:
39
+ - 2
40
+ - 0
41
+ - 0
42
+ - beta
43
+ - 19
44
+ version: 2.0.0.beta.19
45
+ name: rspec
46
+ requirement: *id002
47
+ prerelease: false
48
+ - !ruby/object:Gem::Dependency
49
+ type: :development
50
+ version_requirements: &id003 !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ segments:
55
+ - 1
56
+ - 0
57
+ - 0
58
+ version: 1.0.0
59
+ name: bundler
60
+ requirement: *id003
61
+ prerelease: false
62
+ - !ruby/object:Gem::Dependency
63
+ type: :development
64
+ version_requirements: &id004 !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ segments:
69
+ - 1
70
+ - 5
71
+ - 0
72
+ - pre3
73
+ version: 1.5.0.pre3
74
+ name: jeweler
75
+ requirement: *id004
76
+ prerelease: false
77
+ - !ruby/object:Gem::Dependency
78
+ type: :development
79
+ version_requirements: &id005 !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ segments:
84
+ - 0
85
+ version: "0"
86
+ name: rcov
87
+ requirement: *id005
88
+ prerelease: false
89
+ description: Quick and dirty Ruby API wrapper for Posterous
90
+ email: josh@technicalpickles.com
91
+ executables: []
92
+
93
+ extensions: []
94
+
95
+ extra_rdoc_files:
96
+ - LICENSE
97
+ - README.rdoc
98
+ files:
99
+ - .document
100
+ - .gitignore
101
+ - Gemfile
102
+ - Gemfile.lock
103
+ - LICENSE
104
+ - README.rdoc
105
+ - Rakefile
106
+ - lib/posterrrrous.rb
107
+ - posterrrrous.gemspec
108
+ - spec/.rspec
109
+ - spec/posterrrrous_spec.rb
110
+ - spec/spec_helper.rb
111
+ has_rdoc: true
112
+ homepage: http://github.com/technicalpickles/posterrrrous
113
+ licenses: []
114
+
115
+ post_install_message:
116
+ rdoc_options: []
117
+
118
+ require_paths:
119
+ - lib
120
+ required_ruby_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ segments:
125
+ - 0
126
+ version: "0"
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ segments:
132
+ - 0
133
+ version: "0"
134
+ requirements: []
135
+
136
+ rubyforge_project:
137
+ rubygems_version: 1.3.6
138
+ signing_key:
139
+ specification_version: 3
140
+ summary: Quick and dirty Ruby API wrapper for Posterous
141
+ test_files:
142
+ - spec/posterrrrous_spec.rb
143
+ - spec/spec_helper.rb