Module: Quaderno::Behavior::Block::ClassMethods

Includes:
Helpers::Authentication
Defined in:
lib/quaderno-ruby/behavior/block.rb

Instance Method Summary collapse

Methods included from Helpers::Authentication

#get_authentication

Instance Method Details

#block(id, options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/quaderno-ruby/behavior/block.rb', line 10

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: default_headers.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