Class: Magento::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url: nil, token: nil, store: nil) ⇒ Configuration

Returns a new instance of Configuration.



5
6
7
8
9
10
11
12
13
# File 'lib/magento/configuration.rb', line 5

def initialize(url: nil, token: nil, store: nil)
  self.url            = url || ENV['MAGENTO_URL']
  self.open_timeout   = 30
  self.timeout        = 90
  self.token          = token || ENV['MAGENTO_TOKEN']
  self.store          = store || ENV['MAGENTO_STORE'] || :all

  self.product_image  = ProductImageConfiguration.new
end

Instance Attribute Details

#open_timeoutObject

Returns the value of attribute open_timeout.



3
4
5
# File 'lib/magento/configuration.rb', line 3

def open_timeout
  @open_timeout
end

#product_imageObject

Returns the value of attribute product_image.



3
4
5
# File 'lib/magento/configuration.rb', line 3

def product_image
  @product_image
end

#storeObject

Returns the value of attribute store.



3
4
5
# File 'lib/magento/configuration.rb', line 3

def store
  @store
end

#timeoutObject

Returns the value of attribute timeout.



3
4
5
# File 'lib/magento/configuration.rb', line 3

def timeout
  @timeout
end

#tokenObject

Returns the value of attribute token.



3
4
5
# File 'lib/magento/configuration.rb', line 3

def token
  @token
end

#urlObject

Returns the value of attribute url.



3
4
5
# File 'lib/magento/configuration.rb', line 3

def url
  @url
end

Instance Method Details

#copy_with(params = {}) ⇒ Object



15
16
17
18
19
# File 'lib/magento/configuration.rb', line 15

def copy_with(params = {})
  clone.tap do |config|
    params.each { |key, value| config.send("#{key}=", value) }
  end
end