Class: Nice::DataGouv::Organization

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Organization

Returns a new instance of Organization.



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

def initialize(attributes = {})
  @id = attributes['id']
  @name = attributes['name']
  @slug = attributes['slug']
  @title = attributes['title'] || attributes['display_name'] || attributes['name']
  @description = attributes['description']
  @image_url = attributes['logo'] || attributes['image_url'] || attributes['image_display_url']
  @created_at = attributes['created_at'] || attributes['created']
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



4
5
6
# File 'lib/nice/data_gouv/organization.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/organization.rb', line 4

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#image_urlObject (readonly)

Returns the value of attribute image_url.



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

def image_url
  @image_url
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#slugObject (readonly)

Returns the value of attribute slug.



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

def slug
  @slug
end

#titleObject (readonly)

Returns the value of attribute title.



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

def title
  @title
end

Instance Method Details

#to_hObject



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

def to_h
  {
    'id' => @id,
    'name' => @name,
    'slug' => @slug,
    'title' => @title,
    'description' => @description,
    'image_url' => @image_url,
    'created_at' => @created_at
  }
end