crown 0.0.11 → 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.
Files changed (48) hide show
  1. data/ChangeLog +11 -3
  2. data/README.rdoc +23 -1
  3. data/Rakefile +1 -1
  4. data/VERSION +1 -1
  5. data/crown.gemspec +28 -7
  6. data/example/cgmcount.rb +65 -0
  7. data/example/feedcount.rb +50 -0
  8. data/example/sbmcount.rb +5 -1
  9. data/lib/crown.rb +4 -14
  10. data/lib/crown/backtype.rb +29 -25
  11. data/lib/crown/backtype/counter.rb +79 -0
  12. data/lib/crown/buzzurl.rb +15 -28
  13. data/lib/crown/buzzurl/counter.rb +88 -0
  14. data/lib/crown/cgm.rb +98 -0
  15. data/lib/crown/cgm/countable.rb +130 -0
  16. data/lib/crown/cgm/summarizable.rb +130 -0
  17. data/lib/crown/delicious.rb +14 -29
  18. data/lib/crown/delicious/counter.rb +88 -0
  19. data/lib/crown/facebook.rb +32 -27
  20. data/lib/crown/facebook/counter.rb +76 -0
  21. data/lib/crown/facebook/entry.rb +86 -0
  22. data/lib/crown/hatena/bookmark.rb +26 -168
  23. data/lib/crown/hatena/bookmark/counter.rb +82 -0
  24. data/lib/crown/hatena/bookmark/entry.rb +108 -0
  25. data/lib/crown/hatena/bookmark/linktrace.rb +135 -0
  26. data/lib/crown/http-wrapper.rb +201 -0
  27. data/lib/crown/livedoor/clip.rb +15 -18
  28. data/lib/crown/livedoor/clip/counter.rb +96 -0
  29. data/lib/crown/livedoor/reader.rb +16 -19
  30. data/lib/crown/livedoor/reader/counter.rb +82 -0
  31. data/lib/crown/topsy.rb +20 -21
  32. data/lib/crown/topsy/counter.rb +78 -0
  33. data/lib/crown/tweetmeme.rb +20 -21
  34. data/lib/crown/tweetmeme/counter.rb +78 -0
  35. data/lib/crown/twitter.rb +14 -31
  36. data/lib/crown/{http.rb → twitter/uri.rb} +24 -39
  37. data/lib/crown/twitter/uri/counter.rb +86 -0
  38. data/lib/crown/twitter/user.rb +76 -0
  39. data/lib/crown/twitter/user/counter.rb +85 -0
  40. data/lib/crown/twitter/user/entry.rb +96 -0
  41. data/lib/crown/yahoo.rb +7 -3
  42. data/lib/crown/yahoo/bookmark.rb +23 -28
  43. data/lib/crown/yahoo/bookmark/counter.rb +84 -0
  44. data/test/{crown_test.rb → crown-test.rb} +46 -21
  45. data/test/{test_helper.rb → test-helper.rb} +1 -1
  46. metadata +30 -9
  47. data/lib/crown/amazon.rb +0 -157
  48. data/lib/crown/amazon/ecs.rb +0 -385
data/lib/crown/buzzurl.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # buzzurl.rb
5
5
  #
6
- # Copyright (c) 2008 - 2011, clown.
6
+ # Copyright (c) 2008 - 2012, clown.
7
7
  #
8
8
  # Redistribution and use in source and binary forms, with or without
9
9
  # modification, are permitted provided that the following conditions
@@ -32,42 +32,29 @@
32
32
  #
33
33
  # --------------------------------------------------------------------------- #
34
34
  module Crown
35
- module Buzzurl
36
- require 'cgi'
37
- require 'net/http'
38
- require 'crown/http'
39
- require 'rubygems'
40
- require 'json'
41
- Net::HTTP.version_1_2
35
+ class Buzzurl
36
+ require 'crown/buzzurl/counter'
42
37
 
43
38
  # ------------------------------------------------------------------- #
44
39
  #
45
- # count
40
+ # Buzzurl.count
46
41
  #
47
- # uri に指定したページのブックマーク数を取得する.
42
+ # 指定した URL のブックマーク数を取得する.
48
43
  #
49
44
  # ------------------------------------------------------------------- #
50
- def count(uri, proxy_host = nil, proxy_port = nil)
51
- begin
52
- session = Net::HTTP.new('api.buzzurl.jp', 80, proxy_host, proxy_port)
53
- path = '/api/counter/v1/json?url=' + CGI.escape(uri)
54
- result = Crown::HTTP.get(session, path)
55
- return 0 if (result == nil || result.code.to_i != 200)
56
-
57
- json = JSON.parse(result.body)
58
- json.each { |elem|
59
- return elem['users'].to_i
60
- }
61
- rescue Exception
62
- return 0
63
- end
64
-
65
- return 0
45
+ def Buzzurl.count(uri, options = nil)
46
+ return Crown::Buzzurl::BookmarkCounter.new.count(uri, options)
66
47
  end
67
48
 
68
49
  # ------------------------------------------------------------------- #
69
- # module functions
50
+ #
51
+ # count
52
+ #
53
+ # 指定した URL のブックマーク数を取得する.
54
+ #
70
55
  # ------------------------------------------------------------------- #
71
- module_function :count
56
+ def count(uri, options = nil)
57
+ return Crown::Buzzurl::BookmarkCounter.new.count(uri, options)
58
+ end
72
59
  end # Buzzurl
73
60
  end # Crown
@@ -0,0 +1,88 @@
1
+ # -*- coding: utf-8 -*-
2
+ # --------------------------------------------------------------------------- #
3
+ #
4
+ # buzzurl/counter.rb
5
+ #
6
+ # Copyright (c) 2008 - 2012, clown.
7
+ #
8
+ # Redistribution and use in source and binary forms, with or without
9
+ # modification, are permitted provided that the following conditions
10
+ # are met:
11
+ #
12
+ # - Redistributions of source code must retain the above copyright
13
+ # notice, this list of conditions and the following disclaimer.
14
+ # - Redistributions in binary form must reproduce the above copyright
15
+ # notice, this list of conditions and the following disclaimer in the
16
+ # documentation and/or other materials provided with the distribution.
17
+ # - No names of its contributors may be used to endorse or promote
18
+ # products derived from this software without specific prior written
19
+ # permission.
20
+ #
21
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
27
+ # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
+ #
33
+ # --------------------------------------------------------------------------- #
34
+ module Crown
35
+ class Buzzurl
36
+ # --------------------------------------------------------------- #
37
+ #
38
+ # BookmarkCounter
39
+ #
40
+ # 指定した URL のブックマーク数を取得するクラス.
41
+ #
42
+ # --------------------------------------------------------------- #
43
+ class BookmarkCounter
44
+ require 'cgi'
45
+ require 'crown/cgm/countable'
46
+ require 'rubygems'
47
+ require 'json'
48
+
49
+ # --------------------------------------------------------------- #
50
+ # Mix-in modules
51
+ # --------------------------------------------------------------- #
52
+ include Crown::CGM::Countable
53
+
54
+ private
55
+ # --------------------------------------------------------------- #
56
+ # address
57
+ # --------------------------------------------------------------- #
58
+ def address()
59
+ return 'api.buzzurl.jp'
60
+ end
61
+
62
+ # --------------------------------------------------------------- #
63
+ # path
64
+ # --------------------------------------------------------------- #
65
+ def path()
66
+ return '/api/counter/v1/json'
67
+ end
68
+
69
+ # --------------------------------------------------------------- #
70
+ # query
71
+ # --------------------------------------------------------------- #
72
+ def query(uri, options)
73
+ return '?url=' + CGI.escape(uri)
74
+ end
75
+
76
+ # --------------------------------------------------------------- #
77
+ # parse
78
+ # --------------------------------------------------------------- #
79
+ def parse(body)
80
+ json = JSON.parse(body)
81
+ json.each { |elem|
82
+ return elem['users'].to_i
83
+ }
84
+ return error_value()
85
+ end
86
+ end # BookmarkCounter
87
+ end # Buzzurl
88
+ end # Crown
data/lib/crown/cgm.rb ADDED
@@ -0,0 +1,98 @@
1
+ # -*- coding: utf-8 -*-
2
+ # --------------------------------------------------------------------------- #
3
+ #
4
+ # cgm.rb
5
+ #
6
+ # Copyright (c) 2008 - 2012, clown.
7
+ #
8
+ # Redistribution and use in source and binary forms, with or without
9
+ # modification, are permitted provided that the following conditions
10
+ # are met:
11
+ #
12
+ # - Redistributions of source code must retain the above copyright
13
+ # notice, this list of conditions and the following disclaimer.
14
+ # - Redistributions in binary form must reproduce the above copyright
15
+ # notice, this list of conditions and the following disclaimer in the
16
+ # documentation and/or other materials provided with the distribution.
17
+ # - No names of its contributors may be used to endorse or promote
18
+ # products derived from this software without specific prior written
19
+ # permission.
20
+ #
21
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
27
+ # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
+ #
33
+ # --------------------------------------------------------------------------- #
34
+ module Crown
35
+ module CGM
36
+ require 'crown/twitter'
37
+ require 'crown/topsy'
38
+ require 'crown/tweetmeme'
39
+ require 'crown/backtype'
40
+ require 'crown/facebook'
41
+ require 'crown/hatena/bookmark'
42
+ require 'crown/livedoor/clip'
43
+ require 'crown/livedoor/reader'
44
+ require 'crown/delicious'
45
+ require 'crown/buzzurl'
46
+ require 'crown/yahoo/bookmark'
47
+
48
+ # ------------------------------------------------------------------- #
49
+ #
50
+ # proxy
51
+ #
52
+ # シンボルを利用して目的の CGM の API へアクセスするための
53
+ # Abstract Factory メソッド.実装されている CGM は以下の通り:
54
+ #
55
+ # - Twitter
56
+ # http://twitter.com/
57
+ # - Topsy (Twitter のりツイート数カウントサービス)
58
+ # http://topsy.com/
59
+ # - TweetMeme (同上)
60
+ # http://tweetmeme.com/
61
+ # - BackType (BackTweets, 同上,要 API key)
62
+ # http://backtweets.com/
63
+ # - Facebook
64
+ # http://www.facebook.com/
65
+ # - はてなブックマーク
66
+ # http://b.hatena.ne.jp/
67
+ # - Livedoor クリップ
68
+ # http://clip.livedoor.com/
69
+ # - Livedoor Reader
70
+ # http://reader.livedoor.com/
71
+ # - Delicious
72
+ # http://delicious.com/
73
+ # - Buzzurl
74
+ # http://buzzurl.jp/
75
+ # - Yahoo! ブックマーク
76
+ # http://bookmarks.yahoo.co.jp/
77
+ #
78
+ # ------------------------------------------------------------------- #
79
+ def proxy(service)
80
+ case service
81
+ when :twitter_user then return Crown::Twitter::User.new
82
+ when :twitter_uri then return Crown::Twitter::URI.new
83
+ when :topsy then return Crown::Topsy.new
84
+ when :tweetmeme then return Crown::TweetMeme.new
85
+ when :backtype then return Crown::BackType.new
86
+ when :facebook then return Crown::Facebook.new
87
+ when :hatena_bookmark then return Crown::Hatena::Bookmark.new
88
+ when :livedoor_clip then return Crown::Livedoor::Clip.new
89
+ when :livedoor_reader then return Crown::Livedoor::Reader.new
90
+ when :delicious then return Crown::Delicious.new
91
+ when :buzzurl then return Crown::Buzzurl.new
92
+ when :yahoo_bookmark then return Crown::Yahoo::Bookmark.new
93
+ else return nil
94
+ end
95
+ end
96
+ module_function :proxy
97
+ end # CGM
98
+ end # Crown
@@ -0,0 +1,130 @@
1
+ # -*- coding: utf-8 -*-
2
+ # --------------------------------------------------------------------------- #
3
+ #
4
+ # cgm/countable.rb
5
+ #
6
+ # Copyright (c) 2008 - 2012, clown.
7
+ #
8
+ # Redistribution and use in source and binary forms, with or without
9
+ # modification, are permitted provided that the following conditions
10
+ # are met:
11
+ #
12
+ # - Redistributions of source code must retain the above copyright
13
+ # notice, this list of conditions and the following disclaimer.
14
+ # - Redistributions in binary form must reproduce the above copyright
15
+ # notice, this list of conditions and the following disclaimer in the
16
+ # documentation and/or other materials provided with the distribution.
17
+ # - No names of its contributors may be used to endorse or promote
18
+ # products derived from this software without specific prior written
19
+ # permission.
20
+ #
21
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
27
+ # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
+ #
33
+ # --------------------------------------------------------------------------- #
34
+ module Crown
35
+ module CGM
36
+ # ------------------------------------------------------------------- #
37
+ #
38
+ # Countable
39
+ #
40
+ # はてなブックマークのブックマーク数や Twitter のツイート数の
41
+ # ように,ある URL に対して何らかのカウント値を API 経由で提供
42
+ # している CGM 用の Mix-in.
43
+ #
44
+ # ------------------------------------------------------------------- #
45
+ module Countable
46
+ require 'crown/http-wrapper'
47
+
48
+ # --------------------------------------------------------------- #
49
+ #
50
+ # address
51
+ #
52
+ # カウント値を取得する API のドメインを返すメソッド.
53
+ # インクルードしたクラスが再定義する必要がある.
54
+ #
55
+ # --------------------------------------------------------------- #
56
+ def address()
57
+ return 'example.com'
58
+ end
59
+
60
+ # --------------------------------------------------------------- #
61
+ #
62
+ # port
63
+ #
64
+ # カウント値を取得する API のポート番号を返すメソッド.
65
+ # 多くの場合は標準の HTTP 通信(ポート番号 80)で通信が行われる
66
+ # ので,必要な場合のみ再定義する.
67
+ #
68
+ # --------------------------------------------------------------- #
69
+ def port()
70
+ return 80
71
+ end
72
+
73
+ # --------------------------------------------------------------- #
74
+ # path
75
+ # --------------------------------------------------------------- #
76
+ def path()
77
+ return '/'
78
+ end
79
+
80
+ # --------------------------------------------------------------- #
81
+ # query
82
+ # --------------------------------------------------------------- #
83
+ def query(uri, options)
84
+ return uri
85
+ end
86
+
87
+ # --------------------------------------------------------------- #
88
+ # parse
89
+ # --------------------------------------------------------------- #
90
+ def parse(body)
91
+ return error_value()
92
+ end
93
+
94
+ # --------------------------------------------------------------- #
95
+ #
96
+ # error_value
97
+ #
98
+ # 何らかの理由で指定した CGM からカウント値が取得できなかった
99
+ # 場合に返す値を定義するためのメソッド.
100
+ #
101
+ # --------------------------------------------------------------- #
102
+ def error_value()
103
+ return -1
104
+ end
105
+
106
+ # --------------------------------------------------------------- #
107
+ # count
108
+ # --------------------------------------------------------------- #
109
+ def count(uri, options = nil)
110
+ begin
111
+ proxy_addr = nil
112
+ proxy_port = nil
113
+ if (options.class == Hash)
114
+ proxy_addr = options[:proxy_address] if (options.has_key?(:proxy_address))
115
+ proxy_port = options[:proxy_port] if (options.has_key?(:proxy_port))
116
+ end
117
+
118
+ Crown::HTTPWrapper.start(address(), port(), proxy_addr, proxy_port) { |session|
119
+ str = path() + query(uri, options)
120
+ response = session.get(str)
121
+ return error_value() if (response == nil || response.code.to_i != 200)
122
+ return parse(response.body)
123
+ }
124
+ rescue Exception => e
125
+ return error_value()
126
+ end
127
+ end
128
+ end # Countable
129
+ end # CGM
130
+ end # Crown
@@ -0,0 +1,130 @@
1
+ # -*- coding: utf-8 -*-
2
+ # --------------------------------------------------------------------------- #
3
+ #
4
+ # cgm/summarizable.rb
5
+ #
6
+ # Copyright (c) 2008 - 2012, clown.
7
+ #
8
+ # Redistribution and use in source and binary forms, with or without
9
+ # modification, are permitted provided that the following conditions
10
+ # are met:
11
+ #
12
+ # - Redistributions of source code must retain the above copyright
13
+ # notice, this list of conditions and the following disclaimer.
14
+ # - Redistributions in binary form must reproduce the above copyright
15
+ # notice, this list of conditions and the following disclaimer in the
16
+ # documentation and/or other materials provided with the distribution.
17
+ # - No names of its contributors may be used to endorse or promote
18
+ # products derived from this software without specific prior written
19
+ # permission.
20
+ #
21
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
27
+ # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
+ #
33
+ # --------------------------------------------------------------------------- #
34
+ module Crown
35
+ module CGM
36
+ # ------------------------------------------------------------------- #
37
+ #
38
+ # Countable
39
+ #
40
+ # �͂Ăȃu�b�N�}�[�N�̃u�b�N�}�[�N���� Twitter �̃c�C�[�g����
41
+ # �悤�ɁC���� URL �ɑ΂��ĉ��炩�̃J�E���g�l�� API �o�R�Œ�
42
+ # ������ CGM �p�� Mix-in.
43
+ #
44
+ # ------------------------------------------------------------------- #
45
+ module Summarizable
46
+ require 'crown/http-wrapper'
47
+
48
+ # --------------------------------------------------------------- #
49
+ #
50
+ # address
51
+ #
52
+ # API �̃h���C����Ԃ����\�b�h�D
53
+ # �C���N���[�h�����N���X����`����K�v������D
54
+ #
55
+ # --------------------------------------------------------------- #
56
+ def address()
57
+ return 'example.com'
58
+ end
59
+
60
+ # --------------------------------------------------------------- #
61
+ #
62
+ # port
63
+ #
64
+ # API �̃|�[�g�ԍ���Ԃ����\�b�h�D
65
+ # �����̏ꍇ�͕W���� HTTP �ʐM�i�|�[�g�ԍ� 80�j�ŒʐM���s����
66
+ # �̂ŁC�K�v�ȏꍇ�̂ݍĒ�`����D
67
+ #
68
+ # --------------------------------------------------------------- #
69
+ def port()
70
+ return 80
71
+ end
72
+
73
+ # --------------------------------------------------------------- #
74
+ # path
75
+ # --------------------------------------------------------------- #
76
+ def path()
77
+ return '/'
78
+ end
79
+
80
+ # --------------------------------------------------------------- #
81
+ # query
82
+ # --------------------------------------------------------------- #
83
+ def query(uri, options)
84
+ return uri
85
+ end
86
+
87
+ # --------------------------------------------------------------- #
88
+ # parse
89
+ # --------------------------------------------------------------- #
90
+ def parse(body)
91
+ return error_value()
92
+ end
93
+
94
+ # --------------------------------------------------------------- #
95
+ #
96
+ # error_value
97
+ #
98
+ # ���炩�̗��R�Ŏw�肵�� CGM ����J�E���g�l���擾�ł��Ȃ�����
99
+ # �ꍇ�ɕԂ��l���`���邽�߂̃��\�b�h�D
100
+ #
101
+ # --------------------------------------------------------------- #
102
+ def error_value()
103
+ return nil
104
+ end
105
+
106
+ # --------------------------------------------------------------- #
107
+ # summary
108
+ # --------------------------------------------------------------- #
109
+ def summary(uri, options = nil)
110
+ begin
111
+ proxy_addr = nil
112
+ proxy_port = nil
113
+ if (options.class == Hash)
114
+ proxy_addr = options[:proxy_address] if (options.has_key?(:proxy_address))
115
+ proxy_port = options[:proxy_port] if (options.has_key?(:proxy_port))
116
+ end
117
+
118
+ Crown::HTTPWrapper.start(address(), port(), proxy_addr, proxy_port) { |session|
119
+ str = path() + query(uri, options)
120
+ response = session.get(str)
121
+ return error_value() if (response == nil || response.code.to_i != 200)
122
+ return parse(response.body)
123
+ }
124
+ rescue Exception => e
125
+ return error_value()
126
+ end
127
+ end
128
+ end # Summarizable
129
+ end # CGM
130
+ end # Crown