Class: RGovData::ServiceListing

Inherits:
Object
  • Object
show all
Includes:
Dn
Defined in:
lib/rgovdata/service/listing.rb

Overview

A ServiceListing is the metadata describing a specific service It encapsulates access to the underlying service

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Dn

#attributes, #id, #initialization_hash, #meta_attributes, #to_param, #to_s

Instance Attribute Details

#credentialsetObject

name of the credential set required



14
15
16
# File 'lib/rgovdata/service/listing.rb', line 14

def credentialset
  @credentialset
end

#descriptionObject

human description of the service



7
8
9
# File 'lib/rgovdata/service/listing.rb', line 7

def description
  @description
end

#info_uriObject

url to a web page about the service if any



11
12
13
# File 'lib/rgovdata/service/listing.rb', line 11

def info_uri
  @info_uri
end

#keyObject Also known as: service_key

unique service name or id (within realm)



5
6
7
# File 'lib/rgovdata/service/listing.rb', line 5

def key
  @key
end

#keywordsObject

keywords for the service



8
9
10
# File 'lib/rgovdata/service/listing.rb', line 8

def keywords
  @keywords
end

#licenseObject

license covering the service if any



10
11
12
# File 'lib/rgovdata/service/listing.rb', line 10

def license
  @license
end

#nameObject

human name of the service



6
7
8
# File 'lib/rgovdata/service/listing.rb', line 6

def name
  @name
end

#publisherObject

service publisher name



9
10
11
# File 'lib/rgovdata/service/listing.rb', line 9

def publisher
  @publisher
end

#realmObject

realm for the service



4
5
6
# File 'lib/rgovdata/service/listing.rb', line 4

def realm
  @realm
end

#typeObject

service type [:odata,:csv,:file]



13
14
15
# File 'lib/rgovdata/service/listing.rb', line 13

def type
  @type
end

#uriObject

url to the service interface



12
13
14
# File 'lib/rgovdata/service/listing.rb', line 12

def uri
  @uri
end

Instance Method Details

#datasetsObject Also known as: records

Returns an array of DataSets for the service

> delegate to service



28
29
30
# File 'lib/rgovdata/service/listing.rb', line 28

def datasets
  service.try(:datasets)
end

#find(id) ⇒ Object Also known as: find_by_id

Returns the first dataset matching key

> delegate to service



40
41
42
# File 'lib/rgovdata/service/listing.rb', line 40

def find(id)
  service.try(:find,id)
end

#get_dataset(key) ⇒ Object

Returns the dataset(s) matching key

> delegate to service



35
36
37
# File 'lib/rgovdata/service/listing.rb', line 35

def get_dataset(key)
  service.try(:get_dataset,key)
end

#serviceObject

Returns the service for this listing



19
20
21
# File 'lib/rgovdata/service/listing.rb', line 19

def service
  @service ||= RGovData::Service.get_instance(self)
end