saaspose 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. data/.gitignore +1 -0
  2. data/.travis.yml +1 -0
  3. data/Gemfile.lock +4 -2
  4. data/README.md +35 -62
  5. data/lib/saaspose/cells.rb +2 -2
  6. data/lib/saaspose/configuration.rb +5 -33
  7. data/lib/saaspose/pdf.rb +6 -11
  8. data/lib/saaspose/slides.rb +3 -5
  9. data/lib/saaspose/storage.rb +11 -12
  10. data/lib/saaspose/utils.rb +32 -40
  11. data/lib/saaspose/version.rb +1 -1
  12. data/lib/saaspose/words.rb +3 -5
  13. data/saaspose.gemspec +2 -1
  14. data/spec/lib/saaspose/utils_spec.rb +18 -0
  15. data/spec/lib/saaspose_spec.rb +11 -52
  16. data/spec/spec_helper.rb +33 -1
  17. data/spec/vcr_cassettes/ensure_remote_file_saaspose_test_doc.yml +3 -3
  18. data/spec/vcr_cassettes/ensure_remote_file_saaspose_test_pdf.yml +3 -3
  19. data/spec/vcr_cassettes/ensure_remote_file_saaspose_test_ppt.yml +3 -3
  20. data/spec/vcr_cassettes/ensure_remote_file_saaspose_test_xls.yml +3 -3
  21. data/spec/vcr_cassettes/saaspose/cells_should_generate_a_pdf_from_a_remote_xls.yml +6 -43
  22. data/spec/vcr_cassettes/saaspose/pdf_should_generate_a_png_from_a_page_of_a_remote_pdf.yml +868 -0
  23. data/spec/vcr_cassettes/saaspose/pdf_should_generate_a_png_from_a_remote_pdf.yml +817 -854
  24. data/spec/vcr_cassettes/saaspose/pdf_should_read_the_number_of_pages_from_a_remote_pdf.yml +5 -8
  25. data/spec/vcr_cassettes/saaspose/slides_should_generate_a_pdf_from_a_remote_ppt.yml +2 -2
  26. data/spec/vcr_cassettes/saaspose/storage_should_get_a_list_of_files_from_the_root_dir.yml +3 -3
  27. data/spec/vcr_cassettes/saaspose/storage_should_upload_a_file_to_the_root_dir.yml +5 -6
  28. data/spec/vcr_cassettes/saaspose/words_should_generate_a_pdf_from_a_remote_doc.yml +274 -715
  29. metadata +59 -14
data/.gitignore CHANGED
@@ -0,0 +1 @@
1
+ *.gem
@@ -1,3 +1,4 @@
1
1
  script: "bundle exec rspec"
2
2
  rvm:
3
+ - 1.9.2
3
4
  - 1.9.3
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- saasposesdk (0.1.0)
4
+ saaspose (0.0.2)
5
+ confiture (~> 0.1)
5
6
  rest-client (~> 1.6)
6
7
 
7
8
  GEM
@@ -9,6 +10,7 @@ GEM
9
10
  specs:
10
11
  addressable (2.2.7)
11
12
  coderay (1.0.6)
13
+ confiture (0.1.2)
12
14
  crack (0.3.1)
13
15
  diff-lcs (1.1.3)
14
16
  method_source (0.7.1)
@@ -39,6 +41,6 @@ PLATFORMS
39
41
  DEPENDENCIES
40
42
  pry (~> 0.9)
41
43
  rspec (~> 2.9)
42
- saasposesdk!
44
+ saaspose!
43
45
  vcr (~> 2.1)
44
46
  webmock (~> 1.8)
data/README.md CHANGED
@@ -1,79 +1,52 @@
1
- #Saaspose.SDK for Ruby Repository
1
+ # Ruby bindings to Saaspose REST API
2
2
 
3
- This repository contains Saaspose.SDK for Ruby source code. This SDK allows you to work with Saaspose REST API in your Ruby applications quickly and easily.
3
+ This gem provides a access to the [Saaspose REST API](http://saaspose.com/docs/display/rest/Home).
4
4
 
5
+ ## Installation
5
6
 
6
- ##What's included in this SDK repository?
7
+ gem install saaspose
7
8
 
8
- ###Code
9
+ or using bundler
9
10
 
10
- <table>
11
- <tr>
12
- <th>Module</th>
13
- <th>Description</th>
14
- </tr>
11
+ gem "saaspose"
15
12
 
16
- <tr>
17
- <td>Common</td>
18
- <td>This module provides the features commonly used by other sections of the SDK.</td>
19
- </tr>
13
+ ## Configuration
20
14
 
21
- <tr>
22
- <td>Storage</td>
23
- <td>This module provides the features to work with Saaspose storage.</td>
24
- </tr>
15
+ Saaspose::Configuration.configure do |config|
16
+ config.app_sid = ENV["SAASPOSE_APPSID"]
17
+ config.app_key = ENV["SAASPOSE_APPKEY"]
18
+ end
25
19
 
26
- <tr>
27
- <td>Pdf</td>
28
- <td>This module provides the features to manipulate PDF files using Saaspose.Pdf.</td>
29
- </tr>
20
+ ## Usage
30
21
 
31
- <tr>
32
- <td>Words</td>
33
- <td>This module provides the features to manipulate Word files using Saaspose.Words.</td>
34
- </tr>
22
+ Please have a look at the specs to see all the examples!
35
23
 
36
- <tr>
37
- <td>Cells</td>
38
- <td>This module provides the features to manipulate Excel files using Saaspose.Cells.</td>
39
- </tr>
24
+ # generate a png from a page of a remote pdf
25
+ Saaspose::Pdf.convert("remote_pdf_file.pdf", "local_png.png", 1)
26
+ # read the number of pages from a remote pdf
27
+ Saaspose::Pdf.page_count"remote_pdf_file.pdf"
28
+ # => 1
40
29
 
41
- <tr>
42
- <td>Slides</td>
43
- <td>This module provides the features to manipulate Powerpoint files using Saaspose.Slides.</td>
44
- </tr>
30
+ # generate a pdf from a remote ppt
31
+ Saaspose::Slides.convert"remote_ppt_file.ppt", "local_pdf.pdf")
45
32
 
46
- <tr>
47
- <td>BarCode</td>
48
- <td>This module provides the features to manipulate bar codes using Saaspose.BarCode.</td>
49
- </tr>
33
+ # generate a pdf from a remote doc
34
+ Saaspose::Words.convert"remote_doc_file.doc", "local_pdf.pdf")
50
35
 
36
+ # generate a pdf from a remote xls
37
+ Saaspose::Cells.convert("remote_xls_file.xls", "local_pdf.pdf")
51
38
 
52
- </table>
53
-
54
-
55
-
56
- ###Data
57
-
58
- In order to manipulate any files, you first need to upload them to the Saaspose storage using Storage module.
59
-
60
- ###Output
61
-
62
- The Saaspose.SDK for Ruby allows you to save the output files at your specified location.
63
-
64
-
65
- ###Help Material
66
-
67
- You may get help regarding Saaspose API or Saaspose.SDK for Ruby on [www.saaspose.com](http://www.saaspose.com).
68
-
69
- ##How to use Saaspose.SDK for Ruby?
70
-
71
- Please see the Saaaspose.SDK for Ruby Examples sections in the [Documentation](http://www.saaspose.com/docs).
72
-
73
-
74
-
75
-
76
-
39
+ # upload a file to the root dir
40
+ Saaspose::Storage.upload("example.pdf", "")
77
41
 
42
+ # get a list of files from the root dir
43
+ files = Saaspose::Storage.files("")
44
+ files.first
45
+ # => <struct Saaspose::Storage::RemoteFile name="test", folder=true, modified=1969-12-31 14:00:00 +0100, size=0>
78
46
 
47
+ ## License
79
48
 
49
+ "THE BEER-WARE LICENSE" (Revision 42):
50
+ [ps@nofail.de](mailto:ps@nofail.de) wrote this file. As long as you retain this notice you
51
+ can do whatever you want with this stuff. If we meet some day, and you think
52
+ this stuff is worth it, you can buy me a beer in return Peter Schröder
@@ -2,8 +2,8 @@ module Saaspose
2
2
  class Cells
3
3
  class << self
4
4
  def convert(name, file, options={:format=>:pdf})
5
- url = "/cells/#{name}"
6
- Utils.call(url, options, file)
5
+ url = "cells/#{name}"
6
+ Utils.call_and_save(url, options, file)
7
7
  end
8
8
  end
9
9
  end
@@ -1,39 +1,11 @@
1
+ require "confiture"
1
2
  require "logger"
2
3
 
3
4
  module Saaspose
4
5
  class Configuration
5
- class << self
6
- attr_accessor :product_uri
7
- attr_accessor :app_sid, :app_key
8
- attr_accessor :logger
9
- attr_accessor :init
10
-
11
- def configure(options={})
12
- init_config
13
- if block_given?
14
- yield self
15
- else
16
- options.each do |key, value|
17
- send(:"#{key}=", value)
18
- end
19
- end
20
- self
21
- end
22
-
23
- def reset
24
- init_config(true)
25
- end
26
-
27
- private
28
-
29
- def init_config(force=false)
30
- return if @init && !force
31
- @init = true
32
- @product_uri = ""
33
- @app_key = ""
34
- @app_sid = ""
35
- @logger = Logger.new(STDERR)
36
- end
37
- end
6
+ include Confiture::Configuration
7
+ confiture_allowed_keys(:product_uri, :app_sid, :app_key, :logger)
8
+ confiture_mandatory_keys(:product_uri, :app_sid, :app_key)
9
+ confiture_defaults(:product_uri => "http://api.saaspose.com/v1.0/", :logger => Logger.new(STDERR))
38
10
  end
39
11
  end
@@ -1,20 +1,15 @@
1
- require "rexml/document"
2
-
3
1
  module Saaspose
4
2
  class Pdf
5
3
  class << self
6
- def convert(name, local_file, save_image_format, page_number, height, width)
7
- url_doc = Configuration.product_uri + '/pdf/' + name + '/pages/' + page_number + '?format=' + save_image_format + '&width=' + width + '&height=' + height
8
- signed_url = Utils.sign(url_doc)
9
- response = RestClient.get(signed_url, :accept => 'application/json')
10
- Utils.save_file(response, local_file)
4
+ def convert(name, file, page_number, options={:format=>:png, :height=>800, :width=>600})
5
+ url = "pdf/#{name}/pages/#{page_number}"
6
+ Utils.call_and_save(url, options, file)
11
7
  end
12
8
 
13
9
  def page_count(name)
14
- url_page = Configuration.product_uri + '/pdf/' + name + '/pages'
15
- signed_url = Utils.sign(url_page)
16
- response = RestClient.get(signed_url, :accept => 'application/xml')
17
- REXML::Document.new(response.body).elements.size
10
+ url = "pdf/#{name}/pages"
11
+ result = Utils.call_and_parse(url)
12
+ result["Pages"]["Links"].size
18
13
  end
19
14
  end
20
15
  end
@@ -1,11 +1,9 @@
1
1
  module Saaspose
2
2
  class Slides
3
3
  class << self
4
- def convert(name, local_file, save_format)
5
- url_doc = Configuration.product_uri + '/slides/' + name + '?format=' + save_format
6
- signed_url = Utils.sign(url_doc)
7
- response = RestClient.get(signed_url, :accept => 'application/json')
8
- Utils.save_file(response, local_file)
4
+ def convert(name, file, options={:format=>:pdf})
5
+ url = "slides/#{name}"
6
+ Utils.call_and_save(url, options, file)
9
7
  end
10
8
  end
11
9
  end
@@ -1,27 +1,26 @@
1
- require "json"
1
+ require "rest-client"
2
2
 
3
3
  module Saaspose
4
4
  class Storage
5
- File = Struct.new(:name, :folder, :modified, :size)
5
+ RemoteFile = Struct.new(:name, :folder, :modified, :size)
6
6
 
7
7
  class << self
8
8
  def upload(local_file_path, remote_folder_path)
9
- file_name = ::File.basename(local_file_path)
10
- url_file = "#{Configuration.product_uri}/storage/file/#{remote_folder_path.empty? ? "" : "/#{remote_folder_path}" }#{file_name}"
9
+ file_name = File.basename(local_file_path)
10
+ url_file = "storage/file/#{remote_folder_path.empty? ? "" : "/#{remote_folder_path}" }#{file_name}"
11
11
  signed_url = Utils.sign(url_file)
12
- RestClient.put(signed_url, ::File.new(local_file_path, 'rb'))
12
+ RestClient.put(signed_url, File.new(local_file_path, 'rb'), :accept => 'application/json')
13
13
  end
14
14
 
15
15
  def files(remote_folder_path="")
16
- url_folder = "#{Configuration.product_uri}/storage/folder"
17
- url_folder << "/#{remote_folder_path}" unless remote_folder_path.empty?
18
-
19
- signed_url = Utils.sign(url_folder)
20
- response = RestClient.get(signed_url, :accept => 'application/json')
21
- result = JSON.parse(response.body)
16
+ uri = "storage/folder"
17
+ uri << "/#{remote_folder_path}" unless remote_folder_path.empty?
18
+ result = Utils.call_and_parse(uri)
22
19
 
23
20
  result["Files"].map do |entry|
24
- File.new(entry["Name"], entry["IsFolder"], Utils.parse_date(entry["ModifiedDate"]), entry["Size"])
21
+ seconds_since_epoch = entry["ModifiedDate"].scan(/[0-9]+/)[0].to_i
22
+ date = Time.at((seconds_since_epoch-(21600000 + 18000000))/1000)
23
+ RemoteFile.new(entry["Name"], entry["IsFolder"], date, entry["Size"])
25
24
  end
26
25
  end
27
26
  end
@@ -3,60 +3,52 @@ require 'rest_client'
3
3
  require 'openssl'
4
4
  require 'base64'
5
5
  require 'uri'
6
+ require 'json'
6
7
 
7
8
  module Saaspose
8
9
  class Utils
10
+ DIGEST = OpenSSL::Digest::Digest.new('sha1')
9
11
  class << self
10
- # Signs a URI with your appSID and Key.
11
- # * :url describes the URL to sign
12
- def sign(url)
13
- url = URI.escape(url)
14
- parsed_url = URI.parse(url)
15
-
16
- url_to_sign =''
17
- if parsed_url.query.nil?
18
- url_to_sign = parsed_url.scheme+"://"+ parsed_url.host + parsed_url.path + "?appSID=" + Configuration.app_sid
19
- else
20
- url_to_sign = parsed_url.scheme+"://"+ parsed_url.host + parsed_url.path + '?' + parsed_url.query + "&appSID=" + Configuration.app_sid
21
- end
22
-
23
- # create a signature using the private key and the URL
24
- raw_signature = OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), Configuration.app_key, url_to_sign)
25
-
26
- #Convert raw to encoded string
27
- signature = Base64.strict_encode64(raw_signature).tr('+/','-_')
28
-
29
- #remove invalid character
30
- signature = signature.gsub(/[=_-]/,'=' => '', '_' => '%2f', '-' => '%2b')
31
-
32
- #Define expression
33
- pat = /%[0-9a-f]{2}/
34
-
35
- #Replace the portion matched to the above pattern to upper case
36
- 6.times do
37
- signature = signature.sub(pat, pat.match(signature).to_s.upcase)
38
- end
39
-
40
- # prepend the server and append the signature.
41
- url_to_sign + "&signature=#{signature}"
12
+ def sign(uri, options=nil)
13
+ options = options ? options.dup : {}
14
+ options.merge!(:appSID => Configuration.app_sid)
15
+ url = "#{Configuration.product_uri}#{uri}"
16
+
17
+ url << "?" << options.map{|key, value| "#{key}=#{CGI::escape(value.to_s)}"}.join("&")
18
+
19
+ signature = OpenSSL::HMAC.digest(DIGEST, Configuration.app_key, url)
20
+ signature = Base64.strict_encode64(signature).chop
21
+ signature = URI::escape(signature, /[^A-z0-9]/)
22
+
23
+ "#{url}&signature=#{signature}"
42
24
  end
43
25
 
44
- def parse_date(date_string)
45
- seconds_since_epoch = date_string.scan(/[0-9]+/)[0].to_i
46
- Time.at((seconds_since_epoch-(21600000 + 18000000))/1000)
26
+ def call(uri, options=nil)
27
+ signed_url = Utils.sign(uri, options)
28
+ log(:debug, "calling: #{signed_url}")
29
+ RestClient.get(signed_url, :accept => 'application/json')
30
+ rescue
31
+ log(:error, "error: #{$!.inspect}")
32
+ raise
47
33
  end
48
34
 
49
- def call(uri, options, file)
50
- url = "#{Configuration.product_uri}#{uri}"
51
- url << "?" << options.map{|key, value| "#{key}=#{CGI::escape(value.to_s)}"}.join("&") if options
52
- signed_url = Utils.sign(url)
53
- response = RestClient.get(signed_url, :accept => 'application/json')
35
+ def call_and_parse(uri, options=nil)
36
+ response = call(uri, options)
37
+ JSON.parse(response.body)
38
+ end
39
+
40
+ def call_and_save(uri, options, file)
41
+ response = response = call(uri, options)
54
42
  Utils.save_file(response, file)
55
43
  end
56
44
 
57
45
  def save_file(response_stream, local_file)
58
46
  File.open(local_file, "wb") { |file| file.write(response_stream.body) }
59
47
  end
48
+
49
+ def log(severity, message)
50
+ Configuration.logger.send(severity, message) if Configuration.logger
51
+ end
60
52
  end
61
53
  end
62
54
  end
@@ -1,3 +1,3 @@
1
1
  module Saaspose
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,11 +1,9 @@
1
1
  module Saaspose
2
2
  class Words
3
3
  class << self
4
- def convert(name, local_file, save_format)
5
- urlDoc = Configuration.product_uri + '/words/' + name + '?format=' + save_format
6
- signedURL = Utils.sign(urlDoc)
7
- response = RestClient.get(signedURL, :accept => 'application/json')
8
- Utils.save_file(response, local_file)
4
+ def convert(name, file, options={:format=>:pdf})
5
+ url = "words/#{name}"
6
+ Utils.call_and_save(url, options, file)
9
7
  end
10
8
  end
11
9
  end
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.summary = s.description = "Ruby bindings to Saaspose REST API"
10
10
  s.authors = ["Peter Schröder"]
11
11
  s.email = 'phoetmail@googlemail.com'
12
- s.homepage = 'http://nofail.de'
12
+ s.homepage = 'https://github.com/phoet/saaspose'
13
13
 
14
14
  s.files = `git ls-files`.split("\n")
15
15
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.require_paths = ["lib"]
18
18
 
19
19
  s.add_dependency 'rest-client', '~> 1.6'
20
+ s.add_dependency 'confiture', '~> 0.1'
20
21
 
21
22
  s.add_development_dependency 'vcr', '~> 2.1'
22
23
  s.add_development_dependency 'webmock', '~> 1.8'
@@ -0,0 +1,18 @@
1
+ require "spec_helper"
2
+
3
+ describe Saaspose::Utils do
4
+ before(:each) do
5
+ Saaspose::Configuration.configure do |config|
6
+ config.app_sid = "SAASPOSE_APPSID"
7
+ config.app_key = "SAASPOSE_APPKEY"
8
+ end
9
+ end
10
+
11
+ context "signing" do
12
+ let(:signed_url) { "http://api.saaspose.com/v1.0/path?uschi=true&a_param=yes&appSID=SAASPOSE_APPSID&signature=kOJ7Xip6DwLMBOS7ZX9%2FxCkPn1w" }
13
+
14
+ it "should sign a uri" do
15
+ Saaspose::Utils.sign("path", {:uschi => true, :a_param => :yes}).should eql(signed_url)
16
+ end
17
+ end
18
+ end
@@ -1,15 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- describe "saaspose" do
4
- REMOTE_ROOT_DIR = ""
5
-
6
- PNG_PATH = "/tmp/test.png"
7
- PDF_PATH = "/tmp/test.pdf"
8
-
9
- TEST_PDF_NAME = "saaspose_test.pdf"
10
- TEST_PPT_NAME = "saaspose_test.ppt"
11
- TEST_DOC_NAME = "saaspose_test.doc"
12
- TEST_XLS_NAME = "saaspose_test.xls"
3
+ describe Saaspose do
13
4
 
14
5
  before(:all) do
15
6
  configure_client
@@ -17,12 +8,15 @@ describe "saaspose" do
17
8
  end
18
9
 
19
10
  before(:each) do
11
+ configure_client
20
12
  [PNG_PATH, PDF_PATH].each { |path| FileUtils.rm(path) if File.exists?(path) }
21
13
  end
22
14
 
23
15
  context "pdf" do
24
- it "should generate a png from a remote pdf", :vcr => true do
25
- Saaspose::Pdf.convert(TEST_PDF_NAME, PNG_PATH, 'png', '1', '800', '600')
16
+ let(:page_number) { 1 }
17
+
18
+ it "should generate a png from a page of a remote pdf", :vcr => true do
19
+ Saaspose::Pdf.convert(TEST_PDF_NAME, PNG_PATH, page_number)
26
20
  File.exists?(PNG_PATH).should be_true
27
21
  end
28
22
 
@@ -33,14 +27,14 @@ describe "saaspose" do
33
27
 
34
28
  context "slides" do
35
29
  it "should generate a pdf from a remote ppt", :vcr => true do
36
- Saaspose::Slides.convert(TEST_PPT_NAME, PDF_PATH, 'pdf')
30
+ Saaspose::Slides.convert(TEST_PPT_NAME, PDF_PATH)
37
31
  File.exists?(PDF_PATH).should be_true
38
32
  end
39
33
  end
40
34
 
41
35
  context "words" do
42
36
  it "should generate a pdf from a remote doc", :vcr => true do
43
- Saaspose::Words.convert(TEST_DOC_NAME, PDF_PATH, 'pdf')
37
+ Saaspose::Words.convert(TEST_DOC_NAME, PDF_PATH)
44
38
  File.exists?(PDF_PATH).should be_true
45
39
  end
46
40
  end
@@ -53,53 +47,18 @@ describe "saaspose" do
53
47
  end
54
48
 
55
49
  context "storage" do
56
- let(:folder) { Saaspose::Storage::File.new("test", true, Time.at(1334562314), 0) }
50
+ let(:folder) { Saaspose::Storage::RemoteFile.new("test", true, Time.at(1334562314), 0) }
57
51
 
58
52
  it "should upload a file to the root dir", :vcr => true do
59
53
  resp = Saaspose::Storage.upload(fixture_path(TEST_PDF_NAME), REMOTE_ROOT_DIR)
60
- resp.should match("<Status>OK</Status>")
54
+ resp.should match("{\"Code\":200,\"Status\":\"OK\"}")
61
55
  end
62
56
 
63
57
  it "should get a list of files from the root dir", :vcr => true do
64
58
  files = Saaspose::Storage.files(REMOTE_ROOT_DIR)
65
- files.first.should be_an_instance_of(Saaspose::Storage::File)
59
+ files.first.should be_an_instance_of(Saaspose::Storage::RemoteFile)
66
60
  files.map(&:name).should include(TEST_PDF_NAME)
67
61
  files.first.should eql(folder)
68
62
  end
69
63
  end
70
-
71
- context "utils" do
72
- before(:each) do
73
- Saaspose::Configuration.configure do |config|
74
- config.app_sid = "SAASPOSE_APPSID"
75
- config.app_key = "SAASPOSE_APPKEY"
76
- end
77
- end
78
-
79
- let(:url) { "http://example.com/path?uschi=true&a_param=yes" }
80
- it "should sign a uri" do
81
- Saaspose::Utils.sign(url).should eql("http://example.com/path?uschi=true&a_param=yes&appSID=SAASPOSE_APPSID&signature=zl%2BjolbjggyKZ31QgflGVILu%2F0I")
82
- end
83
- end
84
- end
85
-
86
- def configure_client
87
- Saaspose::Configuration.configure do |config|
88
- config.product_uri = "http://api.saaspose.com/v1.0"
89
- config.app_sid = ENV["SAASPOSE_APPSID"]
90
- config.app_key = ENV["SAASPOSE_APPKEY"]
91
- end
92
- end
93
-
94
- def ensure_remote_file(test_file)
95
- VCR.use_cassette("ensure_remote_file #{test_file}", :record => :new_episodes, :match_requests_on => [:host, :path]) do
96
- unless Saaspose::Storage.files.map(&:name).include?(test_file)
97
- puts "uploading #{test_file} for testing purposes"
98
- Saaspose::Storage.upload(fixture_path(test_file), REMOTE_ROOT_DIR)
99
- end
100
- end
101
- end
102
-
103
- def fixture_path(name)
104
- File.expand_path("../fixtures/#{name}", File.dirname(__FILE__))
105
64
  end