Module: Tellimus

Defined in:
lib/generators/tellimus/views_generator.rb,
lib/tellimus.rb,
lib/tellimus/engine.rb,
lib/tellimus/errors.rb,
lib/tellimus/version.rb,
app/helpers/tellimus/application_helper.rb,
lib/generators/tellimus/install_generator.rb,
app/controllers/tellimus/application_controller.rb,
app/controllers/tellimus/subscriptions_controller.rb

Overview

Defined Under Namespace

Modules: ApplicationHelper, Plan, Subscription Classes: ApplicationController, Engine, Error, InstallGenerator, NilCardToken, SubscriptionsController, ViewsGenerator

Constant Summary collapse

VERSION =
"0.1.0"
@@subscriptions_owned_by =
nil
@@subscriptions_owned_through =
nil
@@braintree_public_key =
nil
@@braintree_private_key =
nil
@@braintree_merchant_id =
nil
@@braintree_environment =
nil
@@free_trial_length =
nil
@@prorate =
true
@@layout =
nil

Class Method Summary collapse

Class Method Details

.free_trial?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/tellimus.rb', line 79

def self.free_trial?
  free_trial_length.to_i > 0
end

.gatewayObject



50
51
52
53
54
55
56
57
# File 'lib/tellimus.rb', line 50

def self.gateway
  Braintree::Gateway.new(
    environment: braintree_environment,
    merchant_id: braintree_merchant_id,
    public_key: braintree_public_key,
    private_key: braintree_private_key
  )
end

.layoutObject



38
39
40
# File 'lib/tellimus.rb', line 38

def self.layout
  @@layout || 'application'
end

.layout=(layout) ⇒ Object



42
43
44
# File 'lib/tellimus.rb', line 42

def self.layout=(layout)
  @@layout = layout
end

.owner_assignment_symObject

e.g. :user=



70
71
72
# File 'lib/tellimus.rb', line 70

def self.owner_assignment_sym
  :"#{Tellimus.subscriptions_owned_by}="
end

.owner_classObject

e.g. User



75
76
77
# File 'lib/tellimus.rb', line 75

def self.owner_class
  Tellimus.subscriptions_owned_by.to_s.classify.constantize
end

.owner_id_symObject

e.g. :user_id



65
66
67
# File 'lib/tellimus.rb', line 65

def self.owner_id_sym
  :"#{Tellimus.subscriptions_owned_by}_id"
end

.owner_resourceObject

e.g. :users



60
61
62
# File 'lib/tellimus.rb', line 60

def self.owner_resource
  subscriptions_owned_by.to_s.pluralize.to_sym
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Tellimus)

    the object that the method was called on



46
47
48
# File 'lib/tellimus.rb', line 46

def self.setup
  yield self
end

.subscriptions_owned_through_or_byObject



13
14
15
# File 'lib/tellimus.rb', line 13

def self.subscriptions_owned_through_or_by
  @@subscriptions_owned_through || @@subscriptions_owned_by
end