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.



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
67
68
69
70
71
72
73
74
75
76
# File 'lib/gold/configuration.rb', line 29

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

  # Force Gold billing view's to redirect to iframe
  @force_embedded_redirect = false

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

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

  # The URL to follow after a referral code is tracked
  # (e.g. https://apps.shopify.com/customr)
  @app_listing_url = "https://apps.shopify.com/"

  # The redirect path after a tier is applied. Use this path to welcome a
  # merchant if they just installed
  @after_tier_redirect_path = "/"
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

#after_tier_redirect_pathObject

Returns the value of attribute after_tier_redirect_path.



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

def after_tier_redirect_path
  @after_tier_redirect_path
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_listing_urlObject

Returns the value of attribute app_listing_url.



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

def app_listing_url
  @app_listing_url
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

#force_embedded_redirectObject

Returns the value of attribute force_embedded_redirect.



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

def force_embedded_redirect
  @force_embedded_redirect
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



19
20
21
# File 'lib/gold/configuration.rb', line 19

def on_activate_charge
  @on_activate_charge
end

#on_apply_tierObject

Callbacks



19
20
21
# File 'lib/gold/configuration.rb', line 19

def on_apply_tier
  @on_apply_tier
end

#on_check_chargeObject

Callbacks



19
20
21
# File 'lib/gold/configuration.rb', line 19

def on_check_charge
  @on_check_charge
end

#on_cleanupObject

Callbacks



19
20
21
# File 'lib/gold/configuration.rb', line 19

def on_cleanup
  @on_cleanup
end

#on_installObject

Callbacks



19
20
21
# File 'lib/gold/configuration.rb', line 19

def on_install
  @on_install
end

#on_termsObject

Callbacks



19
20
21
# File 'lib/gold/configuration.rb', line 19

def on_terms
  @on_terms
end

#on_uninstallObject

Callbacks



19
20
21
# File 'lib/gold/configuration.rb', line 19

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



78
79
80
81
82
83
84
# File 'lib/gold/configuration.rb', line 78

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

#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)


86
87
88
# File 'lib/gold/configuration.rb', line 86

def test_charge?
  @test_charge
end