scene7-wrapper 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +5 -3
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/lib/scene7/asset.rb +38 -6
- data/scene7-wrapper.gemspec +6 -11
- data/spec/fixtures/get_active_jobs/no_publish_job.xml +89 -0
- data/spec/fixtures/get_active_jobs/one_publish_job.xml +111 -0
- data/spec/fixtures/stop_job/response.xml +6 -0
- data/spec/fixtures/submit_job/image_serving_publish_job_response.xml +8 -0
- data/spec/scene7/asset_spec.rb +77 -11
- metadata +10 -12
data/Gemfile.lock
CHANGED
@@ -9,8 +9,9 @@ GEM
|
|
9
9
|
git (1.2.5)
|
10
10
|
gyoku (0.3.1)
|
11
11
|
builder (>= 2.1.2)
|
12
|
-
httpclient (2.1.
|
13
|
-
httpi (0.
|
12
|
+
httpclient (2.1.7.1)
|
13
|
+
httpi (0.9.0)
|
14
|
+
ntlm-http (>= 0.1.1)
|
14
15
|
rack
|
15
16
|
i18n (0.5.0)
|
16
17
|
jeweler (1.5.2)
|
@@ -19,7 +20,8 @@ GEM
|
|
19
20
|
rake
|
20
21
|
linecache (0.43)
|
21
22
|
mocha (0.9.12)
|
22
|
-
|
23
|
+
ntlm-http (0.1.1)
|
24
|
+
rack (1.2.2)
|
23
25
|
rake (0.8.7)
|
24
26
|
rspec (2.5.0)
|
25
27
|
rspec-core (~> 2.5.0)
|
data/Rakefile
CHANGED
@@ -19,6 +19,7 @@ Jeweler::Tasks.new do |gem|
|
|
19
19
|
gem.description = %Q{A Scene7 wrapper for Rails 3.x apps.}
|
20
20
|
gem.email = "brian.rose@factorylabs.com"
|
21
21
|
gem.authors = ["Brian Rose", "Jim Whiteman"]
|
22
|
+
gem.test_files = []
|
22
23
|
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
23
24
|
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
24
25
|
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/scene7/asset.rb
CHANGED
@@ -27,7 +27,7 @@ module Scene7
|
|
27
27
|
dest_path = params.delete(:dest_path)
|
28
28
|
|
29
29
|
request = {
|
30
|
-
:company_handle => Client.company_handle,
|
30
|
+
:company_handle => Client.company_handle,
|
31
31
|
:job_name => job_name(source_url),
|
32
32
|
:upload_urls_job => {
|
33
33
|
:url_array => {
|
@@ -37,13 +37,13 @@ module Scene7
|
|
37
37
|
:order! => [:source_url, :dest_path]
|
38
38
|
}
|
39
39
|
},
|
40
|
-
:overwrite =>
|
41
|
-
:ready_for_publish =>
|
40
|
+
:overwrite => true,
|
41
|
+
:ready_for_publish => true,
|
42
42
|
:create_mask => false,
|
43
43
|
:email_setting => "None",
|
44
44
|
:order! => [:url_array, :overwrite, :ready_for_publish, :create_mask, :email_setting]
|
45
|
-
},
|
46
|
-
:order! => [:company_handle, :job_name, :upload_urls_job]
|
45
|
+
},
|
46
|
+
:order! => [:company_handle, :job_name, :upload_urls_job]
|
47
47
|
}
|
48
48
|
|
49
49
|
Client.perform_request(:submit_job, request)
|
@@ -63,6 +63,38 @@ module Scene7
|
|
63
63
|
def job_name(name)
|
64
64
|
Digest::SHA1.hexdigest("#{name}#{Time.now.usec}")[0..20]
|
65
65
|
end
|
66
|
+
|
67
|
+
def stop_publish_job
|
68
|
+
if job_handle = current_publish_job
|
69
|
+
Client.perform_request(:stop_job, {
|
70
|
+
:company_handle => Client.company_handle,
|
71
|
+
:job_handle => job_handle,
|
72
|
+
:order! => [:company_handle, :job_handle]
|
73
|
+
})
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def current_publish_job
|
78
|
+
response = Client.perform_request(:get_active_jobs, {
|
79
|
+
:company_handle => Client.company_handle
|
80
|
+
})
|
81
|
+
|
82
|
+
publish_jobs = response.to_hash[:get_active_jobs_return][:job_array][:items].detect{ |item| item[:image_serving_publish_job] } rescue []
|
83
|
+
publish_jobs[:job_handle] rescue nil
|
84
|
+
end
|
85
|
+
|
86
|
+
def publish
|
87
|
+
Client.perform_request(:submit_job, {
|
88
|
+
:company_handle => Client.company_handle,
|
89
|
+
:job_name => job_name("publish-"),
|
90
|
+
:image_serving_publish_job => {
|
91
|
+
:publish_type => "Full",
|
92
|
+
:email_setting => "None",
|
93
|
+
:order! => [:publish_type, :email_setting]
|
94
|
+
},
|
95
|
+
:order! => [:company_handle, :job_name, :image_serving_publish_job]
|
96
|
+
})
|
97
|
+
end
|
66
98
|
end
|
67
99
|
|
68
100
|
attr_reader :attributes
|
@@ -97,7 +129,7 @@ module Scene7
|
|
97
129
|
|
98
130
|
def destroy
|
99
131
|
response = Client.perform_request(:delete_asset, :company_handle => Client.company_handle, :asset_handle => handle, :order! => [:company_handle, :asset_handle])
|
100
|
-
|
132
|
+
response.http.code == 200
|
101
133
|
end
|
102
134
|
|
103
135
|
end
|
data/scene7-wrapper.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{scene7-wrapper}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Brian Rose", "Jim Whiteman"]
|
12
|
-
s.date = %q{2011-03-
|
12
|
+
s.date = %q{2011-03-30}
|
13
13
|
s.description = %q{A Scene7 wrapper for Rails 3.x apps.}
|
14
14
|
s.email = %q{brian.rose@factorylabs.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -38,6 +38,8 @@ Gem::Specification.new do |s|
|
|
38
38
|
"spec/fixtures/create_folder/folder.xml",
|
39
39
|
"spec/fixtures/delete_asset/success.xml",
|
40
40
|
"spec/fixtures/delete_folder/empty_response.xml",
|
41
|
+
"spec/fixtures/get_active_jobs/no_publish_job.xml",
|
42
|
+
"spec/fixtures/get_active_jobs/one_publish_job.xml",
|
41
43
|
"spec/fixtures/get_assets/all_assets.xml",
|
42
44
|
"spec/fixtures/get_assets_by_name/hat_asset.xml",
|
43
45
|
"spec/fixtures/get_assets_by_name/jacket_asset.xml",
|
@@ -47,6 +49,8 @@ Gem::Specification.new do |s|
|
|
47
49
|
"spec/fixtures/get_folders/folders.xml",
|
48
50
|
"spec/fixtures/rename_asset/failure.xml",
|
49
51
|
"spec/fixtures/rename_asset/success.xml",
|
52
|
+
"spec/fixtures/stop_job/response.xml",
|
53
|
+
"spec/fixtures/submit_job/image_serving_publish_job_response.xml",
|
50
54
|
"spec/fixtures/submit_job/upload_urls_job_response.xml",
|
51
55
|
"spec/scene7/asset_spec.rb",
|
52
56
|
"spec/scene7/client_spec.rb",
|
@@ -61,15 +65,6 @@ Gem::Specification.new do |s|
|
|
61
65
|
s.require_paths = ["lib"]
|
62
66
|
s.rubygems_version = %q{1.5.0}
|
63
67
|
s.summary = %q{A Scene7 wrapper for Rails 3.x apps.}
|
64
|
-
s.test_files = [
|
65
|
-
"spec/scene7/asset_spec.rb",
|
66
|
-
"spec/scene7/client_spec.rb",
|
67
|
-
"spec/scene7/company_spec.rb",
|
68
|
-
"spec/scene7/config_spec.rb",
|
69
|
-
"spec/scene7/crop_spec.rb",
|
70
|
-
"spec/scene7/folder_spec.rb",
|
71
|
-
"spec/spec_helper.rb"
|
72
|
-
]
|
73
68
|
|
74
69
|
if s.respond_to? :specification_version then
|
75
70
|
s.specification_version = 3
|
@@ -0,0 +1,89 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
|
3
|
+
<soapenv:Body>
|
4
|
+
<getActiveJobsReturn xmlns="http://www.scene7.com/IpsApi/xsd/2010-01-31">
|
5
|
+
<jobArray>
|
6
|
+
<items>
|
7
|
+
<companyHandle>c|110</companyHandle>
|
8
|
+
<jobHandle>j|110||3e41464dce942449a9e5b_2011-03-30-14:32:08.834|5129821</jobHandle>
|
9
|
+
<name>3e41464dce942449a9e5b_2011-03-30-14:32:08.834</name>
|
10
|
+
<originalName>3e41464dce942449a9e5b</originalName>
|
11
|
+
<type>UrlUpload</type>
|
12
|
+
<state>Running</state>
|
13
|
+
<submitUserEmail>foo@bar.com</submitUserEmail>
|
14
|
+
<locale>en-US</locale>
|
15
|
+
<serverName>saastex_100_52</serverName>
|
16
|
+
<startDate>2011-03-30T14:32:08.858-05:00</startDate>
|
17
|
+
<totalSize>0</totalSize>
|
18
|
+
<progress>0</progress>
|
19
|
+
<progressMessage>Optimizing files</progressMessage>
|
20
|
+
<lastProgressUpdate>2011-03-30T14:32:10.445-05:00</lastProgressUpdate>
|
21
|
+
<taskProgressArray>
|
22
|
+
<items>
|
23
|
+
<taskType>com.scene7.upload.UploadAsyncTaskMonitor</taskType>
|
24
|
+
<numProcessed>1</numProcessed>
|
25
|
+
<numProcessing>0</numProcessing>
|
26
|
+
<numPending>0</numPending>
|
27
|
+
<progress>1.0</progress>
|
28
|
+
<progressMessage/>
|
29
|
+
<lastProgressUpdate>2011-03-30T14:32:10.458-05:00</lastProgressUpdate>
|
30
|
+
<taskItemProgressArray/>
|
31
|
+
</items>
|
32
|
+
<items>
|
33
|
+
<taskType>com.scene7.autoset.AutoSetAsyncTaskMonitor</taskType>
|
34
|
+
<numProcessed>0</numProcessed>
|
35
|
+
<numProcessing>0</numProcessing>
|
36
|
+
<numPending>0</numPending>
|
37
|
+
<progress>0.0</progress>
|
38
|
+
<progressMessage/>
|
39
|
+
<lastProgressUpdate>2011-03-30T14:32:14.652-05:00</lastProgressUpdate>
|
40
|
+
<taskItemProgressArray/>
|
41
|
+
</items>
|
42
|
+
</taskProgressArray>
|
43
|
+
<uploadUrlsJob>
|
44
|
+
<urlArray/>
|
45
|
+
<overwrite>true</overwrite>
|
46
|
+
<readyForPublish>true</readyForPublish>
|
47
|
+
<preservePublishState>false</preservePublishState>
|
48
|
+
<createMask>false</createMask>
|
49
|
+
<preserveCrop>true</preserveCrop>
|
50
|
+
<photoshopOptions>
|
51
|
+
<process>None</process>
|
52
|
+
</photoshopOptions>
|
53
|
+
<postScriptOptions>
|
54
|
+
<process>None</process>
|
55
|
+
<resolution>72.0</resolution>
|
56
|
+
<colorspace>Auto</colorspace>
|
57
|
+
<alpha>false</alpha>
|
58
|
+
<extractSearchWords>false</extractSearchWords>
|
59
|
+
</postScriptOptions>
|
60
|
+
<pdfOptions>
|
61
|
+
<process>render</process>
|
62
|
+
<resolution>72.0</resolution>
|
63
|
+
<colorspace>Auto</colorspace>
|
64
|
+
<pdfCatalog>true</pdfCatalog>
|
65
|
+
<extractSearchWords>false</extractSearchWords>
|
66
|
+
<extractLinks>true</extractLinks>
|
67
|
+
</pdfOptions>
|
68
|
+
<illustratorOptions>
|
69
|
+
<process>None</process>
|
70
|
+
<resolution>72.0</resolution>
|
71
|
+
<colorspace>Auto</colorspace>
|
72
|
+
<alpha>false</alpha>
|
73
|
+
</illustratorOptions>
|
74
|
+
<colorManagementOptions>
|
75
|
+
<colorManagement>Default</colorManagement>
|
76
|
+
</colorManagementOptions>
|
77
|
+
<autoSetCreationOptions/>
|
78
|
+
<emailSetting>None</emailSetting>
|
79
|
+
<postJobOnlyIfFiles>false</postJobOnlyIfFiles>
|
80
|
+
<mediaOptions/>
|
81
|
+
<inDesignOptions>
|
82
|
+
<process>None</process>
|
83
|
+
</inDesignOptions>
|
84
|
+
</uploadUrlsJob>
|
85
|
+
</items>
|
86
|
+
</jobArray>
|
87
|
+
</getActiveJobsReturn>
|
88
|
+
</soapenv:Body>
|
89
|
+
</soapenv:Envelope>
|
@@ -0,0 +1,111 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
|
3
|
+
<soapenv:Body>
|
4
|
+
<getActiveJobsReturn xmlns="http://www.scene7.com/IpsApi/xsd/2010-01-31">
|
5
|
+
<jobArray>
|
6
|
+
<items>
|
7
|
+
<companyHandle>111</companyHandle>
|
8
|
+
<jobHandle>j|110||3e41464dce942449a9e5b_2011-03-30-14:32:08.834|5129821</jobHandle>
|
9
|
+
<name>3e41464dce942449a9e5b_2011-03-30-14:32:08.834</name>
|
10
|
+
<originalName>3e41464dce942449a9e5b</originalName>
|
11
|
+
<type>UrlUpload</type>
|
12
|
+
<state>Running</state>
|
13
|
+
<submitUserEmail>peter.gornell@factorylabs.com</submitUserEmail>
|
14
|
+
<locale>en-US</locale>
|
15
|
+
<serverName>saastex_100_52</serverName>
|
16
|
+
<startDate>2011-03-30T14:32:08.858-05:00</startDate>
|
17
|
+
<totalSize>0</totalSize>
|
18
|
+
<progress>0</progress>
|
19
|
+
<progressMessage>Optimizing files</progressMessage>
|
20
|
+
<lastProgressUpdate>2011-03-30T14:32:10.445-05:00</lastProgressUpdate>
|
21
|
+
<taskProgressArray>
|
22
|
+
<items>
|
23
|
+
<taskType>com.scene7.upload.UploadAsyncTaskMonitor</taskType>
|
24
|
+
<numProcessed>1</numProcessed>
|
25
|
+
<numProcessing>0</numProcessing>
|
26
|
+
<numPending>0</numPending>
|
27
|
+
<progress>1.0</progress>
|
28
|
+
<progressMessage/>
|
29
|
+
<lastProgressUpdate>2011-03-30T14:32:10.458-05:00</lastProgressUpdate>
|
30
|
+
<taskItemProgressArray/>
|
31
|
+
</items>
|
32
|
+
<items>
|
33
|
+
<taskType>com.scene7.autoset.AutoSetAsyncTaskMonitor</taskType>
|
34
|
+
<numProcessed>0</numProcessed>
|
35
|
+
<numProcessing>0</numProcessing>
|
36
|
+
<numPending>0</numPending>
|
37
|
+
<progress>0.0</progress>
|
38
|
+
<progressMessage/>
|
39
|
+
<lastProgressUpdate>2011-03-30T14:32:14.652-05:00</lastProgressUpdate>
|
40
|
+
<taskItemProgressArray/>
|
41
|
+
</items>
|
42
|
+
</taskProgressArray>
|
43
|
+
<uploadUrlsJob>
|
44
|
+
<urlArray/>
|
45
|
+
<overwrite>true</overwrite>
|
46
|
+
<readyForPublish>true</readyForPublish>
|
47
|
+
<preservePublishState>false</preservePublishState>
|
48
|
+
<createMask>false</createMask>
|
49
|
+
<preserveCrop>true</preserveCrop>
|
50
|
+
<photoshopOptions>
|
51
|
+
<process>None</process>
|
52
|
+
</photoshopOptions>
|
53
|
+
<postScriptOptions>
|
54
|
+
<process>None</process>
|
55
|
+
<resolution>72.0</resolution>
|
56
|
+
<colorspace>Auto</colorspace>
|
57
|
+
<alpha>false</alpha>
|
58
|
+
<extractSearchWords>false</extractSearchWords>
|
59
|
+
</postScriptOptions>
|
60
|
+
<pdfOptions>
|
61
|
+
<process>render</process>
|
62
|
+
<resolution>72.0</resolution>
|
63
|
+
<colorspace>Auto</colorspace>
|
64
|
+
<pdfCatalog>true</pdfCatalog>
|
65
|
+
<extractSearchWords>false</extractSearchWords>
|
66
|
+
<extractLinks>true</extractLinks>
|
67
|
+
</pdfOptions>
|
68
|
+
<illustratorOptions>
|
69
|
+
<process>None</process>
|
70
|
+
<resolution>72.0</resolution>
|
71
|
+
<colorspace>Auto</colorspace>
|
72
|
+
<alpha>false</alpha>
|
73
|
+
</illustratorOptions>
|
74
|
+
<colorManagementOptions>
|
75
|
+
<colorManagement>Default</colorManagement>
|
76
|
+
</colorManagementOptions>
|
77
|
+
<autoSetCreationOptions/>
|
78
|
+
<emailSetting>None</emailSetting>
|
79
|
+
<postJobOnlyIfFiles>false</postJobOnlyIfFiles>
|
80
|
+
<mediaOptions/>
|
81
|
+
<inDesignOptions>
|
82
|
+
<process>None</process>
|
83
|
+
</inDesignOptions>
|
84
|
+
</uploadUrlsJob>
|
85
|
+
</items>
|
86
|
+
<items>
|
87
|
+
<companyHandle>111</companyHandle>
|
88
|
+
<jobHandle>j|110||b4ab644caf2b8d253b0a5_2011-03-30-14:32:12.645|5129822</jobHandle>
|
89
|
+
<name>b4ab644caf2b8d253b0a5_2011-03-30-14:32:12.645</name>
|
90
|
+
<originalName>b4ab644caf2b8d253b0a5</originalName>
|
91
|
+
<type>ImageServingPublish</type>
|
92
|
+
<state>Running</state>
|
93
|
+
<submitUserEmail>peter.gornell@factorylabs.com</submitUserEmail>
|
94
|
+
<locale>en-US</locale>
|
95
|
+
<serverName>saastex_100_52</serverName>
|
96
|
+
<startDate>2011-03-30T14:32:12.664-05:00</startDate>
|
97
|
+
<totalSize>0</totalSize>
|
98
|
+
<progress>0</progress>
|
99
|
+
<progressMessage>Starting to generate manifest files.</progressMessage>
|
100
|
+
<lastProgressUpdate>2011-03-30T14:32:12.724-05:00</lastProgressUpdate>
|
101
|
+
<taskProgressArray/>
|
102
|
+
<imageServingPublishJob>
|
103
|
+
<publishType>Full</publishType>
|
104
|
+
<emailSetting>None</emailSetting>
|
105
|
+
<httpCompletionUrl/>
|
106
|
+
</imageServingPublishJob>
|
107
|
+
</items>
|
108
|
+
</jobArray>
|
109
|
+
</getActiveJobsReturn>
|
110
|
+
</soapenv:Body>
|
111
|
+
</soapenv:Envelope>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version='1.0' encoding='UTF-8'?>
|
2
|
+
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
|
3
|
+
<soapenv:Body>
|
4
|
+
<submitJobReturn xmlns="http://www.scene7.com/IpsApi/xsd/2010-01-31">
|
5
|
+
<jobHandle>j|110|test-publish-job-fdl||</jobHandle>
|
6
|
+
</submitJobReturn>
|
7
|
+
</soapenv:Body>
|
8
|
+
</soapenv:Envelope>
|
data/spec/scene7/asset_spec.rb
CHANGED
@@ -98,13 +98,13 @@ describe Scene7::Asset do
|
|
98
98
|
:order! => [:source_url, :dest_path]
|
99
99
|
}
|
100
100
|
},
|
101
|
-
:overwrite =>
|
102
|
-
:ready_for_publish =>
|
101
|
+
:overwrite => true,
|
102
|
+
:ready_for_publish => true,
|
103
103
|
:create_mask => false,
|
104
104
|
:email_setting => "None",
|
105
105
|
:order! => [:url_array, :overwrite, :ready_for_publish, :create_mask, :email_setting]
|
106
|
-
},
|
107
|
-
:order! => [:company_handle, :job_name, :upload_urls_job]
|
106
|
+
},
|
107
|
+
:order! => [:company_handle, :job_name, :upload_urls_job]
|
108
108
|
}).returns(:upload_urls_job_response)
|
109
109
|
end
|
110
110
|
|
@@ -114,13 +114,6 @@ describe Scene7::Asset do
|
|
114
114
|
asset = subject.create(:source_url => "http://example.com/image.jpg", :dest_path => "SomeRoot/SomeDirectory/image.jpg")
|
115
115
|
asset.should == asset_mock
|
116
116
|
end
|
117
|
-
|
118
|
-
it "gives up and assumes an error after 20 seconds" do
|
119
|
-
asset_mock = mock()
|
120
|
-
Scene7::Asset.stubs(:find_by_name).with("image").returns(nil)
|
121
|
-
|
122
|
-
expect { subject.create(:source_url => "http://example.com/image.jpg", :dest_path => "SomeRoot/SomeDirectory/image.jpg") }.to raise_error("Could not create asset")
|
123
|
-
end
|
124
117
|
end
|
125
118
|
|
126
119
|
describe ".job_name" do
|
@@ -192,4 +185,77 @@ describe Scene7::Asset do
|
|
192
185
|
subject.destroy.should be_true
|
193
186
|
end
|
194
187
|
end
|
188
|
+
|
189
|
+
describe "publish" do
|
190
|
+
before { Scene7::Client.configure(valid_config) }
|
191
|
+
subject { Scene7::Asset }
|
192
|
+
|
193
|
+
it "publishes to the enterprise internet-ready environment" do
|
194
|
+
subject.stubs(:job_name).returns("12345678901234567890")
|
195
|
+
Scene7::Client.expects(:company_handle).returns("111")
|
196
|
+
|
197
|
+
savon.expects(:submit_job).with({
|
198
|
+
:company_handle => "111",
|
199
|
+
:job_name => "12345678901234567890",
|
200
|
+
:image_serving_publish_job => {
|
201
|
+
:publish_type => "Full",
|
202
|
+
:email_setting => "None",
|
203
|
+
:order! => [:publish_type, :email_setting]
|
204
|
+
},
|
205
|
+
:order! => [:company_handle, :job_name, :image_serving_publish_job]
|
206
|
+
}).returns(:image_serving_publish_job_response)
|
207
|
+
|
208
|
+
subject.publish
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
describe ".current_publish_job" do
|
213
|
+
before { Scene7::Client.configure(valid_config) }
|
214
|
+
subject { Scene7::Asset }
|
215
|
+
|
216
|
+
it "gets the current job handle from any publish jobs running" do
|
217
|
+
Scene7::Client.expects(:company_handle).returns("111")
|
218
|
+
|
219
|
+
savon.expects(:get_active_jobs).with({
|
220
|
+
:company_handle => "111",
|
221
|
+
}).returns(:one_publish_job)
|
222
|
+
|
223
|
+
subject.current_publish_job.should == 'j|110||b4ab644caf2b8d253b0a5_2011-03-30-14:32:12.645|5129822'
|
224
|
+
end
|
225
|
+
|
226
|
+
it "returns nil if there's no publish job running" do
|
227
|
+
Scene7::Client.expects(:company_handle).returns("111")
|
228
|
+
|
229
|
+
savon.expects(:get_active_jobs).with({
|
230
|
+
:company_handle => "111",
|
231
|
+
}).returns(:no_publish_job)
|
232
|
+
|
233
|
+
subject.current_publish_job.should == nil
|
234
|
+
end
|
235
|
+
|
236
|
+
end
|
237
|
+
|
238
|
+
describe ".stop_publish_job" do
|
239
|
+
before { Scene7::Client.configure(valid_config) }
|
240
|
+
subject { Scene7::Asset }
|
241
|
+
|
242
|
+
it "gets the current job handle from any publish jobs running" do
|
243
|
+
Scene7::Client.expects(:company_handle).times(2).returns("111")
|
244
|
+
|
245
|
+
savon.expects(:get_active_jobs).with({
|
246
|
+
:company_handle => "111",
|
247
|
+
}).returns(:one_publish_job)
|
248
|
+
|
249
|
+
savon.expects(:stop_job).with({
|
250
|
+
:company_handle => '111',
|
251
|
+
:job_handle => 'j|110||b4ab644caf2b8d253b0a5_2011-03-30-14:32:12.645|5129822',
|
252
|
+
:order! => [:company_handle, :job_handle]
|
253
|
+
}).returns(:response)
|
254
|
+
|
255
|
+
subject.stop_publish_job
|
256
|
+
end
|
257
|
+
|
258
|
+
end
|
259
|
+
|
260
|
+
|
195
261
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scene7-wrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brian Rose
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-03-
|
19
|
+
date: 2011-03-30 00:00:00 -06:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -222,6 +222,8 @@ files:
|
|
222
222
|
- spec/fixtures/create_folder/folder.xml
|
223
223
|
- spec/fixtures/delete_asset/success.xml
|
224
224
|
- spec/fixtures/delete_folder/empty_response.xml
|
225
|
+
- spec/fixtures/get_active_jobs/no_publish_job.xml
|
226
|
+
- spec/fixtures/get_active_jobs/one_publish_job.xml
|
225
227
|
- spec/fixtures/get_assets/all_assets.xml
|
226
228
|
- spec/fixtures/get_assets_by_name/hat_asset.xml
|
227
229
|
- spec/fixtures/get_assets_by_name/jacket_asset.xml
|
@@ -231,6 +233,8 @@ files:
|
|
231
233
|
- spec/fixtures/get_folders/folders.xml
|
232
234
|
- spec/fixtures/rename_asset/failure.xml
|
233
235
|
- spec/fixtures/rename_asset/success.xml
|
236
|
+
- spec/fixtures/stop_job/response.xml
|
237
|
+
- spec/fixtures/submit_job/image_serving_publish_job_response.xml
|
234
238
|
- spec/fixtures/submit_job/upload_urls_job_response.xml
|
235
239
|
- spec/scene7/asset_spec.rb
|
236
240
|
- spec/scene7/client_spec.rb
|
@@ -273,11 +277,5 @@ rubygems_version: 1.5.0
|
|
273
277
|
signing_key:
|
274
278
|
specification_version: 3
|
275
279
|
summary: A Scene7 wrapper for Rails 3.x apps.
|
276
|
-
test_files:
|
277
|
-
|
278
|
-
- spec/scene7/client_spec.rb
|
279
|
-
- spec/scene7/company_spec.rb
|
280
|
-
- spec/scene7/config_spec.rb
|
281
|
-
- spec/scene7/crop_spec.rb
|
282
|
-
- spec/scene7/folder_spec.rb
|
283
|
-
- spec/spec_helper.rb
|
280
|
+
test_files: []
|
281
|
+
|