netprint 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,35 +0,0 @@
1
- module Netprint
2
- class URL
3
- def initialize(session_id, userid, password)
4
- @session_id = session_id
5
- @userid = userid
6
- @password = password
7
- end
8
-
9
- def login
10
- expand(:i => @userid, :p => @password)
11
- end
12
-
13
- def upload
14
- expand(:s => @session_id, :c => 0, :m => 1)
15
- end
16
-
17
- def list
18
- expand(:s => @session_id, :c => 0, :m => 0)
19
- end
20
-
21
- private
22
-
23
- def expand(params)
24
- Addressable::Template.new(template).
25
- expand(params).
26
- to_str
27
- end
28
-
29
- def template
30
- Addressable::VERSION::STRING >= '2.2.7' ?
31
- 'https://www.printing.ne.jp/cgi-bin/mn.cgi{?i,p,s,c,m}' :
32
- 'https://www.printing.ne.jp/cgi-bin/mn.cgi?{-join|&|i,p,s,c,m}'
33
- end
34
- end
35
- end
@@ -1,11 +0,0 @@
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>
9
- ->
10
  selvalue = curfrm.papersize[i].value;
11
1
  curfrm.submit();
12
2
  for(var i=0;i<curfrm.papersize.length;i++)
13
3
  if(curfrm.papersize[i].checked==true)
14
4
  j=j+1;
15
5
 
16
- ->
17
6
  var _gaq = _gaq || [];
18
7
  _gaq.push(['_setAccount', 'UA-3871039-1']);
19
8
  _gaq.push(['_trackPageview']);
20
9
  (function() {
21
10
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
22
11
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
23
12
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
24
13
  })();
25
-
26
-
27
-
@@ -1,11 +0,0 @@
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>
9
- ->
10
  selvalue = curfrm.papersize[i].value;
11
1
  curfrm.submit();
12
2
  for(var i=0;i<curfrm.papersize.length;i++)
13
3
  if(curfrm.papersize[i].checked==true)
14
4
  j=j+1;
15
5
 
16
- ->
17
6
  var _gaq = _gaq || [];
18
7
  _gaq.push(['_setAccount', 'UA-3871039-1']);
19
8
  _gaq.push(['_trackPageview']);
20
9
  (function() {
21
10
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
22
11
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
23
12
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
24
13
  })();
25
-
26
-
27
-
@@ -1,26 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
-
3
- include Netprint
4
-
5
- describe URL do
6
- subject do
7
- URL.new(s, i, p)
8
- end
9
-
10
- let(:i) { 'username' }
11
- let(:p) { 'password' }
12
-
13
- context 'logged in' do
14
- let(:s) { 'xxxxxxxx' }
15
-
16
- its(:login) { should eql('https://www.printing.ne.jp/cgi-bin/mn.cgi?i=username&p=password') }
17
- its(:upload) { should eql('https://www.printing.ne.jp/cgi-bin/mn.cgi?s=xxxxxxxx&c=0&m=1') }
18
- its(:list) { should eql('https://www.printing.ne.jp/cgi-bin/mn.cgi?s=xxxxxxxx&c=0&m=0') }
19
- end
20
-
21
- context 'not logged in' do
22
- let(:s) { nil }
23
-
24
- its(:login) { should eql('https://www.printing.ne.jp/cgi-bin/mn.cgi?i=username&p=password') }
25
- end
26
- end