Sha256: 76a3132a2ed3907201379e400a39cfaffaed3f32a5f683fb971b7d11cd66a3a2
Contents?: true
Size: 710 Bytes
Versions: 10
Compression:
Stored size: 710 Bytes
Contents
require 'social_parser/provider/base' module SocialParser module Provider class Pinterest < Base URL_FORMATS = { full: /\A((https?)?:\/\/)?(www\.)?pinterest\.(?<domain>(com|jp))\/(?<id>[\w\-\.]+)\/?/i } def provider :pinterest end def domain @domain || 'com' end def url @domain ||= 'com' "https://www.pinterest.#{domain}/#{username}" end private def parse_from_url URL_FORMATS.values.each do |format| m = format.match(url_from_attributes) if m @domain = m[:domain] return m[:id] end end nil end end end end
Version data entries
10 entries across 10 versions & 1 rubygems