Class: Spree::Integration

Inherits:
Object
  • Object
show all
Includes:
SingleStoreResource
Defined in:
app/models/spree/integration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#connection_error_messageString?

This attribute is used to temporarily store connection-related error messages that can be displayed to users when testing or validating integration connections. It is not persisted to the database and is reset on each new connection attempt.

Parameters:

  • message (String, nil)

    The error message to be stored

Returns:

  • (String, nil)

    The current error message



26
27
28
# File 'app/models/spree/integration.rb', line 26

def connection_error_message
  @connection_error_message
end

Class Method Details

.icon_pathObject



35
36
37
# File 'app/models/spree/integration.rb', line 35

def self.icon_path
  nil
end

.integration_groupObject

Associates the integration to a group. The name here will be used as Spree.t key to display the group name. Leave blank to leave the integration ungrouped.



31
32
33
# File 'app/models/spree/integration.rb', line 31

def self.integration_group
  nil
end

.integration_keyObject



43
44
45
# File 'app/models/spree/integration.rb', line 43

def self.integration_key
  name.demodulize.underscore
end

.integration_nameObject



39
40
41
# File 'app/models/spree/integration.rb', line 39

def self.integration_name
  name.demodulize.titleize.strip
end

Instance Method Details

#can_connect?Boolean

Checks if the integration can establish a connection. This is a base implementation that always returns true. Subclasses should override this method to implement their own connection validation logic.

Returns:

  • (Boolean)

    true if the integration can connect, false otherwise



59
60
61
# File 'app/models/spree/integration.rb', line 59

def can_connect?
  true
end

#keyObject



51
52
53
# File 'app/models/spree/integration.rb', line 51

def key
  self.class.integration_key
end

#nameObject



47
48
49
# File 'app/models/spree/integration.rb', line 47

def name
  self.class.integration_name
end