Sha256: 69beac927a7014db37a87fffbf0b4226c4148d558802bab3c9679e6650afc500

Contents?: true

Size: 777 Bytes

Versions: 2

Compression:

Stored size: 777 Bytes

Contents

module Quaderno::Behavior
  module Block
    def self.included(receiver)
      receiver.send :extend, ClassMethods
    end

    module ClassMethods
      include Quaderno::Helpers::Authentication

      def block(id, options = {})
        authentication = get_authentication(options.merge(api_model: api_model))


        response = put("#{authentication[:url]}#{api_model.api_path}/#{id}/block.json",
          basic_auth: authentication[:basic_auth],
          headers: version_header.merge(authentication[:headers])
        )

        check_exception_for(response, { rate_limit: true, subdomain_or_token: true, id: true })
        doc = response.parsed_response

        object = new doc
        object.rate_limit_info = response

        object
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
quaderno-1.17.1 lib/quaderno-ruby/behavior/block.rb
quaderno-1.17.0 lib/quaderno-ruby/behavior/block.rb