Class: Consyncful::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/consyncful.rb

Overview

Handles Rails configurations for Consynful

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



22
23
24
25
26
27
28
29
30
31
# File 'lib/consyncful.rb', line 22

def initialize
  @contentful_client_options = {}
  @contentful_sync_options = {}
  @locale = 'en-NZ'
  @mongo_client = :default
  @mongo_collection = 'contentful_models'
  @content_tags = []
  @ignore_content_tags = []
  @preserve_contentful_timestamps = false
end

Instance Attribute Details

#content_tagsObject

Returns the value of attribute content_tags.



13
14
15
# File 'lib/consyncful.rb', line 13

def 
  @content_tags
end

#contentful_client_optionsObject

Returns the value of attribute contentful_client_options.



13
14
15
# File 'lib/consyncful.rb', line 13

def contentful_client_options
  @contentful_client_options
end

#contentful_sync_optionsObject

Returns the value of attribute contentful_sync_options.



13
14
15
# File 'lib/consyncful.rb', line 13

def contentful_sync_options
  @contentful_sync_options
end

#ignore_content_tagsObject

Returns the value of attribute ignore_content_tags.



13
14
15
# File 'lib/consyncful.rb', line 13

def 
  @ignore_content_tags
end

#localeObject

Returns the value of attribute locale.



13
14
15
# File 'lib/consyncful.rb', line 13

def locale
  @locale
end

#mongo_clientObject

Returns the value of attribute mongo_client.



13
14
15
# File 'lib/consyncful.rb', line 13

def mongo_client
  @mongo_client
end

#mongo_collectionObject

Returns the value of attribute mongo_collection.



13
14
15
# File 'lib/consyncful.rb', line 13

def mongo_collection
  @mongo_collection
end

#preserve_contentful_timestampsObject

Returns the value of attribute preserve_contentful_timestamps.



13
14
15
# File 'lib/consyncful.rb', line 13

def preserve_contentful_timestamps
  @preserve_contentful_timestamps
end

Instance Method Details

#client_optionsObject



39
40
41
42
# File 'lib/consyncful.rb', line 39

def client_options
  options = @contentful_client_options
  options.reverse_merge!(DEFAULT_CLIENT_OPTIONS)
end

#initial_sync_optionsObject



33
34
35
36
37
# File 'lib/consyncful.rb', line 33

def initial_sync_options
  options = { initial: true }
  options = options.reverse_merge(@contentful_sync_options)
  options.reverse_merge(DEFAULT_SYNC_OPTIONS)
end