Sha256: 02a6dd0a3d24cd7fe5f3146c647409be01e7b0850d5570cf00e5775b53b53806

Contents?: true

Size: 889 Bytes

Versions: 4

Compression:

Stored size: 889 Bytes

Contents

# frozen_string_literal: true

module GhostRb
  module Controllers
    # @author Rene Hernandez
    # @since 0.2
    class TagsController < BaseController
      attr_reader :endpoint, :resource_klass

      def initialize(client)
        super
        @endpoint = 'tags'
        @resource_klass = Resources::Tag
      end

      private

      def raise_fetch_single_error(kvp, status, errors)
        key = kvp.key?(:id) ? :id : :slug
        message = "Unable to fetch tag with #{key} = #{kvp[key]}"
        raise Errors::RequestError.new(message,
                                       status,
                                       errors)
      end

      def raise_fetch_list_error(status, errors)
        raise Errors::RequestError.new('Unable to fetch tags',
                                       status,
                                       errors)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ghost_rb-0.2.8 lib/ghost_rb/controllers/tags_controller.rb
ghost_rb-0.2.7 lib/ghost_rb/controllers/tags_controller.rb
ghost_rb-0.2.6 lib/ghost_rb/controllers/tags_controller.rb
ghost_rb-0.2.5 lib/ghost_rb/controllers/tags_controller.rb