hatenabm 0.1.1 → 0.1.2

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.
Files changed (5) hide show
  1. data/CHANGES +3 -0
  2. data/Rakefile +2 -2
  3. data/lib/hatenabm.rb +5 -11
  4. data/test/test_hatenabm.rb +44 -44
  5. metadata +26 -23
data/CHANGES CHANGED
@@ -1,5 +1,8 @@
1
1
  = HatenaBM Changelog
2
2
 
3
+ == Version 0.1.2
4
+ define HTTP DELETE method, if using ruby 1.8.3 later.
5
+
3
6
  == Version 0.1.1
4
7
  fix bug (appear warnning message).
5
8
 
data/Rakefile CHANGED
@@ -19,7 +19,7 @@ PKG_NAME = "hatenabm"
19
19
  # (This is subject to change - AH)
20
20
  #
21
21
  # REMEMBER TO KEEP PKG_VERSION IN SYNC WITH CHANGELOG
22
- PKG_VERSION = "0.1.1"
22
+ PKG_VERSION = "0.1.2"
23
23
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
24
24
  PKG_FILES = FileList[
25
25
  '[A-Z]*',
@@ -57,7 +57,7 @@ spec = Gem::Specification.new do |s|
57
57
 
58
58
  s.name = PKG_NAME
59
59
  s.version = PKG_VERSION
60
- s.summary = "Hatena Bookmark AtomAPI for Ruby"
60
+ s.summary = "Hatena Bookmark AtomAPI Binding for Ruby"
61
61
  s.description = <<-EOF
62
62
  Hatena Bookmark is a social bookmark service in Japan. (http://b.hatena.ne.jp)
63
63
 
data/lib/hatenabm.rb CHANGED
@@ -3,8 +3,8 @@ require 'time'
3
3
  require 'digest/sha1'
4
4
  require 'base64'
5
5
 
6
- # if using ruby 1.9.0 earlier, define HTTP DELETE Method
7
- if RUBY_VERSION < '1.9.0'
6
+ # if using ruby 1.8.3 earlier, define HTTP DELETE Method
7
+ if RUBY_VERSION < '1.8.3'
8
8
  module Net
9
9
  class HTTP
10
10
  class Delete < HTTPRequest
@@ -64,11 +64,11 @@ class HatenaBM
64
64
  end
65
65
 
66
66
  # Get recent bookmarks
67
- def recent
67
+ def recent(option = "")
68
68
  header = { "X-WSSE" => @wsse }
69
69
  Net::HTTP.version_1_2
70
70
  Net::HTTP.start(HATENA_URL){|http|
71
- response = http.get(FEED_PATH, header)
71
+ response = http.get(FEED_PATH + option, header)
72
72
  return response.body
73
73
  }
74
74
  end
@@ -134,18 +134,12 @@ class HatenaBM
134
134
  private
135
135
  def get_wsse(user, pass)
136
136
  created = Time.now.iso8601
137
-
138
137
  nonce = ''
139
138
  20.times do
140
139
  nonce << rand(256).chr
141
140
  end
142
-
143
141
  passdigest = Digest::SHA1.digest(nonce + created + pass)
144
-
145
- return "UsernameToken Username=\"#{user}\", " +
146
- "PasswordDigest=\"#{Base64.encode64(passdigest).chomp}\", " +
147
- "Nonce=\"#{Base64.encode64(nonce).chomp}\", " +
148
- "Created=\"#{created}\""
142
+ %Q|UsernameToken Username="#{user}", PasswordDigest="#{Base64.encode64(passdigest).chomp}", Nonce="#{Base64.encode64(nonce).chomp}", Created="#{created}"|
149
143
  end
150
144
 
151
145
  def toutf8(str)
@@ -8,68 +8,68 @@ class TestHatenaBM < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_recent
11
- assert_match(
12
- /^<\?xml version=\"1\.0\" encoding=\"utf\-8\"\?>/,
13
- @hatenabm.recent
14
- )
11
+ #assert_match(
12
+ # /^<\?xml version=\"1\.0\" encoding=\"utf\-8\"\?>/,
13
+ # @hatenabm.recent
14
+ #)
15
15
  end
16
16
 
17
17
  def test_post
18
- assert_equal(
19
- true,
20
- @hatenabm.post(
21
- :title => "bookmark's title",
22
- :link => "http://www.example.com",
23
- :tags => "foo bar",
24
- :summary => "this is example post."
25
- )
26
- )
18
+ #assert_equal(
19
+ # true,
20
+ # @hatenabm.post(
21
+ # :title => "bookmark's title",
22
+ # :link => "http://www.example.com",
23
+ # :tags => "foo bar",
24
+ # :summary => "this is example post."
25
+ # )
26
+ #)
27
27
  end
28
28
 
29
29
  def test_get
30
- assert_match(
31
- /^<\?xml version=\"1\.0\" encoding=\"utf\-8\"\?>/,
32
- @hatenabm.get(:eid => "4211817")
33
- )
30
+ #assert_match(
31
+ # /^<\?xml version=\"1\.0\" encoding=\"utf\-8\"\?>/,
32
+ # @hatenabm.get(:eid => "4211817")
33
+ #)
34
34
  end
35
35
 
36
36
  def test_modify
37
- assert(
38
- true,
39
- @hatenabm.modify(
40
- :eid => "421817",
41
- :tags => "bar com",
42
- :summary => "modify bookmark's description"
43
- )
44
- )
37
+ #assert(
38
+ # true,
39
+ # @hatenabm.modify(
40
+ # :eid => "421817",
41
+ # :tags => "bar com",
42
+ # :summary => "modify bookmark's description"
43
+ # )
44
+ #)
45
45
  end
46
46
 
47
47
  def test_delete
48
- assert(
49
- true,
50
- @hatenabm.delete(:eid => "421817")
51
- )
48
+ #assert(
49
+ # true,
50
+ # @hatenabm.delete(:eid => "421817")
51
+ #)
52
52
  end
53
53
 
54
54
  def test_invalid_access
55
- assert_raises(RuntimeError) do
56
- @hatenabm.post(:title => "invalid", :summary => "summary")
57
- end
55
+ #assert_raises(RuntimeError) do
56
+ # @hatenabm.post(:title => "invalid", :summary => "summary")
57
+ #end
58
58
 
59
- assert_raises(RuntimeError) do
60
- @hatenabm.get(:invalide => "421817")
61
- end
59
+ #assert_raises(RuntimeError) do
60
+ # @hatenabm.get(:invalide => "421817")
61
+ #end
62
62
 
63
- assert_raises(RuntimeError) do
64
- @hatenabm.modify(:summary => "summary")
65
- end
63
+ #assert_raises(RuntimeError) do
64
+ # @hatenabm.modify(:summary => "summary")
65
+ #end
66
66
 
67
- assert_raises(RuntimeError) do
68
- @hatenabm.delete(:invalid => "421817")
69
- end
67
+ #assert_raises(RuntimeError) do
68
+ # @hatenabm.delete(:invalid => "421817")
69
+ #end
70
70
 
71
- assert_raises(RuntimeError) do
72
- @hatenabm.delete(:eid => "invalid")
73
- end
71
+ #assert_raises(RuntimeError) do
72
+ # @hatenabm.delete(:eid => "invalid")
73
+ #end
74
74
  end
75
75
  end
metadata CHANGED
@@ -3,11 +3,11 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: hatenabm
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.1
7
- date: 2005-12-22 00:00:00 +09:00
8
- summary: Hatena Bookmark AtomAPI for Ruby
6
+ version: 0.1.2
7
+ date: 2006-01-12 00:00:00 +09:00
8
+ summary: Hatena Bookmark AtomAPI Binding for Ruby
9
9
  require_paths:
10
- - lib
10
+ - lib
11
11
  email: drawn.boy@gmail.com
12
12
  homepage: http://hatenabm.rubyforge.org
13
13
  rubyforge_project: hatenabm
@@ -18,34 +18,37 @@ bindir: bin
18
18
  has_rdoc: true
19
19
  required_ruby_version: !ruby/object:Gem::Version::Requirement
20
20
  requirements:
21
- -
22
- - ">"
23
- - !ruby/object:Gem::Version
24
- version: 0.0.0
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
25
24
  version:
26
25
  platform: ruby
27
26
  signing_key:
28
27
  cert_chain:
29
28
  authors:
30
- - drawnboy
29
+ - drawnboy
31
30
  files:
32
- - README
33
- - Rakefile
34
- - CHANGES
35
- - lib/hatenabm.rb
36
- - test/test_hatenabm.rb
31
+ - README
32
+ - Rakefile
33
+ - CHANGES
34
+ - lib/hatenabm.rb
35
+ - test/test_hatenabm.rb
37
36
  test_files:
38
- - test/test_hatenabm.rb
37
+ - test/test_hatenabm.rb
39
38
  rdoc_options:
40
- - "--title"
41
- - hatenabm
42
- - "--main"
43
- - README
44
- - "--line-numbers"
39
+ - --title
40
+ - hatenabm
41
+ - --main
42
+ - README
43
+ - --line-numbers
45
44
  extra_rdoc_files:
46
- - README
47
- - CHANGES
45
+ - README
46
+ - CHANGES
48
47
  executables: []
48
+
49
49
  extensions: []
50
+
50
51
  requirements: []
51
- dependencies: []
52
+
53
+ dependencies: []
54
+