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



28
29
30
# File 'app/models/spree/integration.rb', line 28

def connection_error_message
  @connection_error_message
end

Class Method Details

.icon_pathObject



37
38
39
# File 'app/models/spree/integration.rb', line 37

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.



33
34
35
# File 'app/models/spree/integration.rb', line 33

def self.integration_group
  nil
end

.integration_keyObject



45
46
47
# File 'app/models/spree/integration.rb', line 45

def self.integration_key
  name.demodulize.underscore
end

.integration_nameObject



41
42
43
# File 'app/models/spree/integration.rb', line 41

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



61
62
63
# File 'app/models/spree/integration.rb', line 61

def can_connect?
  true
end

#keyObject



53
54
55
# File 'app/models/spree/integration.rb', line 53

def key
  self.class.integration_key
end

#nameObject



49
50
51
# File 'app/models/spree/integration.rb', line 49

def name
  self.class.integration_name
end