Method: Inkdit::Contract.create

Defined in:
lib/inkdit/contract.rb

.create(client, owner, params) ⇒ Contract

create a new contract.

Parameters:

  • client (Client)

    the client to create this contract with

  • owner (Entity)

    the entity that will own this contract

  • params (Hash)

    the details of the new contract. this should include the basic details required in a Contract Description.

Returns:

  • (Contract)

    contract the newly created contract

Raises:



13
14
15
16
17
18
# File 'lib/inkdit/contract.rb', line 13

def self.create(client, owner, params)
  response = client.post owner.contracts_link, { :body => params.to_json, :headers => { 'Content-Type' => 'application/json' } }
  raise Inkdit::Error.new(response) unless response.status == 201

  self.new(client, response.parsed)
end