netprint 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Netprint
1
+ # Netprint [![Build Status](https://secure.travis-ci.org/youpy/netprint.png)](http://secure.travis-ci.org/youpy/netprint)
2
2
 
3
3
  A library to use netprint(https://www.printing.ne.jp/)
4
4
 
@@ -37,8 +37,8 @@ n.upload('/path/to/file.pdf', {
37
37
  # Netprint::PAPER_SIZE::L
38
38
  :paper_size => Netprint::PAPER_SIZE::B4,
39
39
 
40
- # Netprint::COLOR::SELECT_WHEN_PRINT(default)
41
- # Netprint::COLOR::BW
40
+ # Netprint::COLOR::SELECT_WHEN_PRINT
41
+ # Netprint::COLOR::BW(default)
42
42
  # Netprint::COLOR::COLOR
43
43
  :color => Netprint::COLOR::BW,
44
44
 
@@ -51,7 +51,7 @@ module Netprint
51
51
 
52
52
  loop do
53
53
  page = mechanize.get(url.list)
54
- _, registered_name, status = page.search('//tr[@bgcolor="#CFCFE6"][1]/td')
54
+ _, registered_name, status = page.search('//tr[@bgcolor="#CFCFE6" or @bgcolor="#ff6666"][1]/td')
55
55
 
56
56
  if status.text =~ /^[0-9A-Z]{8}+$/
57
57
  code = status.text
@@ -1,3 +1,3 @@
1
1
  module Netprint
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -16,6 +16,7 @@ Gem::Specification.new do |gem|
16
16
  gem.version = Netprint::VERSION
17
17
 
18
18
  gem.add_development_dependency('rspec', ['~> 2.8.0'])
19
+ gem.add_development_dependency('rake')
19
20
  gem.add_development_dependency('netprint')
20
21
  gem.add_development_dependency('webmock')
21
22
  gem.add_dependency('mechanize', '2.5.1')
@@ -0,0 +1,11 @@
1
+ HTTP/1.1 200 OK
2
+ Content-Type: text/html
3
+ Server: Microsoft-IIS/6.0
4
+ X-Powered-By: ASP.NET
5
+ Date: Thu, 18 Oct 2012 08:42:54 GMT
6
+ Connection: close
7
+
8
+ <html>
- ->
1
9
  selvalue = curfrm.papersize[i].value;
2
10
  curfrm.submit();
3
11
  for(var i=0;i<curfrm.papersize.length;i++)
4
12
  if(curfrm.papersize[i].checked==true)
5
13
  j=j+1;
6
14
 
7
- ->
8
15
  var _gaq = _gaq || [];
9
16
  _gaq.push(['_setAccount', 'UA-3871039-1']);
10
17
  _gaq.push(['_trackPageview']);
11
18
  (function() {
12
19
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
13
20
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
14
21
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
15
22
  })();
23
+
24
+
25
+
@@ -32,4 +32,20 @@ describe Agent do
32
32
  code = @agent.upload(filename)
33
33
  code.should match(/^[0-9A-Z]{8}$/)
34
34
  end
35
+
36
+ it 'should handle registration error' do
37
+ stub_request(:get, 'https://www.printing.ne.jp/cgi-bin/mn.cgi?c=0&m=1&s=qwertyuiopoiuytrewq').
38
+ to_return(open(File.expand_path(File.dirname(__FILE__) + '/../upload.html')).read)
39
+ stub_request(:post, 'https://www.printing.ne.jp/cgi-bin/mn.cgi?c=0&m=1&s=qwertyuiopoiuytrewq').
40
+ to_return(open(File.expand_path(File.dirname(__FILE__) + '/../list.html')).read)
41
+ stub_request(:get, 'https://www.printing.ne.jp/cgi-bin/mn.cgi?c=0&m=0&s=qwertyuiopoiuytrewq').
42
+ to_return(open(File.expand_path(File.dirname(__FILE__) + '/../error.html')).read)
43
+
44
+ filename = File.expand_path(File.dirname(__FILE__) + '/../foo.pdf')
45
+ @agent.login
46
+
47
+ lambda {
48
+ @agent.upload(filename)
49
+ }.should raise_error(RegistrationError)
50
+ end
35
51
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netprint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
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-10-18 00:00:00.000000000 Z
12
+ date: 2012-10-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -27,6 +27,22 @@ dependencies:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: 2.8.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
30
46
  - !ruby/object:Gem::Dependency
31
47
  name: netprint
32
48
  requirement: !ruby/object:Gem::Requirement
@@ -112,6 +128,7 @@ files:
112
128
  - lib/netprint/url.rb
113
129
  - lib/netprint/version.rb
114
130
  - netprint.gemspec
131
+ - spec/error.html
115
132
  - spec/foo.pdf
116
133
  - spec/list.html
117
134
  - spec/netprint/agent_spec.rb
@@ -133,7 +150,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
133
150
  version: '0'
134
151
  segments:
135
152
  - 0
136
- hash: 1537278400618148257
153
+ hash: -1077446977435558909
137
154
  required_rubygems_version: !ruby/object:Gem::Requirement
138
155
  none: false
139
156
  requirements:
@@ -142,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
159
  version: '0'
143
160
  segments:
144
161
  - 0
145
- hash: 1537278400618148257
162
+ hash: -1077446977435558909
146
163
  requirements: []
147
164
  rubyforge_project:
148
165
  rubygems_version: 1.8.24
@@ -150,6 +167,7 @@ signing_key:
150
167
  specification_version: 3
151
168
  summary: A library to upload file to netprint
152
169
  test_files:
170
+ - spec/error.html
153
171
  - spec/foo.pdf
154
172
  - spec/list.html
155
173
  - spec/netprint/agent_spec.rb