Sha256: 0fffb37ced4beed0754061d2e52fce20c2058d3367d928b3170214d850c2e338

Contents?: true

Size: 1.87 KB

Versions: 5

Compression:

Stored size: 1.87 KB

Contents

class Puller

  ORGS = [
    {
      :name        => "Budget Office",
      :url         => "http://example.gov/orgs/budget-office",
      :description => "Prepares the executive budget..."
    },
    {
      :name        => "Environmental Agency",
      :url         => "http://example.gov/orgs/environmental-agency",
      :description => "Tracks environmental compliance..."
    },
    {
      :name        => "Inspector General",
      :url         => "http://example.gov/orgs/inspector-general",
      :description => "Inspects..."
    }
  ]

  SOURCES = [
    {
      :title             => "School District Performance",
      :url               => "http://example.gov/data-sets/209",
      :description       => "Comparative school performance...",
      :frequency         => "annual",
      :source_type       => "dataset",
    },
    {
      :title             => "Economic Development",
      :url               => "http://example.gov/data-sets/210",
      :description       => "Economic indicators for...",
      :frequency         => "monthly",
      :source_type       => "dataset",
    },
    {
      :title             => "Superfund Projects",
      :url               => "http://example.gov/apis/5",
      :description       => "API for environmental cleanup...",
      :frequency         => "monthly",
      :source_type       => "api",
    },
  ]

  def initialize(handler)
    @handler = handler
  end
  
  def run
    common = {
      :catalog_name => "Example Catalog",
      :catalog_url  => "http://example.gov",
    }
    ORGS.each do |o|
      @handler.organization(
        o.merge(common).merge({
          :org_type     => "governmental",
        })
      )
    end
    SOURCES.each do |s|
      @handler.source(
        s.merge(common).merge({
          :license      => "public domain",
          :license_url  => "http://example.gov/license",
        })
      )
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
datacatalog-importer-0.3.0 example/lib/puller.rb
datacatalog-importer-0.2.3 example/lib/puller.rb
datacatalog-importer-0.2.2 example/lib/puller.rb
datacatalog-importer-0.2.1 example/lib/puller.rb
datacatalog-importer-0.2.0 example/lib/puller.rb