Class: StrapiRuby::Config

Inherits:
Object
  • Object
show all
Includes:
Validations
Defined in:
lib/strapi_ruby/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Validations

#validate_config, #validate_data_presence, #validate_options

Constructor Details

#initializeConfig

Returns a new instance of Config.



12
13
14
15
16
17
18
19
# File 'lib/strapi_ruby/config.rb', line 12

def initialize
  @strapi_server_uri = nil
  @strapi_token = nil
  @faraday = nil
  @convert_to_datetime = true
  @convert_to_html = []
  @show_endpoint = false
end

Instance Attribute Details

#convert_to_datetimeObject

Returns the value of attribute convert_to_datetime.



5
6
7
# File 'lib/strapi_ruby/config.rb', line 5

def convert_to_datetime
  @convert_to_datetime
end

#convert_to_htmlObject

Returns the value of attribute convert_to_html.



5
6
7
# File 'lib/strapi_ruby/config.rb', line 5

def convert_to_html
  @convert_to_html
end

#faradayObject

Returns the value of attribute faraday.



5
6
7
# File 'lib/strapi_ruby/config.rb', line 5

def faraday
  @faraday
end

#show_endpointObject

Returns the value of attribute show_endpoint.



5
6
7
# File 'lib/strapi_ruby/config.rb', line 5

def show_endpoint
  @show_endpoint
end

#strapi_server_uriObject

Returns the value of attribute strapi_server_uri.



5
6
7
# File 'lib/strapi_ruby/config.rb', line 5

def strapi_server_uri
  @strapi_server_uri
end

#strapi_tokenObject

Returns the value of attribute strapi_token.



5
6
7
# File 'lib/strapi_ruby/config.rb', line 5

def strapi_token
  @strapi_token
end

Instance Method Details

#callObject



21
22
23
24
25
# File 'lib/strapi_ruby/config.rb', line 21

def call
  validate_config(self)
  # We convert to symbols if user passed strings for convert_to_html options
  @convert_to_html.map!(&:to_sym)
end