Class: Inkdit::Entity

Inherits:
Resource show all
Defined in:
lib/inkdit/entity.rb

Overview

Represents an Inkdit Entity.

Instance Attribute Summary

Attributes inherited from Resource

#url

Instance Method Summary collapse

Methods inherited from Resource

#==, #fetch!, #initialize

Constructor Details

This class inherits a constructor from Inkdit::Resource

Instance Method Details

the URL of this entity’s Contract Collection



20
21
22
# File 'lib/inkdit/entity.rb', line 20

def contracts_link
  @params['links']['contracts']
end

#get_contractsArray<Contract>

retrieves this entity’s Contract Collection

Returns:

  • (Array<Contract>)

    the contracts in this entity’s Contract Collection

Raises:



26
27
28
29
30
31
32
33
# File 'lib/inkdit/entity.rb', line 26

def get_contracts
  response = @client.get(contracts_link)
  raise Inkdit::Error.new(response) unless response.status == 200

  response.parsed['resources'].map do |contract_params|
    Contract.new @client, contract_params
  end
end

the URL of this entity’s HTML representation.



15
16
17
# File 'lib/inkdit/entity.rb', line 15

def html_link
  @params['links']['html']
end

#inspectObject



35
36
37
# File 'lib/inkdit/entity.rb', line 35

def inspect
  "#<Inkdit::Entity type=#{type} label=#{label}>"
end

#labelObject

this entity’s human-readable name.



10
11
12
# File 'lib/inkdit/entity.rb', line 10

def label
  @params['label']
end

#typeObject

this entity’s type. ‘individual’ or ‘organization’.



5
6
7
# File 'lib/inkdit/entity.rb', line 5

def type
  @params['type']
end