Class: MyLicenceRecord

Inherits:
SimpleOpencBot::BaseLicenceRecord show all
Defined in:
lib/openc_bot/templates/lib/simple_bot.rb

Overview

you may need to require other libraries here require ‘nokogiri’ require ‘mechanize’

Instance Method Summary collapse

Methods inherited from SimpleOpencBot::BaseLicenceRecord

#errors, #initialize, schema, store_fields, #to_hash, unique_fields, #validate_instance!

Constructor Details

This class inherits a constructor from SimpleOpencBot::BaseLicenceRecord

Instance Method Details

#last_updated_atObject

This must be defined, and should return a timestamp in ISO8601 format. Its value should change when something about the record has changed. It doesn’t have to be a method - it can also be a member of ‘store_fields`, above.



25
26
27
# File 'lib/openc_bot/templates/lib/simple_bot.rb', line 25

def last_updated_at
  reporting_date
end

#to_pipelineObject

This method must be defined. You can test that you’re outputting in the right format with ‘bin/verify_data`, which will validate any data you’ve fetched against the relevant schema. See ‘doc/SCHEMA.md` for documentation.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/openc_bot/templates/lib/simple_bot.rb', line 33

def to_pipeline
  {
    company: {
      name: name,
      jurisdiction: "xx",
    },
    data: [{
      data_type: :licence,
      source_url: "xx",
      sample_date: last_updated_at,
      confidence: "MEDIUM",
      properties: {
        jurisdiction_code: "xx",
        category: 'Financial',
        jurisdiction_classification: [type],
      }
    }]
  }
end