pixiv 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -72,7 +72,10 @@ module Pixiv
72
72
  # @param [Integer] page
73
73
  # @return [Pixiv::WorkList] work list bound to +self+
74
74
  def work_list(member_or_id = member_id, page = 1)
75
- illust_list_with_class(WorkList, member_or_id, page)
75
+ list = illust_list_with_class(WorkList, member_or_id, page)
76
+ # Cheat; member_name will not found on your own work list.
77
+ list.send(:set_attrs!, member_name: member_name) if list.owner_id == member_id
78
+ list
76
79
  end
77
80
 
78
81
  # @param [Pixiv::Member, Integer] member_or_id
@@ -221,7 +224,7 @@ module Pixiv
221
224
  end
222
225
 
223
226
  def member_id_from_mypage(doc)
224
- doc.at('.profile_area a')['href'][/\d+$/].to_i
227
+ doc.at('a.user-link')['href'][/\d+$/].to_i
225
228
  end
226
229
  end
227
230
 
@@ -1,3 +1,3 @@
1
1
  module Pixiv
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -10,6 +10,12 @@ module Pixiv
10
10
  node = at!('.layout-cell .count-badge')
11
11
  node.inner_text[/\d+/].to_i
12
12
  }
13
+ # @return [String, nil] member_name
14
+ # member_name == nil if this work list is your own
15
+ lazy_attr_reader(:member_name) {
16
+ node = doc.at('.profile_area a')
17
+ node && node['title']
18
+ }
13
19
  # @return [Array<Hash{Symbol=>Object}, nil>]
14
20
  lazy_attr_reader(:page_hashes) {
15
21
  node = search!('.display_works li') \
@@ -25,13 +31,15 @@ module Pixiv
25
31
  return nil if node.at('img[src*="limit_unknown_s.png"]')
26
32
  illust_node = node.at('a')
27
33
  illust_id = illust_node['href'][/illust_id=(\d+)/, 1].to_i
28
- {
34
+ hash = {
29
35
  url: Illust.url(illust_id),
30
36
  illust_id: illust_id,
31
37
  title: illust_node.inner_text,
32
38
  member_id: member_id,
33
39
  small_image_url: illust_node.at('img')['src'],
34
40
  }
41
+ hash[:member_name] = member_name if member_name
42
+ hash
35
43
  end
36
44
  end
37
- end
45
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pixiv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-27 00:00:00.000000000 Z
12
+ date: 2013-02-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mechanize
@@ -122,18 +122,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
122
  - - ! '>='
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
- segments:
126
- - 0
127
- hash: -4267183313172500808
128
125
  required_rubygems_version: !ruby/object:Gem::Requirement
129
126
  none: false
130
127
  requirements:
131
128
  - - ! '>='
132
129
  - !ruby/object:Gem::Version
133
130
  version: '0'
134
- segments:
135
- - 0
136
- hash: -4267183313172500808
137
131
  requirements: []
138
132
  rubyforge_project:
139
133
  rubygems_version: 1.8.24
@@ -148,3 +142,4 @@ test_files:
148
142
  - spec/pixiv/member_spec.rb
149
143
  - spec/pixiv/page_spec.rb
150
144
  - spec/spec_helper.rb
145
+ has_rdoc: