blogpost 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9db570c3ad1b823ceb77ae7715c58b0e64f81de0
4
- data.tar.gz: ec60c24f0c8109c32f3c58bd24a754a5c4add19f
3
+ metadata.gz: d17bfb7d00c41735071ec00344e1bb5ea465308c
4
+ data.tar.gz: a9e318eb100afe72b93fe0d3b58bcafdb2a5086e
5
5
  SHA512:
6
- metadata.gz: 20b188b34e6ec463d33084bf714caec0859646decd358e26b061638d66a7e8eb34eb284370aabf58ca030c5bf43f0fc21d5404aa8f06a27bd925d4fe92197091
7
- data.tar.gz: 1cea3b415cc6399842ea32ac1c469ce30db463ba572a2d245ba3b38600452d94f6a2713e6770fa40a085bbcfa6eb11552e2dcce6da962485e2645065aa05f10b
6
+ metadata.gz: 94e5d4be36f5d5b548374d5ad52824b37e3adfd58b801305f8a42eaf3438a40b0fe772959a53070c14b6be73ec648ff01464337eaee8ea58fddb1aaadd8a50f5
7
+ data.tar.gz: 407016a39299fab8abc91345b2c1844027a2dc831ba12f31f8d18a90920bf8209140b7b94d5d62eb730ecb1c171455d1832891d024c3b2c19eb90de9d3494cc4
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Blogpost
2
2
 
3
- Ruby Blog Post (hatena,athera,269g,cocolog,fc2,goo,jugem,livedoor,maruta,seesaa,webry,wordpress)
3
+ [![Gem Version](https://badge.fury.io/rb/blogpost.png)](http://badge.fury.io/rb/blogpost)
4
+ Ruby Blog Post (hatena,athera,269g,cocolog,fc2,goo,jugem,livedoor,maruta,seesaa,webry,wordpress,gmail,sendmail)
4
5
 
5
6
  ## Installation
6
7
 
@@ -22,31 +23,51 @@ Or install it yourself as:
22
23
  require "blogpost"
23
24
 
24
25
  # hatena blog
25
- Blogpost::Hatenablog.post({:user => "user id", :pass => "api key", :domain => "example.hatenablog.com", :title => "title", :content => "content"})
26
+ Blogpost::Hatenablog.post({:user => "user id", :pass => "api key",
27
+ :domain => "example.hatenablog.com", :title => "title", :content => "content"})
26
28
  # hatena diary
27
- Blogpost::Hatenadiary.post({:user => "user id", :pass => "password", :title => "title" , :content => "content"})
29
+ Blogpost::Hatenadiary.post({:user => "user id", :pass => "password",
30
+ :title => "title" , :content => "content"})
28
31
  # athera
29
- Blogpost::Athera.post({:user => "xml-rpc id", :pass => "xml-rpc pass", :title => "title" , :content => "content"})
32
+ Blogpost::Athera.post({:user => "xml-rpc id", :pass => "xml-rpc pass",
33
+ :title => "title" , :content => "content"})
30
34
  # maruta
31
- Blogpost::Maruta.post({:user => "user id", :pass => "password", :title => "title" , :content => "content"})
35
+ Blogpost::Maruta.post({:user => "user id", :pass => "password",
36
+ :title => "title" , :content => "content"})
32
37
  # wordpress
33
- Blogpost::Wordpress.post({:domain => "example",:user =>"user id", :pass => "password", :title => "title" , :content => "content"})
38
+ Blogpost::Wordpress.post({:domain => "example",:user =>"user id",
39
+ :pass => "password", :title => "title" , :content => "content"})
34
40
  # fc2
35
- Blogpost::Fc2.post({:user =>"user id", :pass => "password", :title => "title" , :content => "content"})
41
+ Blogpost::Fc2.post({:user =>"user id", :pass => "password",
42
+ :title => "title" , :content => "content"})
36
43
  # livedoor
37
- Blogpost::Livedoor.post({:user =>"rakutenbook11", :pass => "api key", :title => "title" , :content => "content"})
44
+ Blogpost::Livedoor.post({:user =>"user id", :pass => "api key",
45
+ :title => "title" , :content => "content"})
38
46
  # goo
39
- Blogpost::Goo.post({:user =>"user id", :pass => "password", :title => "title" , :content => "content"})
47
+ Blogpost::Goo.post({:user =>"user id", :pass => "password",
48
+ :title => "title" , :content => "content"})
40
49
  # seesaa
41
- Blogpost::Seesaa.post({:user =>"email", :pass => "password", :title => "title" , :content => "content"})
50
+ Blogpost::Seesaa.post({:user =>"email", :pass => "password",
51
+ :title => "title" , :content => "content"})
42
52
  # webry
43
- Blogpost::Webry.post({:user =>"email", :pass => "passowrd", :title => "title" , :content => "content"})
53
+ Blogpost::Webry.post({:user =>"email", :pass => "passowrd",
54
+ :title => "title" , :content => "content"})
44
55
  # jugem
45
- Blogpost::Jugem.post({:domain => "example", :user =>"user id", :pass => "password", :title => "title" , :content => "content"})
56
+ Blogpost::Jugem.post({:domain => "example", :user =>"user id",
57
+ :pass => "password", :title => "title" , :content => "content"})
46
58
  # cocolog
47
- Blogpost::Cocolog.post({:blogid => "blog id", :user =>"user id", :pass => "password", :title => "title" , :content => "content"})
59
+ Blogpost::Cocolog.post({:blogid => "blog id", :user =>"user id",
60
+ :pass => "password", :title => "title" , :content => "content"})
48
61
  # 269g
49
- Blogpost::Blogg.post({:user =>"api id", :pass => "api password", :title => "title" , :content => "content"})
62
+ Blogpost::Blogg.post({:user =>"api id", :pass => "api password",
63
+ :title => "title" , :content => "content"})
64
+ # gmail
65
+ Blogpost::Gmail.post({:address =>"to@example.com",
66
+ :user =>"from@example.com", :pass => "password",
67
+ :title => "title" , :content => "content"})
68
+ # sendmail
69
+ Blogpost::Sendmail.post({:address =>"to@example.com",
70
+ :title => "title" , :content => "content"})
50
71
  ```
51
72
 
52
73
  ## Contributing
data/blogpost.gemspec CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Blogpost::VERSION
9
9
  spec.authors = ["shoprev"]
10
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)}
11
+ spec.description = %q{Ruby Blog Post (hatena,athera,269g,cocolog,fc2,goo,jugem,livedoor,maruta,seesaa,webry,wordpress,gmail,sendmail)}
12
+ spec.summary = %q{Ruby Blog Post (hatena,athera,269g,cocolog,fc2,goo,jugem,livedoor,maruta,seesaa,webry,wordpress,gmail,sendmail)}
13
13
  spec.homepage = "https://github.com/shoprev/blogpost"
14
14
  spec.license = "MIT"
15
15
 
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_runtime_dependency "atomutil"
22
+ spec.add_runtime_dependency "mail"
22
23
  spec.add_development_dependency "bundler", "~> 1.3"
23
24
  spec.add_development_dependency "rake"
24
25
  end
@@ -0,0 +1,25 @@
1
+ module Blogpost
2
+ class Gmail
3
+ def self.post(opts={})
4
+ opts = Blogpost.options.merge(opts)
5
+ options = { :address => "smtp.gmail.com",
6
+ :port => 587,
7
+ :domain => 'gmail.com',
8
+ :user_name => opts[:user],
9
+ :password => opts[:pass],
10
+ :authentication => 'plain',
11
+ :enable_starttls_auto => true }
12
+ Mail.defaults do
13
+ delivery_method :smtp, options
14
+ end
15
+ mail = Mail.new do
16
+ to opts[:address]
17
+ from opts[:user]
18
+ subject opts[:title]
19
+ body opts[:content]
20
+ content_type 'text/html; charset=UTF-8'
21
+ end
22
+ mail.deliver
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,22 @@
1
+ module Blogpost
2
+ class Sendmail
3
+ def self.post(opts={})
4
+ opts = Blogpost.options.merge(opts)
5
+ opts[:port] = "25" unless opts.key?(:port)
6
+ opts[:host] = "localhost" unless opts.key?(:host)
7
+ opts[:user] = "from@example.com" unless opts.key?(:user)
8
+ body = <<EOT
9
+ From: #{opts[:user]}
10
+ To: #{opts[:address]}
11
+ Subject: #{opts[:title]}
12
+ Date: #{Time::now.strftime("%a, %d %b %Y %X %z")}
13
+ Content-Type: text/html; charset=UTF-8
14
+
15
+ #{opts[:content]}
16
+ EOT
17
+ Net::SMTP.start(opts[:host], opts[:port]) do |smtp|
18
+ smtp.send_mail body, opts[:user], opts[:address]
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,3 +1,3 @@
1
1
  module Blogpost
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/blogpost.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  require "atomutil"
2
+ require "mail"
3
+ require "net/smtp"
2
4
  require "xmlrpc/client"
3
5
  require "blogpost/version"
4
6
  require "blogpost/hatenablog"
@@ -14,6 +16,8 @@ require "blogpost/webry"
14
16
  require "blogpost/jugem"
15
17
  require "blogpost/cocolog"
16
18
  require "blogpost/blogg"
19
+ require "blogpost/gmail"
20
+ require "blogpost/sendmail"
17
21
 
18
22
  module XMLRPC::ParseContentType
19
23
  def parse_content_type(str)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blogpost
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - shoprev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-18 00:00:00.000000000 Z
11
+ date: 2013-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: atomutil
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: mail
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,7 +66,7 @@ dependencies:
52
66
  - - '>='
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
55
- description: Ruby Blog Post (hatena,athera,269g,cocolog,fc2,goo,jugem,livedoor,maruta,seesaa,webry,wordpress)
69
+ description: Ruby Blog Post (hatena,athera,269g,cocolog,fc2,goo,jugem,livedoor,maruta,seesaa,webry,wordpress,gmail,sendmail)
56
70
  email:
57
71
  - admin@shoprev.net
58
72
  executables: []
@@ -70,6 +84,7 @@ files:
70
84
  - lib/blogpost/blogg.rb
71
85
  - lib/blogpost/cocolog.rb
72
86
  - lib/blogpost/fc2.rb
87
+ - lib/blogpost/gmail.rb
73
88
  - lib/blogpost/goo.rb
74
89
  - lib/blogpost/hatenablog.rb
75
90
  - lib/blogpost/hatenadiary.rb
@@ -77,6 +92,7 @@ files:
77
92
  - lib/blogpost/livedoor.rb
78
93
  - lib/blogpost/maruta.rb
79
94
  - lib/blogpost/seesaa.rb
95
+ - lib/blogpost/sendmail.rb
80
96
  - lib/blogpost/version.rb
81
97
  - lib/blogpost/webry.rb
82
98
  - lib/blogpost/wordpress.rb
@@ -103,5 +119,5 @@ rubyforge_project:
103
119
  rubygems_version: 2.0.3
104
120
  signing_key:
105
121
  specification_version: 4
106
- summary: Ruby Blog Post (hatena,athera,269g,cocolog,fc2,goo,jugem,livedoor,maruta,seesaa,webry,wordpress)
122
+ summary: Ruby Blog Post (hatena,athera,269g,cocolog,fc2,goo,jugem,livedoor,maruta,seesaa,webry,wordpress,gmail,sendmail)
107
123
  test_files: []