Class: Legalizer::Find
Instance Method Summary collapse
- #all_contracts ⇒ Object
- #all_templates ⇒ Object
- #contract(contract_id) ⇒ Object
- #template(template_id) ⇒ Object
Methods inherited from Base
#config, #connection, #contracts, #find, #initialize, #templates, #token
Constructor Details
This class inherits a constructor from Legalizer::Base
Instance Method Details
#all_contracts ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/legalizer/find.rb', line 8 def all_contracts contracts = [] result = JSON.parse(@connection.request(:get, '/api/documents.json', @token, {}).body)["page"]["documents"] result.each do |contract| contracts << Legalizer::Contract.new({:config => @config, :object => contract}) end contracts end |
#all_templates ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/legalizer/find.rb', line 22 def all_templates templates = [] result = JSON.parse(@connection.request(:get, '/api/templates.json', @token, {}).body)["templates"] result.each do |contract| templates << Legalizer::Template.new({:config => @config, :object => contract}) end templates end |