blogpost 0.1.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9db570c3ad1b823ceb77ae7715c58b0e64f81de0
4
+ data.tar.gz: ec60c24f0c8109c32f3c58bd24a754a5c4add19f
5
+ SHA512:
6
+ metadata.gz: 20b188b34e6ec463d33084bf714caec0859646decd358e26b061638d66a7e8eb34eb284370aabf58ca030c5bf43f0fc21d5404aa8f06a27bd925d4fe92197091
7
+ data.tar.gz: 1cea3b415cc6399842ea32ac1c469ce30db463ba572a2d245ba3b38600452d94f6a2713e6770fa40a085bbcfa6eb11552e2dcce6da962485e2645065aa05f10b
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ example/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in blogpost.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 shoprev
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # Blogpost
2
+
3
+ Ruby Blog Post (hatena,athera,269g,cocolog,fc2,goo,jugem,livedoor,maruta,seesaa,webry,wordpress)
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'blogpost'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install blogpost
18
+
19
+ ## Usage
20
+
21
+ ```ruby
22
+ require "blogpost"
23
+
24
+ # hatena blog
25
+ Blogpost::Hatenablog.post({:user => "user id", :pass => "api key", :domain => "example.hatenablog.com", :title => "title", :content => "content"})
26
+ # hatena diary
27
+ Blogpost::Hatenadiary.post({:user => "user id", :pass => "password", :title => "title" , :content => "content"})
28
+ # athera
29
+ Blogpost::Athera.post({:user => "xml-rpc id", :pass => "xml-rpc pass", :title => "title" , :content => "content"})
30
+ # maruta
31
+ Blogpost::Maruta.post({:user => "user id", :pass => "password", :title => "title" , :content => "content"})
32
+ # wordpress
33
+ Blogpost::Wordpress.post({:domain => "example",:user =>"user id", :pass => "password", :title => "title" , :content => "content"})
34
+ # fc2
35
+ Blogpost::Fc2.post({:user =>"user id", :pass => "password", :title => "title" , :content => "content"})
36
+ # livedoor
37
+ Blogpost::Livedoor.post({:user =>"rakutenbook11", :pass => "api key", :title => "title" , :content => "content"})
38
+ # goo
39
+ Blogpost::Goo.post({:user =>"user id", :pass => "password", :title => "title" , :content => "content"})
40
+ # seesaa
41
+ Blogpost::Seesaa.post({:user =>"email", :pass => "password", :title => "title" , :content => "content"})
42
+ # webry
43
+ Blogpost::Webry.post({:user =>"email", :pass => "passowrd", :title => "title" , :content => "content"})
44
+ # jugem
45
+ Blogpost::Jugem.post({:domain => "example", :user =>"user id", :pass => "password", :title => "title" , :content => "content"})
46
+ # cocolog
47
+ Blogpost::Cocolog.post({:blogid => "blog id", :user =>"user id", :pass => "password", :title => "title" , :content => "content"})
48
+ # 269g
49
+ Blogpost::Blogg.post({:user =>"api id", :pass => "api password", :title => "title" , :content => "content"})
50
+ ```
51
+
52
+ ## Contributing
53
+
54
+ 1. Fork it
55
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
56
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
57
+ 4. Push to the branch (`git push origin my-new-feature`)
58
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/blogpost.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'blogpost/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "blogpost"
8
+ spec.version = Blogpost::VERSION
9
+ spec.authors = ["shoprev"]
10
+ spec.email = ["admin@shoprev.net"]
11
+ spec.description = %q{Ruby Blog Post (hatena,athera,269g,cocolog,fc2,goo,jugem,livedoor,maruta,seesaa,webry,wordpress)}
12
+ spec.summary = %q{Ruby Blog Post (hatena,athera,269g,cocolog,fc2,goo,jugem,livedoor,maruta,seesaa,webry,wordpress)}
13
+ spec.homepage = "https://github.com/shoprev/blogpost"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency "atomutil"
22
+ spec.add_development_dependency "bundler", "~> 1.3"
23
+ spec.add_development_dependency "rake"
24
+ end
@@ -0,0 +1,11 @@
1
+ module Blogpost
2
+ class Athera
3
+ def self.post(opts={})
4
+ opts = Blogpost.options.merge(opts)
5
+ host="http://a-thera.com/rpc"
6
+ id = XMLRPC::Client.new2(host).call("blogger.getUsersBlogs", "", opts[:user], opts[:pass])[0]["blogid"]
7
+ XMLRPC::Client.new2(host).call("metaWeblog.newPost", id, opts[:user], opts[:pass],
8
+ {"title" => opts[:title],"description" => opts[:content]}, true)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Blogpost
2
+ class Blogg
3
+ def self.post(opts={})
4
+ opts = Blogpost.options.merge(opts)
5
+ host="http://269g.jp/rpc"
6
+ id = XMLRPC::Client.new2(host).call("blogger.getUsersBlogs", "", opts[:user], opts[:pass])[0]["blogid"]
7
+ XMLRPC::Client.new2(host).call("metaWeblog.newPost", id, opts[:user], opts[:pass],
8
+ {"title" => opts[:title],"description" => opts[:content]}, true)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ module Blogpost
2
+ class Cocolog
3
+ def self.post(opts={})
4
+ opts = Blogpost.options.merge(opts)
5
+ host="https://app.f.cocolog-nifty.com/t/api"
6
+ # id = XMLRPC::Client.new2(host).call("blogger.getUsersBlogs", "", opts[:user], opts[:pass])[0]["blogid"]
7
+ XMLRPC::Client.new2(host).call("metaWeblog.newPost", opts[:blogid], opts[:user], opts[:pass],
8
+ # XMLRPC::Client.new2(host).call("metaWeblog.newPost", id, opts[:user], opts[:pass],
9
+ {"title" => opts[:title],"description" => opts[:content]}, true)
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,10 @@
1
+ module Blogpost
2
+ class Fc2
3
+ def self.post(opts={})
4
+ opts = Blogpost.options.merge(opts)
5
+ host="http://blog.fc2.com/xmlrpc.php"
6
+ XMLRPC::Client.new2(host).call("metaWeblog.newPost", "", opts[:user], opts[:pass],
7
+ {"title" => opts[:title],"description" => opts[:content]}, true)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Blogpost
2
+ class Goo
3
+ def self.post(opts={})
4
+ opts = Blogpost.options.merge(opts)
5
+ host="http://blog.goo.ne.jp/xmlrpc.php"
6
+ XMLRPC::Client.new2(host).call("metaWeblog.newPost", "", opts[:user], opts[:pass],
7
+ {"title" => opts[:title],"description" => opts[:content]}, true)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ module Blogpost
2
+ class Hatenablog
3
+ def self.post(opts={})
4
+ opts = Blogpost.options.merge(opts)
5
+ auth = Atompub::Auth::Wsse.new(username: opts[:user],password: opts[:pass])
6
+ client = Atompub::Client.new(auth: auth)
7
+ entry = Atom::Entry.new(title: opts[:title].encode('BINARY', 'BINARY'),content: opts[:content].encode('BINARY', 'BINARY'))
8
+ client.create_entry("https://blog.hatena.ne.jp/#{opts[:user]}/#{opts[:domain]}/atom/entry", entry)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Blogpost
2
+ class Hatenadiary
3
+ def self.post(opts={})
4
+ opts = Blogpost.options.merge(opts)
5
+ auth = Atompub::Auth::Wsse.new(username: opts[:user],password: opts[:pass])
6
+ client = Atompub::Client.new(auth: auth)
7
+ entry = Atom::Entry.new(title: opts[:title].encode('BINARY', 'BINARY'),content: opts[:content].encode('BINARY', 'BINARY'))
8
+ client.create_entry("http://d.hatena.ne.jp/#{opts[:user]}/atom", entry)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ module Blogpost
2
+ class Jugem
3
+ def self.post(opts={})
4
+ opts = Blogpost.options.merge(opts)
5
+ host="http://#{opts[:domain]}.jugem.jp/admin/xmlrpc.php"
6
+ XMLRPC::Client.new2(host).call("metaWeblog.newPost", "", opts[:user], opts[:pass],
7
+ {"title" => opts[:title],"description" => opts[:content]}, true)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,13 @@
1
+ module Blogpost
2
+ class Livedoor
3
+ def self.post(opts={})
4
+ opts = Blogpost.options.merge(opts)
5
+ auth = Atompub::Auth::Wsse.new(username: opts[:user],password: opts[:pass])
6
+ client = Atompub::Client.new(auth: auth)
7
+ entry = Atom::Entry.new(title: opts[:title],content: opts[:content])
8
+ service = client.get_service "http://livedoor.blogcms.jp/atom/"
9
+ collection_uri = service.workspace.collections[0].href
10
+ client.create_entry(collection_uri, entry)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ module Blogpost
2
+ class Maruta
3
+ def self.post(opts={})
4
+ opts = Blogpost.options.merge(opts)
5
+ host="http://maruta.be/xmlrpc.fcgi"
6
+ id = XMLRPC::Client.new2(host).call("blogger.getUsersBlogs", "", opts[:user], opts[:pass])[0]["blogid"]
7
+ XMLRPC::Client.new2(host).call("metaWeblog.newPost", id, opts[:user], opts[:pass],
8
+ {"title" => opts[:title],"description" => opts[:content]}, true)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Blogpost
2
+ class Seesaa
3
+ def self.post(opts={})
4
+ opts = Blogpost.options.merge(opts)
5
+ host="http://blog.seesaa.jp/rpc"
6
+ id = XMLRPC::Client.new2(host).call("blogger.getUsersBlogs", "",opts[:user], opts[:pass])[0]["blogid"]
7
+ XMLRPC::Client.new2(host).call("metaWeblog.newPost", id, opts[:user], opts[:pass],
8
+ {"title" => opts[:title],"description" => opts[:content]}, true)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module Blogpost
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,10 @@
1
+ module Blogpost
2
+ class Webry
3
+ def self.post(opts={})
4
+ opts = Blogpost.options.merge(opts)
5
+ host="https://bblog.sso.biglobe.ne.jp/ap/xmlrpc"
6
+ XMLRPC::Client.new2(host).call("metaWeblog.newPost", "", opts[:user], opts[:pass],
7
+ {"title" => opts[:title],"description" => opts[:content]}, true)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Blogpost
2
+ class Wordpress
3
+ def self.post(opts={})
4
+ opts = Blogpost.options.merge(opts)
5
+ host="http://#{opts[:domain]}.wordpress.com/xmlrpc.php"
6
+ XMLRPC::Client.new2(host).call("metaWeblog.newPost", "", opts[:user], opts[:pass],
7
+ {"title" => opts[:title],"description" => opts[:content]}, true)
8
+ end
9
+ end
10
+ end
data/lib/blogpost.rb ADDED
@@ -0,0 +1,40 @@
1
+ require "atomutil"
2
+ require "xmlrpc/client"
3
+ require "blogpost/version"
4
+ require "blogpost/hatenablog"
5
+ require "blogpost/hatenadiary"
6
+ require "blogpost/athera"
7
+ require "blogpost/maruta"
8
+ require "blogpost/wordpress"
9
+ require "blogpost/fc2"
10
+ require "blogpost/livedoor"
11
+ require "blogpost/goo"
12
+ require "blogpost/seesaa"
13
+ require "blogpost/webry"
14
+ require "blogpost/jugem"
15
+ require "blogpost/cocolog"
16
+ require "blogpost/blogg"
17
+
18
+ module XMLRPC::ParseContentType
19
+ def parse_content_type(str)
20
+ a, *b = str.split(";")
21
+ a = "text/xml" if a == "application/xml"
22
+ return a.strip.downcase, *b
23
+ end
24
+ end
25
+
26
+ module Blogpost
27
+
28
+ @options ={}
29
+
30
+ def options
31
+ @options
32
+ end
33
+
34
+ def configure(&proc)
35
+ raise ArgumentError, "Block is required." unless block_given?
36
+ yield @options
37
+ end
38
+
39
+ module_function :options, :configure
40
+ end
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: blogpost
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - shoprev
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-11-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: atomutil
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Ruby Blog Post (hatena,athera,269g,cocolog,fc2,goo,jugem,livedoor,maruta,seesaa,webry,wordpress)
56
+ email:
57
+ - admin@shoprev.net
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - blogpost.gemspec
68
+ - lib/blogpost.rb
69
+ - lib/blogpost/athera.rb
70
+ - lib/blogpost/blogg.rb
71
+ - lib/blogpost/cocolog.rb
72
+ - lib/blogpost/fc2.rb
73
+ - lib/blogpost/goo.rb
74
+ - lib/blogpost/hatenablog.rb
75
+ - lib/blogpost/hatenadiary.rb
76
+ - lib/blogpost/jugem.rb
77
+ - lib/blogpost/livedoor.rb
78
+ - lib/blogpost/maruta.rb
79
+ - lib/blogpost/seesaa.rb
80
+ - lib/blogpost/version.rb
81
+ - lib/blogpost/webry.rb
82
+ - lib/blogpost/wordpress.rb
83
+ homepage: https://github.com/shoprev/blogpost
84
+ licenses:
85
+ - MIT
86
+ metadata: {}
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ requirements: []
102
+ rubyforge_project:
103
+ rubygems_version: 2.0.3
104
+ signing_key:
105
+ specification_version: 4
106
+ summary: Ruby Blog Post (hatena,athera,269g,cocolog,fc2,goo,jugem,livedoor,maruta,seesaa,webry,wordpress)
107
+ test_files: []