Class: Contentful::Space

Inherits:
BaseResource show all
Defined in:
lib/contentful/space.rb

Overview

Instance Attribute Summary collapse

Attributes inherited from BaseResource

#_metadata, #default_locale, #raw, #sys

Instance Method Summary collapse

Methods inherited from BaseResource

#==, #inspect, #marshal_dump, #marshal_load

Constructor Details

#initialize(item) ⇒ Space

Returns a new instance of Space.



10
11
12
13
14
15
# File 'lib/contentful/space.rb', line 10

def initialize(item, *)
  super

  @name = item.fetch('name', nil)
  @locales = item.fetch('locales', []).map { |locale| Locale.new(locale) }
end

Instance Attribute Details

#localesObject (readonly)

Returns the value of attribute locales.



8
9
10
# File 'lib/contentful/space.rb', line 8

def locales
  @locales
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/contentful/space.rb', line 8

def name
  @name
end

Instance Method Details

#reload(client = nil) ⇒ Object



18
19
20
21
22
# File 'lib/contentful/space.rb', line 18

def reload(client = nil)
  return client.space unless client.nil?

  false
end