Sha256: 4e69660f23e2360aa733cec39cffb8cd8b1f5e5bbeefc9db9559919529580570

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

# encoding: utf-8
# frozen_string_literal: true

module Nimbu
  module Endpoints
    class Blogs < Endpoint
      def articles(options = {}, &block)
        Nimbu::Builder.new("Blogs::Articles", current_options.merge(options), &block)
      end

      def list(*args, &block)
        arguments(args)

        response = get_request("/blogs", arguments.params)
        return response unless block_given?
        response.each(&block)
      end
      alias_method :all, :list

      def get(*args)
        arguments(args, required: [:blog_id])

        get_request("/blogs/#{blog_id}", arguments.params)
      end
      alias_method :find, :get

      def create(*args)
        arguments(args)

        post_request("/blogs", arguments.params)
      end

      def update(*args)
        arguments(args, required: [:blog_id])

        patch_request("/blogs/#{blog_id}", arguments.params)
      end
      alias_method :edit, :update

      def delete(*args)
        arguments(args, required: [:blog_id])

        delete_request("/blogs/#{blog_id}", arguments.params)
      end
      alias_method :remove, :delete
    end # Blogs
  end # Endpoints
end # Nimbu

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nimbu-api-0.5.0 lib/nimbu-api/endpoints/blogs.rb