Class: ContentfulModel::Configuration
- Inherits:
-
Object
- Object
- ContentfulModel::Configuration
- Defined in:
- lib/contentful_model.rb
Overview
Configuration store for ContentfulModel
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#default_locale ⇒ Object
Returns the value of attribute default_locale.
-
#entry_mapping ⇒ Object
Returns the value of attribute entry_mapping.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#management_token ⇒ Object
Returns the value of attribute management_token.
-
#preview_access_token ⇒ Object
Returns the value of attribute preview_access_token.
-
#space ⇒ Object
Returns the value of attribute space.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#options=(options) ⇒ Object
Rather than listing out all the possible attributes as setters, we have a catchall called ‘options’ which takes a hash and generates instance vars.
-
#to_hash ⇒ Hash
Return the Configuration object as a hash, with symbols as keys.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
35 36 37 38 39 40 |
# File 'lib/contentful_model.rb', line 35 def initialize @entry_mapping ||= {} @environment = 'master' @integration_name = 'contentful_model' @integration_version = ::ContentfulModel::VERSION end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
27 28 29 |
# File 'lib/contentful_model.rb', line 27 def access_token @access_token end |
#default_locale ⇒ Object
Returns the value of attribute default_locale.
27 28 29 |
# File 'lib/contentful_model.rb', line 27 def default_locale @default_locale end |
#entry_mapping ⇒ Object
Returns the value of attribute entry_mapping.
27 28 29 |
# File 'lib/contentful_model.rb', line 27 def entry_mapping @entry_mapping end |
#environment ⇒ Object
Returns the value of attribute environment.
27 28 29 |
# File 'lib/contentful_model.rb', line 27 def environment @environment end |
#management_token ⇒ Object
Returns the value of attribute management_token.
27 28 29 |
# File 'lib/contentful_model.rb', line 27 def management_token @management_token end |
#preview_access_token ⇒ Object
Returns the value of attribute preview_access_token.
27 28 29 |
# File 'lib/contentful_model.rb', line 27 def preview_access_token @preview_access_token end |
#space ⇒ Object
Returns the value of attribute space.
27 28 29 |
# File 'lib/contentful_model.rb', line 27 def space @space end |
Instance Method Details
#options=(options) ⇒ Object
Rather than listing out all the possible attributes as setters, we have a catchall called ‘options’ which takes a hash and generates instance vars
45 46 47 48 49 |
# File 'lib/contentful_model.rb', line 45 def () .each do |k, v| instance_variable_set(:"@#{k}", v) end end |
#to_hash ⇒ Hash
Return the Configuration object as a hash, with symbols as keys.
53 54 55 |
# File 'lib/contentful_model.rb', line 53 def to_hash Hash[instance_variables.map { |name| [name.to_s.delete('@').to_sym, instance_variable_get(name)] }] end |