Class: Nice::DataGouv::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/nice/data_gouv/resource.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Resource

Returns a new instance of Resource.



6
7
8
9
10
11
12
13
14
15
# File 'lib/nice/data_gouv/resource.rb', line 6

def initialize(attributes = {})
  @id = attributes['id']
  @name = attributes['name']
  @description = attributes['description']
  @url = attributes['url']
  @format = attributes['format']
  @size = attributes['size']
  @created_at = attributes['created']
  @last_modified = attributes['last_modified']
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



4
5
6
# File 'lib/nice/data_gouv/resource.rb', line 4

def created_at
  @created_at
end

#descriptionObject (readonly)

Returns the value of attribute description.



4
5
6
# File 'lib/nice/data_gouv/resource.rb', line 4

def description
  @description
end

#formatObject (readonly)

Returns the value of attribute format.



4
5
6
# File 'lib/nice/data_gouv/resource.rb', line 4

def format
  @format
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/nice/data_gouv/resource.rb', line 4

def id
  @id
end

#last_modifiedObject (readonly)

Returns the value of attribute last_modified.



4
5
6
# File 'lib/nice/data_gouv/resource.rb', line 4

def last_modified
  @last_modified
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/nice/data_gouv/resource.rb', line 4

def name
  @name
end

#sizeObject (readonly)

Returns the value of attribute size.



4
5
6
# File 'lib/nice/data_gouv/resource.rb', line 4

def size
  @size
end

#urlObject (readonly)

Returns the value of attribute url.



4
5
6
# File 'lib/nice/data_gouv/resource.rb', line 4

def url
  @url
end

Instance Method Details

#to_hObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/nice/data_gouv/resource.rb', line 17

def to_h
  {
    'id' => @id,
    'name' => @name,
    'description' => @description,
    'url' => @url,
    'format' => @format,
    'size' => @size,
    'created_at' => @created_at,
    'last_modified' => @last_modified
  }
end