Sha256: 334d719ed302928e42e350b93184fe5d866fc47aeb7ea8176b81380d5670600a

Contents?: true

Size: 889 Bytes

Versions: 18

Compression:

Stored size: 889 Bytes

Contents

require 'addressable/uri'

module Poms
  module Api
    module Uris
      # Builds uri's for /media endpoints
      module Media
        API_PATH = '/v1/api/media'.freeze

        module_function

        def single(base_uri, mid)
          uri_for_path(base_uri, "/#{mid}")
        end

        def multiple(base_uri)
          uri_for_path(base_uri, '/multiple')
        end

        def descendants(base_uri, mid)
          uri_for_path(base_uri, "/#{mid}/descendants")
        end

        def members(base_uri, mid)
          uri_for_path(base_uri, "/#{mid}/members")
        end

        # URI for merged series
        def redirects(base_uri)
          uri_for_path(base_uri, '/redirects/')
        end

        def uri_for_path(base_uri, path)
          base_uri.merge(path: "#{API_PATH}#{path}")
        end

        private_class_method :uri_for_path
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
poms-3.0.0 lib/poms/api/uris/media.rb
poms-2.6.0 lib/poms/api/uris/media.rb
poms-2.5.1 lib/poms/api/uris/media.rb
poms-2.5.0 lib/poms/api/uris/media.rb
poms-2.4.0 lib/poms/api/uris/media.rb
poms-2.3.1 lib/poms/api/uris/media.rb
poms-2.3.0 lib/poms/api/uris/media.rb
poms-2.2.1 lib/poms/api/uris/media.rb
poms-2.2.0 lib/poms/api/uris/media.rb
poms-2.1.3 lib/poms/api/uris/media.rb
poms-2.1.2.1 lib/poms/api/uris/media.rb
poms-2.1.2 lib/poms/api/uris/media.rb
poms-2.1.1 lib/poms/api/uris/media.rb
poms-2.1.0 lib/poms/api/uris/media.rb
poms-2.0.1 lib/poms/api/uris/media.rb
poms-2.0.0 lib/poms/api/uris/media.rb
poms-2.0.0.b lib/poms/api/uris/media.rb
poms-2.0.0.a lib/poms/api/uris/media.rb