flickr_offline_gallery 0.0.2 → 0.0.3
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.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rspec +2 -0
- data/Gemfile +9 -0
- data/{LICENSE.txt → _LICENSE.txt} +0 -0
- data/bin/flickr_offline_gallery +2 -1
- data/erb/photo.html.erb +23 -2
- data/erb/photoset.html.erb +2 -1
- data/fixtures/vcr_cassettes/full_photo_sizes.yml +152 -0
- data/fixtures/vcr_cassettes/full_photo_sizes_with_janky_metadata.yml +147 -0
- data/fixtures/vcr_cassettes/image_downloads.yml +15096 -0
- data/fixtures/vcr_cassettes/init.yml +160 -0
- data/fixtures/vcr_cassettes/photo.yml +71 -0
- data/fixtures/vcr_cassettes/photo_sizes.yml +84 -0
- data/fixtures/vcr_cassettes/photo_with_janky_metadata.yml +70 -0
- data/fixtures/vcr_cassettes/photoset.yml +663 -0
- data/fixtures/vcr_cassettes/photset_downloader_spec.yml +1017 -0
- data/flickr_offline_gallery.gemspec +2 -1
- data/lib/flickr_offline_gallery/flickr_a_p_i.rb +23 -0
- data/lib/flickr_offline_gallery/gallery_generator.rb +26 -0
- data/lib/flickr_offline_gallery/path_manager.rb +37 -0
- data/lib/flickr_offline_gallery/photo.rb +28 -21
- data/lib/flickr_offline_gallery/photo_page.rb +23 -0
- data/lib/flickr_offline_gallery/photo_size.rb +9 -4
- data/lib/flickr_offline_gallery/photo_sizes.rb +11 -7
- data/lib/flickr_offline_gallery/photoset.rb +27 -6
- data/lib/flickr_offline_gallery/photoset_downloader.rb +21 -5
- data/lib/flickr_offline_gallery/photoset_index_page.rb +17 -0
- data/lib/flickr_offline_gallery/template_renderer.rb +42 -0
- data/lib/flickr_offline_gallery/verbose_puts.rb +8 -0
- data/lib/flickr_offline_gallery/version.rb +1 -1
- data/lib/flickr_offline_gallery.rb +7 -40
- data/spec/flickr_offline_gallery/gallery_generator_spec.rb +35 -0
- data/spec/flickr_offline_gallery/path_manager_spec.rb +34 -0
- data/spec/flickr_offline_gallery/photo_page_spec.rb +42 -0
- data/spec/flickr_offline_gallery/photo_size_spec.rb +32 -0
- data/spec/flickr_offline_gallery/photo_sizes_spec.rb +23 -0
- data/spec/flickr_offline_gallery/photo_spec.rb +81 -0
- data/spec/flickr_offline_gallery/photoset_downloader_spec.rb +27 -0
- data/spec/flickr_offline_gallery/photoset_spec.rb +35 -0
- data/spec/flickr_offline_gallery/template_renderer_spec.rb +51 -0
- data/spec/flickr_offline_gallery/verbose_puts_spec.rb +33 -0
- data/spec/spec_helper.rb +82 -0
- metadata +59 -5
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module FlickrOfflineGallery
|
4
|
+
|
5
|
+
describe GalleryGenerator do
|
6
|
+
subject!(:photoset) do
|
7
|
+
VCR.use_cassette('photoset') do
|
8
|
+
Photoset.new("72157639475533743",
|
9
|
+
:output_path => SPEC_TMP_DIR)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
subject(:generator) { described_class.new(photoset) }
|
14
|
+
|
15
|
+
it "Should render a photoset gallery" do
|
16
|
+
VCR.use_cassette('image_downloads') do
|
17
|
+
generator.render_photoset("medium")
|
18
|
+
end
|
19
|
+
expect(Dir.glob(File.join(SPEC_TMP_DIR, "**", "*")).map do |path|
|
20
|
+
path.sub(SPEC_TMP_DIR, '')
|
21
|
+
end).to eq(["/flickr-offline-gallery-specs",
|
22
|
+
"/flickr-offline-gallery-specs/10440808526.html",
|
23
|
+
"/flickr-offline-gallery-specs/10440808526.jpg",
|
24
|
+
"/flickr-offline-gallery-specs/11224643544.html",
|
25
|
+
"/flickr-offline-gallery-specs/11224643544.jpg",
|
26
|
+
"/flickr-offline-gallery-specs/11439134074.html",
|
27
|
+
"/flickr-offline-gallery-specs/11439134074.jpg",
|
28
|
+
"/flickr-offline-gallery-specs/9579531199.html",
|
29
|
+
"/flickr-offline-gallery-specs/9579531199.jpg",
|
30
|
+
"/flickr-offline-gallery-specs.html"])
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module FlickrOfflineGallery
|
4
|
+
describe PathManager do
|
5
|
+
let(:base_path) { "/tmp/galleries" }
|
6
|
+
let(:slug) { "holiday-photos" }
|
7
|
+
let(:photo_id) { "1235645" }
|
8
|
+
subject(:path_manager) { described_class.new(base_path, slug) }
|
9
|
+
|
10
|
+
it "should have an index page named the same as the slug" do
|
11
|
+
expect(path_manager.index_page).to eq( "/tmp/galleries/holiday-photos.html")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should put photos and their pages in a common folder" do
|
15
|
+
expect(path_manager.photo_output_path).to eq( "/tmp/galleries/holiday-photos")
|
16
|
+
expect(path_manager.full_path_for(photo_id, :jpg)).to eq( "/tmp/galleries/holiday-photos/1235645.jpg")
|
17
|
+
expect(path_manager.full_path_for(photo_id, :html)).to eq("/tmp/galleries/holiday-photos/1235645.html")
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should give relative links for the index page" do
|
21
|
+
expect(path_manager.relative_path_for(photo_id, :jpg)).to eq( "holiday-photos/1235645.jpg")
|
22
|
+
expect(path_manager.relative_path_for(photo_id, :html)).to eq("holiday-photos/1235645.html")
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should give filenames for the photo page" do
|
26
|
+
expect(path_manager.filename_for_photo(photo_id, :jpg)).to eq( "1235645.jpg")
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should give 'back' links back to the index page for photo pages" do
|
30
|
+
expect(path_manager.back_to_index).to eq( "../holiday-photos.html")
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module FlickrOfflineGallery
|
4
|
+
describe PhotoPage do
|
5
|
+
|
6
|
+
let(:photo_id) { "9579531199" }
|
7
|
+
|
8
|
+
let(:horrible_raw_flickr_junk) do
|
9
|
+
VCR.use_cassette('photo_with_janky_metadata') do
|
10
|
+
FlickrAPI.get_photo_info(photo_id)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:path_manager) { double("PathManager",
|
15
|
+
:back_to_index => "foo",
|
16
|
+
:filename_for_photo => "bar"
|
17
|
+
) }
|
18
|
+
let(:photoset_id) { "ffff" }
|
19
|
+
|
20
|
+
let!(:photo) {
|
21
|
+
|
22
|
+
VCR.use_cassette('full_photo_sizes_with_janky_metadata') do
|
23
|
+
Photo.new(horrible_raw_flickr_junk,
|
24
|
+
:photoset_id => photoset_id,
|
25
|
+
:path_manager => path_manager)
|
26
|
+
end
|
27
|
+
}
|
28
|
+
|
29
|
+
subject!(:photo_page) {
|
30
|
+
described_class.new(photo)
|
31
|
+
}
|
32
|
+
|
33
|
+
it "should be utf-8" do
|
34
|
+
expect(photo_page.render).to include(%(<meta http-equiv="Content-Type" content="text/html; charset=utf-8">))
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should html encode titles/etc" do
|
38
|
+
expect(photo_page.render).to include(%(alt="This "néeds" sóme 'fü**ed up çhara"cterş"))
|
39
|
+
expect(photo_page.render).to include(%(title="This "néeds" sóme 'fü**ed up çhara"cterş by Lucas the nomad, on Flickr"))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module FlickrOfflineGallery
|
4
|
+
describe PhotoSize do
|
5
|
+
|
6
|
+
subject!(:size) {
|
7
|
+
VCR.use_cassette('photo_sizes') do
|
8
|
+
described_class.new(FlickrAPI.get_photo_sizes("10440808526")[2])
|
9
|
+
end
|
10
|
+
}
|
11
|
+
|
12
|
+
it "should should know its label" do
|
13
|
+
expect(size.label).to eq("Thumbnail")
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should should know its height" do
|
17
|
+
expect(size.height).to eq("75")
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should should know its width" do
|
21
|
+
expect(size.width).to eq("100")
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should should know its url" do
|
25
|
+
expect(size.url).to eq("https://farm8.staticflickr.com/7402/10440808526_c3fd515635_t.jpg")
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should know its filename friendly key' do
|
29
|
+
expect(size.key).to eq("thumbnail")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module FlickrOfflineGallery
|
4
|
+
describe PhotoSizes do
|
5
|
+
|
6
|
+
let(:raw_flickr_response) do
|
7
|
+
VCR.use_cassette('photo_sizes') do
|
8
|
+
FlickrAPI.get_photo_sizes("10440808526")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
subject!(:sizes) { described_class.new(raw_flickr_response) }
|
13
|
+
|
14
|
+
it "should allow access like an array" do
|
15
|
+
expect(sizes["thumbnail"]).to be_a(PhotoSize)
|
16
|
+
expect(sizes["thumbnail"].label).to eq("Thumbnail")
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should respond to #each" do
|
20
|
+
expect(sizes).to respond_to(:each)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module FlickrOfflineGallery
|
4
|
+
describe Photo do
|
5
|
+
|
6
|
+
let(:photo_id) { "10440808526" }
|
7
|
+
|
8
|
+
let(:horrible_raw_flickr_junk) do
|
9
|
+
VCR.use_cassette('photo') do
|
10
|
+
FlickrAPI.get_photo_info(photo_id)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:path_manager) { double("PathManager") }
|
15
|
+
let(:photoset_id) { "ffff" }
|
16
|
+
|
17
|
+
subject!(:photo) {
|
18
|
+
|
19
|
+
VCR.use_cassette('full_photo_sizes') do
|
20
|
+
described_class.new(horrible_raw_flickr_junk,
|
21
|
+
:photoset_id => photoset_id,
|
22
|
+
:path_manager => path_manager)
|
23
|
+
end
|
24
|
+
}
|
25
|
+
|
26
|
+
it "should have a title" do
|
27
|
+
expect(photo.title).to eq("Giant hippo yawn")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should have a url" do
|
31
|
+
expect(photo.url).to eq("https://www.flickr.com/photos/lucasthenomad/10440808526/in/set-ffff")
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should have a base_url" do
|
35
|
+
expect(photo.base_url).to eq("https://www.flickr.com/photos/lucasthenomad/10440808526/")
|
36
|
+
end
|
37
|
+
|
38
|
+
context "delegating path work to the path manager" do
|
39
|
+
|
40
|
+
it "should ask the path manager for its img_filename" do
|
41
|
+
path_manager.should_receive(:filename_for_photo).with(photo_id, :jpg)
|
42
|
+
photo.img_filename
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should ask the path manager for its full_jpg_path" do
|
46
|
+
path_manager.should_receive(:full_path_for).with(photo_id, :jpg)
|
47
|
+
photo.full_jpg_path
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should ask the path manager for its full_html_path" do
|
51
|
+
path_manager.should_receive(:full_path_for).with(photo_id, :html)
|
52
|
+
photo.full_html_path
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should ask the path manager for its relative_jpg_path" do
|
56
|
+
path_manager.should_receive(:relative_path_for).with(photo_id, :jpg)
|
57
|
+
photo.relative_jpg_path
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should ask the path manager for its relative_html_path" do
|
61
|
+
path_manager.should_receive(:relative_path_for).with(photo_id, :html)
|
62
|
+
photo.relative_html_path
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should ask the path manager for its back_to_index_url" do
|
66
|
+
path_manager.should_receive(:back_to_index)
|
67
|
+
photo.back_to_index_url
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should have sizes" do
|
73
|
+
expect(photo.sizes).to be_a(PhotoSizes)
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should have a author" do
|
77
|
+
expect(photo.author).to eq("Lucas the nomad")
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module FlickrOfflineGallery
|
4
|
+
describe PhotosetDownloader do
|
5
|
+
|
6
|
+
subject(:photoset_downloader) do
|
7
|
+
described_class.new(photoset, selected_size)
|
8
|
+
end
|
9
|
+
let(:selected_size) { :thumbnail }
|
10
|
+
|
11
|
+
let(:photoset) do
|
12
|
+
VCR.use_cassette('photoset') do
|
13
|
+
Photoset.new("72157639475533743",
|
14
|
+
:output_path => SPEC_TMP_DIR)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should download' do
|
19
|
+
VCR.use_cassette('photset_downloader_spec') do
|
20
|
+
photoset_downloader.download
|
21
|
+
end
|
22
|
+
expect(File.exist?(photoset.photos[0].full_jpg_path)).to be_true
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module FlickrOfflineGallery
|
4
|
+
describe Photoset do
|
5
|
+
subject(:photoset) do
|
6
|
+
VCR.use_cassette('photoset') do
|
7
|
+
described_class.new("72157639475533743",
|
8
|
+
:output_path => SPEC_TMP_DIR)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should have a username' do
|
13
|
+
expect(photoset.username).to eq("Lucas the nomad")
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should have a title' do
|
17
|
+
expect(photoset.title).to eq("flickr_offline_gallery specs")
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should have a slug' do
|
21
|
+
expect(photoset.slug).to eq("flickr-offline-gallery-specs")
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should have a photos' do
|
25
|
+
expect(photoset.photos.count).to eq(4)
|
26
|
+
expect(photoset.photos.first.title).to eq("Purdy lamps")
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should have an index page filename" do
|
30
|
+
expect(photoset.index_page_filename).to eq("#{SPEC_TMP_DIR}/flickr-offline-gallery-specs.html")
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module FlickrOfflineGallery
|
3
|
+
describe TemplateRenderer do
|
4
|
+
subject(:renderer) { described_class.new(template_name) }
|
5
|
+
let(:template_name) { "cool_template" }
|
6
|
+
let(:test_filename) { "tmp/template_renderer_spec.html" }
|
7
|
+
let(:template_contents) do <<-ERB
|
8
|
+
This is <%= variable %>!
|
9
|
+
ERB
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should know where templates live" do
|
13
|
+
expect(renderer.template_directory).to eq(File.join(GEM_ROOT, "erb"))
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should know what template to render" do
|
17
|
+
expect(renderer.template_path).to eq(File.join(renderer.template_directory, "#{template_name}.html.erb"))
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should raise an error if the template is missing" do
|
21
|
+
File.should_receive(:exist?).and_return(false)
|
22
|
+
expect {
|
23
|
+
renderer.template_contents
|
24
|
+
}.to raise_error("Unknown template: #{renderer.template_path}")
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should read in the correct template" do
|
28
|
+
File.stub(:exist? => true)
|
29
|
+
File.stub(:read => template_contents)
|
30
|
+
expect(renderer.template_contents).to eq(template_contents)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should render the template with the local variables" do
|
34
|
+
File.stub(:exist? => true)
|
35
|
+
File.stub(:read => template_contents)
|
36
|
+
|
37
|
+
expect(renderer.render_erb(:variable => "awesome").strip).to eq("This is awesome!")
|
38
|
+
expect(renderer.render_erb(:variable => "crappy").strip).to eq("This is crappy!")
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should write the results of the render method to a file" do
|
42
|
+
FileUtils.rm_f(test_filename)
|
43
|
+
|
44
|
+
renderer.should_receive(:render).and_return(template_contents)
|
45
|
+
|
46
|
+
renderer.write_file(test_filename)
|
47
|
+
expect(File.read(test_filename)).to eq(template_contents)
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module FlickrOfflineGallery
|
4
|
+
|
5
|
+
describe 'VerbosePuts mixin' do
|
6
|
+
class TestPuts
|
7
|
+
include FlickrOfflineGallery::VerbosePuts
|
8
|
+
end
|
9
|
+
|
10
|
+
subject(:test_class) { TestPuts.new }
|
11
|
+
|
12
|
+
before do
|
13
|
+
@old_verbose = ENV["VERBOSE"]
|
14
|
+
end
|
15
|
+
|
16
|
+
after do
|
17
|
+
ENV["VERBOSE"] = @old_verbose
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should puts if the env var VERBOSE is set" do
|
21
|
+
ENV["VERBOSE"] = 'true'
|
22
|
+
test_class.should_receive(:puts).with("test string")
|
23
|
+
test_class.verbose_puts "test string"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should not puts if the env var VERBOSE is not set" do
|
27
|
+
ENV["VERBOSE"] = nil
|
28
|
+
test_class.should_not_receive(:puts).with("test string")
|
29
|
+
test_class.verbose_puts "test string"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
GEM_ROOT = File.expand_path("../..", __FILE__)
|
8
|
+
SPEC_TMP_DIR = File.join(GEM_ROOT, "tmp", "spec")
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
12
|
+
config.run_all_when_everything_filtered = true
|
13
|
+
config.filter_run :focus
|
14
|
+
|
15
|
+
config.expect_with :rspec do |c|
|
16
|
+
# disable the `should` syntax...
|
17
|
+
c.syntax = :expect
|
18
|
+
end
|
19
|
+
|
20
|
+
config.before(:each) do
|
21
|
+
# clean out any created files between every test
|
22
|
+
FileUtils.rm_rf(SPEC_TMP_DIR)
|
23
|
+
FileUtils.mkdir_p(SPEC_TMP_DIR)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Run specs in random order to surface order dependencies. If you find an
|
27
|
+
# order dependency and want to debug it, you can fix the order by providing
|
28
|
+
# the seed, which is printed after each run.
|
29
|
+
# --seed 1234
|
30
|
+
config.order = 'random'
|
31
|
+
end
|
32
|
+
|
33
|
+
require 'vcr'
|
34
|
+
require 'pry-rescue'
|
35
|
+
require 'flickraw'
|
36
|
+
require 'flickr_offline_gallery'
|
37
|
+
|
38
|
+
|
39
|
+
if ENV["FLICKR_OFFLINE_GALLERY_SPEC_API_KEY"] && ENV["FLICKR_OFFLINE_GALLERY_SPEC_SHARED_SECRET"]
|
40
|
+
FlickRaw.api_key = ENV["FLICKR_OFFLINE_GALLERY_SPEC_API_KEY"]
|
41
|
+
FlickRaw.shared_secret = ENV["FLICKR_OFFLINE_GALLERY_SPEC_SHARED_SECRET"]
|
42
|
+
else
|
43
|
+
puts "you need to set FLICKR_OFFLINE_GALLERY_SPEC_API_KEY and FLICKR_OFFLINE_GALLERY_SPEC_SHARED_SECRET to test against live flickr"
|
44
|
+
end
|
45
|
+
|
46
|
+
VCR.configure do |c|
|
47
|
+
c.cassette_library_dir = 'fixtures/vcr_cassettes'
|
48
|
+
c.hook_into :webmock
|
49
|
+
|
50
|
+
c.filter_sensitive_data('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') do |interaction|
|
51
|
+
if auth_headers = interaction.request.headers["Authorization"]
|
52
|
+
auth_headers.first.sub(/.*oauth_nonce="([^"]*)".*/, "\\1")
|
53
|
+
else
|
54
|
+
nil
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
c.filter_sensitive_data('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') do |interaction|
|
59
|
+
if auth_headers = interaction.request.headers["Authorization"]
|
60
|
+
auth_headers.first.sub(/.*oauth_consumer_key="([^"]*)".*/, "\\1")
|
61
|
+
else
|
62
|
+
nil
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
c.filter_sensitive_data('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') do |interaction|
|
67
|
+
if auth_headers = interaction.request.headers["Authorization"]
|
68
|
+
auth_headers.first.sub(/.*oauth_signature="([^"]*)".*/, "\\1")
|
69
|
+
else
|
70
|
+
nil
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# make FlickRaw work consistently with VCR
|
76
|
+
#
|
77
|
+
# FlickRaw keeps state in class instance variables and dynamically defines a
|
78
|
+
# bunch of classes, which means request order is out unless this request is
|
79
|
+
# done once up front. Nasty!
|
80
|
+
VCR.use_cassette('init') do
|
81
|
+
FlickrOfflineGallery::FlickrAPI.instance
|
82
|
+
end
|