spud_reports 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,46 @@
1
- class JobsController < ApplicationController
1
+ class JobsController < Spud::ApplicationController
2
2
  def index
3
- @printers = SpudPrinter.where(:access_token => params[:keys]).includes(:active_jobs).all
4
-
5
3
 
4
+ trys = 0
5
+ while(trys < 30)
6
+ SpudPrinter.uncached do
7
+ @printers = SpudPrinter.where(:access_token => params[:keys]).includes(:active_jobs).all
8
+ job_count = 0
9
+ puts "printer query each method"
10
+ @printers.each do |printer|
11
+ puts("Checking job count on printer")
12
+ job_count += printer.active_jobs.all.count
13
+ puts(job_count)
14
+ end
15
+ if job_count > 0
16
+ render and return
17
+ end
18
+ sleep 1
19
+ trys += 1
20
+ end
21
+ end
22
+ end
6
23
 
24
+ def show
25
+ @job = SpudPrintJob.find(params[:id])
26
+ if !@job.blank?
27
+ @job.update_attributes(:status => 1)
28
+ end
29
+ render :status => 200,:text => nil
7
30
  end
8
31
 
32
+ def update
33
+ @job = SpudPrintJob.find(params[:id])
34
+ if @job
35
+ if @job.spud_printer.key == params[:key]
36
+ @job.status = 1
37
+ #TODO DELETE ATTACHMENT_FILE
38
+ @job.save
39
+ render :text => nil,:status => 200 and return
40
+ end
41
+ end
42
+ render :text => nil,:status => 500
43
+ end
44
+
45
+
9
46
  end
@@ -1,5 +1,5 @@
1
1
  collection @printers
2
2
  attributes :id, :name, :access_token
3
3
  child :active_jobs do
4
- attributes :name,:attachment_content_type,:attachment_file_name,:pages,:status
4
+ attributes :id,:name,:attachment_content_type,:attachment_file_name,:pages,:status
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Spud
2
2
  module Reports
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spud_reports
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-05-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70225832733480 !ruby/object:Gem::Requirement
16
+ requirement: &70245881760440 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.2.2
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70225832733480
24
+ version_requirements: *70245881760440
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: spud_core
27
- requirement: &70225832761260 !ruby/object:Gem::Requirement
27
+ requirement: &70245881788700 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -35,10 +35,10 @@ dependencies:
35
35
  version: 0.9.0
36
36
  type: :runtime
37
37
  prerelease: false
38
- version_requirements: *70225832761260
38
+ version_requirements: *70245881788700
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: paperclip
41
- requirement: &70225832769680 !ruby/object:Gem::Requirement
41
+ requirement: &70245881796100 !ruby/object:Gem::Requirement
42
42
  none: false
43
43
  requirements:
44
44
  - - ! '>='
@@ -46,10 +46,10 @@ dependencies:
46
46
  version: '0'
47
47
  type: :runtime
48
48
  prerelease: false
49
- version_requirements: *70225832769680
49
+ version_requirements: *70245881796100
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: rabl
52
- requirement: &70225832765980 !ruby/object:Gem::Requirement
52
+ requirement: &70245881793260 !ruby/object:Gem::Requirement
53
53
  none: false
54
54
  requirements:
55
55
  - - ! '>='
@@ -57,10 +57,10 @@ dependencies:
57
57
  version: '0'
58
58
  type: :runtime
59
59
  prerelease: false
60
- version_requirements: *70225832765980
60
+ version_requirements: *70245881793260
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: rghost
63
- requirement: &70225832764260 !ruby/object:Gem::Requirement
63
+ requirement: &70245881807980 !ruby/object:Gem::Requirement
64
64
  none: false
65
65
  requirements:
66
66
  - - ! '>='
@@ -68,10 +68,10 @@ dependencies:
68
68
  version: '0'
69
69
  type: :runtime
70
70
  prerelease: false
71
- version_requirements: *70225832764260
71
+ version_requirements: *70245881807980
72
72
  - !ruby/object:Gem::Dependency
73
73
  name: rghost_barcode
74
- requirement: &70225832778260 !ruby/object:Gem::Requirement
74
+ requirement: &70245881805460 !ruby/object:Gem::Requirement
75
75
  none: false
76
76
  requirements:
77
77
  - - ! '>='
@@ -79,10 +79,10 @@ dependencies:
79
79
  version: '0'
80
80
  type: :runtime
81
81
  prerelease: false
82
- version_requirements: *70225832778260
82
+ version_requirements: *70245881805460
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rghost_rails
85
- requirement: &70225832772480 !ruby/object:Gem::Requirement
85
+ requirement: &70245881828200 !ruby/object:Gem::Requirement
86
86
  none: false
87
87
  requirements:
88
88
  - - ! '>='
@@ -90,10 +90,10 @@ dependencies:
90
90
  version: '0'
91
91
  type: :runtime
92
92
  prerelease: false
93
- version_requirements: *70225832772480
93
+ version_requirements: *70245881828200
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: mysql2
96
- requirement: &70225832810940 !ruby/object:Gem::Requirement
96
+ requirement: &70245881837680 !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements:
99
99
  - - ! '>='
@@ -101,7 +101,7 @@ dependencies:
101
101
  version: '0'
102
102
  type: :development
103
103
  prerelease: false
104
- version_requirements: *70225832810940
104
+ version_requirements: *70245881837680
105
105
  description: Allows management of RGhost reports as well as remote print jobs.
106
106
  email:
107
107
  - destes@redwindsw.com
@@ -200,7 +200,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
200
200
  version: '0'
201
201
  segments:
202
202
  - 0
203
- hash: -919970511823587066
203
+ hash: 4423706329032302804
204
204
  required_rubygems_version: !ruby/object:Gem::Requirement
205
205
  none: false
206
206
  requirements:
@@ -209,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
209
  version: '0'
210
210
  segments:
211
211
  - 0
212
- hash: -919970511823587066
212
+ hash: 4423706329032302804
213
213
  requirements: []
214
214
  rubyforge_project:
215
215
  rubygems_version: 1.8.15