hatenablog 0.4.0 → 0.7.0

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
- SHA1:
3
- metadata.gz: 6c7e933e59b738cfcda010915591ffe89e236651
4
- data.tar.gz: 0947478b9a9a5e8d706f6d196d4755bbfd6988d3
2
+ SHA256:
3
+ metadata.gz: 2f5ba2be4110aba1299f43e9392477651511fc8f25b833fa0cbbadf19ead23b9
4
+ data.tar.gz: afbde859959d37d364e249e22b4a02206db70bd274040fb62068227f74e9447e
5
5
  SHA512:
6
- metadata.gz: a7715ef9b24771c3a73d4be1d93e9f8e873d909b0aa92442d7bbe4e706202c8b423287bbe479ba6ba899626f9fd75e11937a5c3ce33b1784bbd41a743ed7ad60
7
- data.tar.gz: df97bcf0b81ec75e4ab068d09ce597eb273fa780f60fbbf1ee82568b4ae087c144a3c8a30024ba548b6b219a92edfc6dda365b71e2917a28f7906b0954ddbd2d
6
+ metadata.gz: 3578cefbfeddc8cd8d7ebd143fc581daea4e76a8299acb2d1de0004b18ead98969f7245cd9569c216664163e0940ae54a85f0a3a73d9edeb83be8e054b5ca4d9
7
+ data.tar.gz: 34c100e0157ae121c65baf6c71cbd13b50fbcad17a6fe3e330bb4413f290632568a287c33562b72a1dc7c49eb924f93b29415f8e67544684722a1cd2bc506174
@@ -0,0 +1,32 @@
1
+ name: build
2
+
3
+ on: [pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ matrix:
10
+ ruby: ['2.4', '2.5', '2.6', '2.7']
11
+ include:
12
+ - ruby: '2.7'
13
+ report-coverage: true
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+ - uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: ${{ matrix.ruby }}
19
+ - run: gem install bundler
20
+ - run: bundle install -j4
21
+ - name: Run tests and report test coverage
22
+ if: matrix.report-coverage
23
+ uses: paambaati/codeclimate-action@v2.4.0
24
+ env:
25
+ CC_TEST_REPORTER_ID: 309cf0784d00d2a6009566d28be111a8a0280cdeb2da280225eedf577b16beb5
26
+ with:
27
+ coverageCommand: bundle exec rake
28
+ - name: Run tests
29
+ if: "!matrix.report-coverage"
30
+ env:
31
+ TZ: Asia/Tokyo
32
+ run: bundle exec rake
data/.gitignore CHANGED
@@ -28,9 +28,9 @@ build/
28
28
 
29
29
  # for a library or gem, you might want to ignore these files since the code is
30
30
  # intended to run in multiple environments; otherwise, check them in:
31
- # Gemfile.lock
32
- # .ruby-version
33
- # .ruby-gemset
31
+ Gemfile.lock
32
+ .ruby-version
33
+ .ruby-gemset
34
34
 
35
35
  # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
36
36
  .rvmrc
data/Gemfile CHANGED
@@ -1,6 +1,8 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem "codeclimate-test-reporter", group: :test, require: nil
3
+ group :test do
4
+ gem 'simplecov', '~> 0.17.1'
5
+ end
4
6
 
5
7
  # Specify your gem's dependencies in hatenablog.gemspec
6
8
  gemspec
data/README.md CHANGED
@@ -1,11 +1,12 @@
1
1
  # Hatenablog
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/hatenablog.svg)](https://badge.fury.io/rb/hatenablog) [![Build Status](https://travis-ci.org/kymmt90/hatenablog.svg?branch=master)](https://travis-ci.org/kymmt90/hatenablog)
3
+ [![Gem Version](https://badge.fury.io/rb/hatenablog.svg)](https://badge.fury.io/rb/hatenablog) [![Build Status](https://github.com/kymmt90/hatenablog/workflows/build/badge.svg)](https://github.com/kymmt90/hatenablog/actions?workflow=build)
4
4
  [![Code Climate](https://codeclimate.com/github/kymmt90/hatenablog/badges/gpa.svg)](https://codeclimate.com/github/kymmt90/hatenablog)
5
5
  [![Test Coverage](https://codeclimate.com/github/kymmt90/hatenablog/badges/coverage.svg)](https://codeclimate.com/github/kymmt90/hatenablog/coverage)
6
6
 
7
- A library for Hatenablog AtomPub API.
8
- This gem supports following operations using OAuth or Basic authorization:
7
+ > A library for Hatena Blog AtomPub API
8
+
9
+ This gem supports following operations through OAuth 1.0a or Basic authentication:
9
10
 
10
11
  - Get blog feeds, entries and categories
11
12
  - Post blog entries
@@ -28,7 +29,7 @@ Or install it yourself as:
28
29
 
29
30
  $ gem install hatenablog
30
31
 
31
- ### Get OAuth keys and tokens
32
+ ### Get OAuth credentials
32
33
 
33
34
  You need to set up OAuth 1.0a keys and tokens before using this gem.
34
35
 
@@ -41,12 +42,12 @@ Access [Hatena application registoration page](http://developer.hatena.ne.jp/) a
41
42
  Execute this command:
42
43
 
43
44
  $ get_access_token <your consumer key> <your consumer secret>
44
- Visit this website and get the PIN: https://www.hatena.com/oauth/authorize?oauth_token=XXXXXXXXXXXXXXXXXXXX
45
- Enter the PIN: <your PIN> [Enter]
46
- Access token: <your access token>
47
- Access token secret: <your access token secret>
45
+ Visit this website and get the PIN: https://www.hatena.com/oauth/authorize?oauth_token=XXXXXXXXXXXXXXXXXXXX
46
+ Enter the PIN: <your PIN> [Enter]
47
+ Access token: <your access token>
48
+ Access token secret: <your access token secret>
48
49
 
49
- #### 3. Set up the YAML configuration file
50
+ #### 3. [Optional] Set up the YAML configuration file
50
51
 
51
52
  The default configuration file name is `config.yml`:
52
53
 
@@ -70,9 +71,13 @@ user_id: <%= ENV['USER_ID'] %>
70
71
  blog_id: <%= ENV['BLOG_ID'] %>
71
72
  ```
72
73
 
73
- ### (OPTIONAL) Get Basic Authentication credentials
74
- If you want to use Basic Authentication, visit `http://blog.hatena.ne.jp/#{user_id}/#{blog_id}/config/detail`
75
- and check your API key (APIキー) and set up `config.yml` like the following.
74
+ `blog_id` means your Hatena Blog domain, like "example-user.hatenablog.com".
75
+
76
+ You also can set these configurations in your code as described in [the below section](#factories).
77
+
78
+ ### [Optional] Get Basic authentication credentials
79
+ If you want to use Basic authentication, visit `http://blog.hatena.ne.jp/#{user_id}/#{blog_id}/config/detail`
80
+ and check your API key and set up `config.yml` like the following.
76
81
 
77
82
  ```yml
78
83
  auth_type: basic
@@ -94,17 +99,137 @@ Hatenablog::Client.create do |blog|
94
99
  end
95
100
 
96
101
  # Post new entry
97
- posted_entry = blog.post_entry('Entry Title',
98
- 'This is entry contents', # markdown form
99
- ['Test', 'Programming']) # categories
102
+ posted_entry = blog.post_entry(
103
+ 'Entry Title',
104
+ 'This is entry contents', # markdown form
105
+ ['Test', 'Programming'] # categories
106
+ )
100
107
 
101
108
  # Update entry
102
- updated_entry = blog.update_entry(posted_entry.id,
103
- 'Revised Entry Title',
104
- posted_entry.content,
105
- posted_entry.categories)
109
+ updated_entry = blog.update_entry(
110
+ posted_entry.id,
111
+ 'Revised Entry Title',
112
+ posted_entry.content,
113
+ posted_entry.categories
114
+ )
106
115
 
107
116
  # Delete entry
108
117
  blog.delete_entry(updated_entry.id)
109
118
  end
110
119
  ```
120
+
121
+ ## API
122
+
123
+ ### Factories
124
+
125
+ You can create the client from the configuration file.
126
+
127
+ ```ruby
128
+ # Create the client from "./config.yml"
129
+ client = Hatenablog::Client.create
130
+
131
+ # Create the client from the specified configuration
132
+ client = Hatenablog::Client.create('../another_config.yml')
133
+
134
+ Hatenablog::Client.create do |client|
135
+ # Use the client in the block
136
+ end
137
+ ```
138
+
139
+ You can also create the client with a block for configurations.
140
+
141
+ ```ruby
142
+ client = Hatenablog::Client.new do |config|
143
+ config.consumer_key = 'XXXXXXXXXXXXXXXXXXXX'
144
+ config.consumer_secret = 'XXXXXXXXXXXXXXXXXXXX'
145
+ config.access_token = 'XXXXXXXXXXXXXXXXXXXX'
146
+ config.access_token_secret = 'XXXXXXXXXXXXXXXXXXXX'
147
+ config.user_id = 'example-user'
148
+ config.blog_id = 'example-user.hatenablog.com'
149
+ end
150
+ ```
151
+
152
+ ### Blog
153
+
154
+ ```ruby
155
+ client.title # Get the blog title
156
+ client.author_name # Get the blog author name
157
+ ```
158
+
159
+ ### Feeds
160
+
161
+ ```ruby
162
+ feed = client.next_feed # Get the first feed when no argument is passed
163
+ feed.uri
164
+ feed.next_uri # The next feed URI
165
+ feed.title
166
+ feed.author_name
167
+ feed.update # Updated datetime
168
+
169
+ feed.entries # entries in the feed
170
+ feed.each_entry do |entry|
171
+ # ...
172
+ end
173
+ feed.has_next? # true if the next page exists
174
+ next_feed = client.next_feed(feed)
175
+ ```
176
+
177
+ ### Entries
178
+
179
+ ```ruby
180
+ client.get_entry('0000000000000000000') # Get the entry specifed by its ID
181
+ client.entries # Get blog entries in the first page
182
+ client.entries(1) # Get blog entries in the first and the second page
183
+ client.all_entries # Get all entries in the blog
184
+
185
+ entry = client.post_entry(
186
+ 'Example Title', # title
187
+ 'This is the **example** entry.', # content
188
+ ['Ruby', 'Rails'], # categories
189
+ 'yes' # draft
190
+ )
191
+ entry.id
192
+ entry.uri
193
+ entry.edit_uri
194
+ entry.author_name
195
+ entry.title #=> 'Example Title'
196
+ entry.content #=> 'This is the **example** entry.'
197
+ entry.formatted_content #=> '<p>This is the <strong>example</strong> entry.</p>'
198
+ entry.draft #=> 'yes'
199
+ entry.draft? #=> true
200
+ entry.categories #=> ['Ruby', 'Rails']
201
+ entry.updated # Updated datetime
202
+
203
+ client.update_entry(
204
+ entry.id,
205
+ entry.title,
206
+ 'This is the **modified** example entry.',
207
+ entry.categories,
208
+ 'no'
209
+ )
210
+ client.delete_entry(entry.id)
211
+ ```
212
+
213
+ ### Categories
214
+
215
+ ```ruby
216
+ categories = client.categories # Get categories registered in the blog
217
+ categories.each do |cat|
218
+ puts cat
219
+ end
220
+
221
+ # When categories are fixed, you can only use those categories for your entries.
222
+ # ref: https://tools.ietf.org/html/rfc5023#section-7.2.1.1
223
+ categories.fixed?
224
+ ```
225
+
226
+ ## Contributing
227
+
228
+ 1. Create your feature branch (`git checkout -b my-new-feature`)
229
+ 2. Commit your changes (`git commit -am 'Add some feature'`)
230
+ 3. Push to the branch (`git push origin my-new-feature`)
231
+ 4. Create a new Pull Request
232
+
233
+ ## License
234
+
235
+ MIT
@@ -10,6 +10,7 @@ class AccessTokenGetter
10
10
  SITE_URI = 'https://www.hatena.com'
11
11
  REQUEST_TOKEN_URI = '/oauth/initiate?scope=read_public%2Cread_private%2Cwrite_public%2Cwrite_private'
12
12
  ACCESS_TOKEN_URI = '/oauth/token'
13
+ AUTHORIZE_URI = 'https://www.hatena.ne.jp/oauth/authorize'
13
14
 
14
15
  def initialize(consumer_key, consumer_secret)
15
16
  @consumer_key = consumer_key
@@ -19,7 +20,8 @@ class AccessTokenGetter
19
20
  oauth_callback: 'oob',
20
21
  site: SITE_URI,
21
22
  request_token_url: REQUEST_TOKEN_URI,
22
- access_token_url: ACCESS_TOKEN_URI)
23
+ access_token_url: ACCESS_TOKEN_URI,
24
+ authorize_url: AUTHORIZE_URI)
23
25
  end
24
26
 
25
27
  def get_request_token
@@ -19,15 +19,15 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.required_ruby_version = '>= 2.0'
22
+ spec.required_ruby_version = '>= 2.2'
23
23
 
24
- spec.add_development_dependency "bundler", "~> 1.6"
25
- spec.add_development_dependency "rake", "~> 10.0"
26
- spec.add_development_dependency "rr", "~> 1.1.2"
27
- spec.add_development_dependency "test-unit", "~> 3.1.4"
28
- spec.add_development_dependency "test-unit-rr", "~> 1.0.3"
29
- spec.add_development_dependency "yard", "~> 0.8.7"
24
+ spec.add_development_dependency "bundler"
25
+ spec.add_development_dependency "rake"
26
+ spec.add_development_dependency "rr"
27
+ spec.add_development_dependency "test-unit"
28
+ spec.add_development_dependency "test-unit-rr"
29
+ spec.add_development_dependency "yard"
30
30
 
31
- spec.add_dependency "nokogiri", "~> 1.6.6"
32
- spec.add_dependency "oauth", "~> 0.4.7"
31
+ spec.add_dependency "nokogiri"
32
+ spec.add_dependency "oauth"
33
33
  end
@@ -15,9 +15,11 @@ module Hatenablog
15
15
  @categories.dup
16
16
  end
17
17
 
18
- def each
18
+ def each(&block)
19
+ return enum_for(__method__) unless block_given?
20
+
19
21
  @categories.each do |category|
20
- yield category
22
+ block.call(category)
21
23
  end
22
24
  end
23
25
 
@@ -24,6 +24,16 @@ module Hatenablog
24
24
  yield blog
25
25
  end
26
26
 
27
+ def initialize(config = nil)
28
+ if block_given?
29
+ yield config = Configuration.new
30
+ config.check_valid_or_raise
31
+ end
32
+ @requester = Requester.create(config)
33
+ @user_id = config.user_id
34
+ @blog_id = config.blog_id
35
+ end
36
+
27
37
  # Get a blog title.
28
38
  # @return [String] blog title
29
39
  def title
@@ -38,20 +48,18 @@ module Hatenablog
38
48
  feed.author_name
39
49
  end
40
50
 
41
- # Get blog entries array.
51
+ # Get a enumerator of blog entries.
42
52
  # @param [Fixnum] page page number to get
43
- # @return [Array] blog entries
53
+ # @return [Hatenablog::Entries] enumerator of blog entries
44
54
  def entries(page = 0)
45
- feed = Feed.load_xml(get_collection(collection_uri).body)
46
- entries = feed.entries
47
-
48
- (1..page).each do
49
- feed = next_feed(feed)
50
- break if feed.nil?
51
- entries += feed.entries
52
- end
55
+ raise ArgumentError.new('page must be non-negative') if page < 0
56
+ Entries.new(self, page)
57
+ end
53
58
 
54
- entries
59
+ # Get all blog entries.
60
+ # @return [Hatenablog::Entries] enumerator of blog entries
61
+ def all_entries
62
+ Entries.new(self, nil)
55
63
  end
56
64
 
57
65
  # Get the next feed of the given feed.
@@ -166,15 +174,8 @@ module Hatenablog
166
174
  builder.to_xml
167
175
  end
168
176
 
169
-
170
177
  private
171
178
 
172
- def initialize(config)
173
- @requester = Requester.create(config)
174
- @user_id = config.user_id
175
- @blog_id = config.blog_id
176
- end
177
-
178
179
  def get(uri)
179
180
  @requester.get(uri)
180
181
  end
@@ -202,4 +203,23 @@ module Hatenablog
202
203
  @requester.delete(uri)
203
204
  end
204
205
  end
206
+
207
+ class Entries
208
+ include Enumerable
209
+
210
+ def initialize(client, page = 0)
211
+ @client = client
212
+ @page = page
213
+ end
214
+
215
+ def each(&block)
216
+ return enum_for(__method__) unless block_given?
217
+
218
+ current_page = 0
219
+ until (@page && current_page > @page) || !(feed = @client.next_feed(feed))
220
+ feed.entries.each { |entry| block.call(entry) }
221
+ current_page += 1
222
+ end
223
+ end
224
+ end
205
225
  end
@@ -4,20 +4,31 @@ require 'ostruct'
4
4
 
5
5
  module Hatenablog
6
6
  class Configuration < OpenStruct
7
- OAUTH_KEYS = %w(consumer_key consumer_secret access_token access_token_secret user_id blog_id)
8
- BASIC_KEYS = %w(api_key user_id blog_id)
7
+ OAUTH_KEYS = %i(consumer_key consumer_secret access_token access_token_secret user_id blog_id)
8
+ BASIC_KEYS = %i(api_key user_id blog_id)
9
9
 
10
10
  # Create a new configuration.
11
11
  # @param [String] config_file configuration file path
12
12
  # @return [Hatenablog::Configuration]
13
13
  def self.create(config_file)
14
- config = YAML.load(ERB.new(File.read(config_file)).result)
15
- keys = config['auth_type'] == 'basic' ? BASIC_KEYS : OAUTH_KEYS
16
- unless (lacking_keys = keys.select {|key| !config.has_key? key}).empty?
17
- raise ConfigurationError, "Following keys are not setup. #{lacking_keys}"
14
+ loaded_config = YAML.load(ERB.new(File.read(config_file)).result)
15
+ config = new(loaded_config)
16
+ config.check_valid_or_raise
17
+ end
18
+
19
+ def check_valid_or_raise
20
+ unless (lacking_keys = self.send(:lacking_keys)).empty?
21
+ raise ConfigurationError, "Following keys are not setup. #{lacking_keys.map(&:to_s)}"
18
22
  end
23
+ self
24
+ end
25
+
26
+ private
19
27
 
20
- new(config)
28
+ def lacking_keys
29
+ required_keys = self['auth_type'] == 'basic' ? BASIC_KEYS : OAUTH_KEYS
30
+ config_keys = to_h.keys
31
+ required_keys.select { |key| !config_keys.include?(key) }
21
32
  end
22
33
  end
23
34
 
@@ -19,6 +19,7 @@ module Hatenablog
19
19
  define_method(method) do |*args, &block|
20
20
  result = send(origin_method, *args, &block)
21
21
  send(hook)
22
+ result
22
23
  end
23
24
  end
24
25
  end
@@ -27,8 +28,9 @@ module Hatenablog
27
28
  class Entry
28
29
  extend AfterHook
29
30
 
30
- attr_accessor :uri, :author_name, :title, :content, :draft, :categories
31
+ attr_accessor :uri, :author_name, :title, :content, :draft
31
32
  attr_reader :edit_uri, :id, :updated
33
+ attr_writer :categories
32
34
 
33
35
  def updated=(date)
34
36
  @updated = Time.parse(date)
@@ -87,6 +89,11 @@ module Hatenablog
87
89
  @document.to_s.gsub(/\"/, "'")
88
90
  end
89
91
 
92
+ # @return [String]
93
+ def formatted_content
94
+ @formatted_content
95
+ end
96
+
90
97
  def self.build_xml(uri, edit_uri, author_name, title, content, draft, categories, updated)
91
98
  builder = Nokogiri::XML::Builder.new(encoding: 'utf-8') do |xml|
92
99
  xml.entry('xmlns' => 'http://www.w3.org/2005/Atom',
@@ -128,10 +135,14 @@ module Hatenablog
128
135
  @author_name = @document.at_css('author name').content
129
136
  @title = @document.at_css('title').content
130
137
  @content = @document.at_css('content').content
138
+ @formatted_content = @document.xpath('//hatena:formatted-content', hatena: 'http://www.hatena.ne.jp/info/xmlns#')[0]
139
+ @formatted_content = @formatted_content.content if @formatted_content
131
140
  @draft = @document.at_css('entry app|control app|draft').content
132
141
  @categories = parse_categories
133
- unless @document.at_css('entry updated').nil?
142
+ if @document.at_css('entry updated')
134
143
  @updated = Time.parse(@document.at_css('entry updated').content)
144
+ else
145
+ @updated = nil
135
146
  end
136
147
  end
137
148
 
@@ -3,6 +3,9 @@ require 'oauth'
3
3
 
4
4
  module Hatenablog
5
5
  module Requester
6
+ ATOM_CONTENT_TYPE = 'application/atom+xml; type=entry'.freeze
7
+ DEFAULT_HEADER = { 'Content-Type' => ATOM_CONTENT_TYPE }
8
+
6
9
  class RequestError < StandardError; end
7
10
 
8
11
  def self.create(config)
@@ -25,12 +28,7 @@ module Hatenablog
25
28
  # @param [string] uri target URI
26
29
  # @return [Net::HTTPResponse] HTTP response
27
30
  def get(uri)
28
- begin
29
- response = @access_token.get(uri)
30
- rescue => problem
31
- raise RequestError, 'Fail to GET: ' + problem.to_s
32
- end
33
- response
31
+ request(:get, uri)
34
32
  end
35
33
 
36
34
  # HTTP POST method
@@ -38,15 +36,8 @@ module Hatenablog
38
36
  # @param [string] body HTTP request body
39
37
  # @param [string] headers HTTP request headers
40
38
  # @return [Net::HTTPResponse] HTTP response
41
- def post(uri,
42
- body = '',
43
- headers = { 'Content-Type' => 'application/atom+xml; type=entry' } )
44
- begin
45
- response = @access_token.post(uri, body, headers)
46
- rescue => problem
47
- raise RequestError, 'Fail to POST: ' + problem.to_s
48
- end
49
- response
39
+ def post(uri, body = '', headers = DEFAULT_HEADER)
40
+ request(:post, uri, body: body, headers: headers)
50
41
  end
51
42
 
52
43
  # HTTP PUT method
@@ -54,29 +45,26 @@ module Hatenablog
54
45
  # @param [string] body HTTP request body
55
46
  # @param [string] headers HTTP request headers
56
47
  # @return [Net::HTTPResponse] HTTP response
57
- def put(uri,
58
- body = '',
59
- headers = { 'Content-Type' => 'application/atom+xml; type=entry' } )
60
- begin
61
- response = @access_token.put(uri, body, headers)
62
- rescue => problem
63
- raise RequestError, 'Fail to PUT: ' + problem.to_s
64
- end
65
- response
48
+ def put(uri, body = '', headers = DEFAULT_HEADER)
49
+ request(:put, uri, body: body, headers: headers)
66
50
  end
67
51
 
68
52
  # HTTP DELETE method
69
53
  # @param [string] uri target URI
70
54
  # @param [string] headers HTTP request headers
71
55
  # @return [Net::HTTPResponse] HTTP response
72
- def delete(uri,
73
- headers = { 'Content-Type' => 'application/atom+xml; type=entry' })
56
+ def delete(uri, headers = DEFAULT_HEADER)
57
+ request(:delete, uri, headers: headers)
58
+ end
59
+
60
+ private
61
+
62
+ def request(method, uri, body: nil, headers: nil)
74
63
  begin
75
- response = @access_token.delete(uri, headers)
64
+ @access_token.send(method, *[uri, body, headers].compact)
76
65
  rescue => problem
77
- raise RequestError, 'Fail to DELETE: ' + problem.to_s
66
+ raise RequestError, "Fail to #{method.upcase}: " + problem.to_s
78
67
  end
79
- response
80
68
  end
81
69
  end
82
70
 
@@ -136,7 +124,7 @@ module Hatenablog
136
124
  req.basic_auth @user_id, @api_key
137
125
  if body
138
126
  req.body = body
139
- req.content_type = 'application/atom+xml; type=entry'
127
+ req.content_type = ATOM_CONTENT_TYPE
140
128
  end
141
129
 
142
130
  http = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.port == 443)
@@ -1,3 +1,3 @@
1
1
  module Hatenablog
2
- VERSION = "0.4.0"
2
+ VERSION = "0.7.0"
3
3
  end
metadata CHANGED
@@ -1,127 +1,127 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hatenablog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kohei Yamamoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-09 00:00:00.000000000 Z
11
+ date: 2020-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.6'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.6'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rr
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 1.1.2
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 1.1.2
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: test-unit
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 3.1.4
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 3.1.4
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: test-unit-rr
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 1.0.3
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 1.0.3
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: yard
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 0.8.7
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 0.8.7
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: nokogiri
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 1.6.6
103
+ version: '0'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 1.6.6
110
+ version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: oauth
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: 0.4.7
117
+ version: '0'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: 0.4.7
124
+ version: '0'
125
125
  description: Hatenablog AtomPub API library
126
126
  email:
127
127
  - kymmt90@gmail.com
@@ -130,8 +130,8 @@ executables:
130
130
  extensions: []
131
131
  extra_rdoc_files: []
132
132
  files:
133
+ - ".github/workflows/build.yml"
133
134
  - ".gitignore"
134
- - ".travis.yml"
135
135
  - Gemfile
136
136
  - LICENSE.txt
137
137
  - README.md
@@ -160,17 +160,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
160
160
  requirements:
161
161
  - - ">="
162
162
  - !ruby/object:Gem::Version
163
- version: '2.0'
163
+ version: '2.2'
164
164
  required_rubygems_version: !ruby/object:Gem::Requirement
165
165
  requirements:
166
166
  - - ">="
167
167
  - !ruby/object:Gem::Version
168
168
  version: '0'
169
169
  requirements: []
170
- rubyforge_project:
171
- rubygems_version: 2.5.1
170
+ rubygems_version: 3.1.2
172
171
  signing_key:
173
172
  specification_version: 4
174
173
  summary: Hatenablog AtomPub API library
175
174
  test_files: []
176
- has_rdoc:
@@ -1,10 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.0.0
4
- - 2.1.0
5
- - 2.2.0
6
- env:
7
- - TZ=Asia/Tokyo
8
- addons:
9
- code_climate:
10
- repo_token: 309cf0784d00d2a6009566d28be111a8a0280cdeb2da280225eedf577b16beb5