Class: Gold::Configuration

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

Overview

Config for Gold

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/gold/configuration.rb', line 27

def initialize
  # The class name (string) of the the app's Active Record Shop model
  @shop_class = nil

  # The attribute of the *.myshopify.com domain on the Shop model
  @shop_domain_attribute = nil

  # Should Gold create test charges? Helpful in a development environment
  @test_charge = false

  # The logger Gold will use
  @logger = Logger.new(STDOUT)

  # How many days we'll wait before cleaning up an uninstalled shop
  @days_until_cleanup = 30

  # How many days we'll wait before we uninstall a shop without payment
  @days_until_delinquent = 7

  # The name of the app using gold (used in the charge name)
  @app_name = "My App"

  # The email Gold uses to send emails from
  @contact_email = nil

  # The URL to a plan comparison page for the app
  @plan_comparison_url = nil

  # Login credential's to Gold's backend
  @admin_credentials = {
    user: "admin",
    password: "password123"
  }

  # The API version used by Shopify (https://help.shopify.com/en/api/versioning)
  @shopify_api_version = "2019-04"

  # If Gold is allowed to cancel charges (paid -> free) automatically
  @allow_automated_charge_cancellation = true
end

Instance Attribute Details

#admin_credentialsObject

Returns the value of attribute admin_credentials.



4
5
6
# File 'lib/gold/configuration.rb', line 4

def admin_credentials
  @admin_credentials
end

#allow_automated_charge_cancellationObject

Returns the value of attribute allow_automated_charge_cancellation.



4
5
6
# File 'lib/gold/configuration.rb', line 4

def allow_automated_charge_cancellation
  @allow_automated_charge_cancellation
end

#app_nameObject

Returns the value of attribute app_name.



4
5
6
# File 'lib/gold/configuration.rb', line 4

def app_name
  @app_name
end

#contact_emailObject

Returns the value of attribute contact_email.



4
5
6
# File 'lib/gold/configuration.rb', line 4

def contact_email
  @contact_email
end

#days_until_cleanupObject

Returns the value of attribute days_until_cleanup.



4
5
6
# File 'lib/gold/configuration.rb', line 4

def days_until_cleanup
  @days_until_cleanup
end

#days_until_delinquentObject

Returns the value of attribute days_until_delinquent.



4
5
6
# File 'lib/gold/configuration.rb', line 4

def days_until_delinquent
  @days_until_delinquent
end

#loggerObject

Returns the value of attribute logger.



4
5
6
# File 'lib/gold/configuration.rb', line 4

def logger
  @logger
end

#on_activate_chargeObject

Callbacks



17
18
19
# File 'lib/gold/configuration.rb', line 17

def on_activate_charge
  @on_activate_charge
end

#on_apply_tierObject

Callbacks



17
18
19
# File 'lib/gold/configuration.rb', line 17

def on_apply_tier
  @on_apply_tier
end

#on_check_chargeObject

Callbacks



17
18
19
# File 'lib/gold/configuration.rb', line 17

def on_check_charge
  @on_check_charge
end

#on_cleanupObject

Callbacks



17
18
19
# File 'lib/gold/configuration.rb', line 17

def on_cleanup
  @on_cleanup
end

#on_installObject

Callbacks



17
18
19
# File 'lib/gold/configuration.rb', line 17

def on_install
  @on_install
end

#on_termsObject

Callbacks



17
18
19
# File 'lib/gold/configuration.rb', line 17

def on_terms
  @on_terms
end

#on_uninstallObject

Callbacks



17
18
19
# File 'lib/gold/configuration.rb', line 17

def on_uninstall
  @on_uninstall
end

#plan_comparison_urlObject

Returns the value of attribute plan_comparison_url.



4
5
6
# File 'lib/gold/configuration.rb', line 4

def plan_comparison_url
  @plan_comparison_url
end

#shop_classObject



68
69
70
71
72
73
74
# File 'lib/gold/configuration.rb', line 68

def shop_class
  @shop_constant ||= @shop_class.to_s.constantize
rescue NameError
  raise "'#{@shop_class}' is not a valid class name for shop class. " \
        "You must specify one in your Gold config file with " \
        "'config.shop'"
end

#shop_domain_attributeObject

Returns the value of attribute shop_domain_attribute.



4
5
6
# File 'lib/gold/configuration.rb', line 4

def shop_domain_attribute
  @shop_domain_attribute
end

#shopify_api_versionObject

Returns the value of attribute shopify_api_version.



4
5
6
# File 'lib/gold/configuration.rb', line 4

def shopify_api_version
  @shopify_api_version
end

#test_chargeObject

Returns the value of attribute test_charge.



4
5
6
# File 'lib/gold/configuration.rb', line 4

def test_charge
  @test_charge
end

Instance Method Details

#test_charge?Boolean

Returns:

  • (Boolean)


76
77
78
# File 'lib/gold/configuration.rb', line 76

def test_charge?
  @test_charge
end