Skip to content

Instantly share code, notes, and snippets.

@hapiben
Last active November 4, 2016 02:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hapiben/c904e581ea944b70533bb5fdf25efaa7 to your computer and use it in GitHub Desktop.
Save hapiben/c904e581ea944b70533bb5fdf25efaa7 to your computer and use it in GitHub Desktop.
Example SJ Manager parser for SPCA Wellington Flickr
# Content Parner: Wellington SPCA
# Data Source: SPCA Wellington Flickr
class SPCAWellingtonFlickr < SupplejackCommon::Xml::Base
base_url 'https://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos&api_key=66881cbc6259eae63ceb6d6453159892&user_id=73889498@N04&photoset_id=72157628780736141&privacy_filter=1&extras=description,%20license,%20date_taken,%20owner_name,%20geo,%20tags,%20media,%20machine_tags,%20url_m,%20url_z,%20url_o&format=rest'
paginate page_parameter: 'page', type: 'page', per_page_parameter: 'per_page', per_page: 100, page: 1, total_selector: '//*[1]/@total'
record_selector '//photo'
record_format :xml
throttle host: 'api.flickr.com', delay: 1
attribute :title, xpath: '/@title'
attribute :description, xpath: '/description'
attribute :creator, xpath: '/@ownername'
attribute :thumbnail_url, xpath: '/@url_m'
attribute :large_thumbnail_url, xpath: '/@url_z'
attribute :object_url, xpath: '/@url_o'
attribute :internal_identifier, xpath: '/@url_m'
attributes :display_content_partner, :content_partner, :contributor, default: 'Wellington SPCA Flickr'
attributes :display_collection, :primary_collection, :collection, default: 'Wellington SPCA Flickr'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment