hatenablog 0.5.1 → 0.5.2

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: ccc4d78dfaffced49de2aa8f7e9794d2767302a9
4
- data.tar.gz: 4edfad9e3555d2fecf0726049864ced76e8b5b48
3
+ metadata.gz: 22d695f3608ea9a0b666d8fed252685d3b7c19f1
4
+ data.tar.gz: e1ae79a67ac18f4f43476ee402a83f02bde88940
5
5
  SHA512:
6
- metadata.gz: dee4dd74034022f4f559ce6c24fbeb7dcaa9853451d4db59cbfbf4c85effc3c9b1a55b3434978a11011be802aef9355e3b774c5f6eca77fe558e8f2011ed00f6
7
- data.tar.gz: fe01c44cfcc8b547ea7f69791704ac7c8da279cf701422354e5f151bf9e10a4501089da6db20e3740e6a0f4ba449110d3d6ff6128caf5312e547c7d6a628b283
6
+ metadata.gz: f7daba5de0a4bb7d4629164b6339b245ed31627ff68010176a95834f24667e25c95535584a65e55abe96b1a2ccbd5c03e060c631a37e6a8b6de83e6d94df8826
7
+ data.tar.gz: a0eaad9e820e84388f053ef1f73b9734bc250fa693f3c29239e06d8e317d8552ce308f8624e450be8dc3901cdd87b8d6f0b007c1fc90e5fed4b15a46dec88bf6
data/README.md CHANGED
@@ -42,10 +42,10 @@ Access [Hatena application registoration page](http://developer.hatena.ne.jp/) a
42
42
  Execute this command:
43
43
 
44
44
  $ get_access_token <your consumer key> <your consumer 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>
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>
49
49
 
50
50
  #### 3. [Optional] Set up the YAML configuration file
51
51
 
@@ -99,15 +99,19 @@ Hatenablog::Client.create do |blog|
99
99
  end
100
100
 
101
101
  # Post new entry
102
- posted_entry = blog.post_entry('Entry Title',
103
- 'This is entry contents', # markdown form
104
- ['Test', 'Programming']) # categories
102
+ posted_entry = blog.post_entry(
103
+ 'Entry Title',
104
+ 'This is entry contents', # markdown form
105
+ ['Test', 'Programming'] # categories
106
+ )
105
107
 
106
108
  # Update entry
107
- updated_entry = blog.update_entry(posted_entry.id,
108
- 'Revised Entry Title',
109
- posted_entry.content,
110
- 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
+ )
111
115
 
112
116
  # Delete entry
113
117
  blog.delete_entry(updated_entry.id)
@@ -148,8 +152,8 @@ end
148
152
  ### Blog
149
153
 
150
154
  ```ruby
151
- client.title # Get the blog title
152
- client.author_name # Get the blog author name
155
+ client.title # Get the blog title
156
+ client.author_name # Get the blog author name
153
157
  ```
154
158
 
155
159
  ### Feeds
@@ -157,16 +161,16 @@ client.author_name # Get the blog author name
157
161
  ```ruby
158
162
  feed = client.next_feed # Get the first feed when no argument is passed
159
163
  feed.uri
160
- feed.next_uri # The next feed URI
164
+ feed.next_uri # The next feed URI
161
165
  feed.title
162
166
  feed.author_name
163
- feed.update # Updated datetime
167
+ feed.update # Updated datetime
164
168
 
165
- feed.entries # entries in the feed
169
+ feed.entries # entries in the feed
166
170
  feed.each_entry do |entry|
167
171
  # ...
168
172
  end
169
- feed.has_next? # true if the next page exists
173
+ feed.has_next? # true if the next page exists
170
174
  next_feed = client.next_feed(feed)
171
175
  ```
172
176
 
@@ -174,38 +178,41 @@ next_feed = client.next_feed(feed)
174
178
 
175
179
  ```ruby
176
180
  client.get_entry('0000000000000000000') # Get the entry specifed by its ID
177
- client.entries # Get blog entries in the first page
178
- client.entries(1) # Get blog entries in the first and the second page
179
- client.all_entries # Get all entries in the blog
180
-
181
- entry = client.post_entry('Example Title', # title
182
- 'This is the **example** entry.', # content
183
- ['Ruby', 'Rails'], # categories
184
- 'yes' # draft
185
- )
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
+ )
186
191
  entry.id
187
192
  entry.uri
188
193
  entry.edit_uri
189
194
  entry.author_name
190
- entry.title #=> 'Example Title'
191
- entry.content #=> 'This is the **example** entry.'
192
- entry.draft #=> 'yes'
193
- entry.draft? #=> true
194
- entry.categories #=> ['Ruby', 'Rails']
195
- entry.updated # Updated datetime
196
-
197
- client.update_entry(entry.id,
198
- entry.title,
199
- 'This is the **modified** example entry.',
200
- entry.categories,
201
- 'no')
195
+ entry.title #=> 'Example Title'
196
+ entry.content #=> 'This is the **example** entry.'
197
+ entry.draft #=> 'yes'
198
+ entry.draft? #=> true
199
+ entry.categories #=> ['Ruby', 'Rails']
200
+ entry.updated # Updated datetime
201
+
202
+ client.update_entry(
203
+ entry.id,
204
+ entry.title,
205
+ 'This is the **modified** example entry.',
206
+ entry.categories,
207
+ 'no'
208
+ )
202
209
  client.delete_entry(entry.id)
203
210
  ```
204
211
 
205
212
  ### Categories
206
213
 
207
214
  ```ruby
208
- categories = client.categories # Get categories registered in the blog
215
+ categories = client.categories # Get categories registered in the blog
209
216
  categories.each do |cat|
210
217
  puts cat
211
218
  end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Hatenablog
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hatenablog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kohei Yamamoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-13 00:00:00.000000000 Z
11
+ date: 2017-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  version: '0'
169
169
  requirements: []
170
170
  rubyforge_project:
171
- rubygems_version: 2.6.8
171
+ rubygems_version: 2.6.11
172
172
  signing_key:
173
173
  specification_version: 4
174
174
  summary: Hatenablog AtomPub API library