Class: Cardflex::Subscription

Inherits:
Object
  • Object
show all
Includes:
BaseModule
Defined in:
lib/cardflex/subscription.rb

Defined Under Namespace

Modules: Type

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BaseModule

included, #method_missing

Methods included from BaseModule::ClassMethods

#create_helper_methods, #set_instance_variables_from_hash, #snakecase

Constructor Details

#initialize(gateway, attributes) ⇒ Subscription

Returns a new instance of Subscription.



13
14
15
16
17
# File 'lib/cardflex/subscription.rb', line 13

def initialize(gateway, attributes)
  @gateway = gateway
  @type = attributes[:action_type]
  set_instance_variables_from_hash(attributes)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Cardflex::BaseModule

Instance Attribute Details

#action_typeObject (readonly)

Returns the value of attribute action_type.



9
10
11
# File 'lib/cardflex/subscription.rb', line 9

def action_type
  @action_type
end

#billingObject (readonly)

Returns the value of attribute billing.



11
12
13
# File 'lib/cardflex/subscription.rb', line 11

def billing
  @billing
end

#planObject (readonly)

Returns the value of attribute plan.



11
12
13
# File 'lib/cardflex/subscription.rb', line 11

def plan
  @plan
end

#resultObject (readonly)

Returns the value of attribute result.



9
10
11
# File 'lib/cardflex/subscription.rb', line 9

def result
  @result
end

#result_codeObject (readonly)

Returns the value of attribute result_code.



9
10
11
# File 'lib/cardflex/subscription.rb', line 9

def result_code
  @result_code
end

#result_textObject (readonly)

Returns the value of attribute result_text.



9
10
11
# File 'lib/cardflex/subscription.rb', line 9

def result_text
  @result_text
end

#shippingObject (readonly)

Returns the value of attribute shipping.



11
12
13
# File 'lib/cardflex/subscription.rb', line 11

def shipping
  @shipping
end

#subscription_idObject (readonly)

Returns the value of attribute subscription_id.



10
11
12
# File 'lib/cardflex/subscription.rb', line 10

def subscription_id
  @subscription_id
end

#typeObject (readonly)

Returns the value of attribute type.



11
12
13
# File 'lib/cardflex/subscription.rb', line 11

def type
  @type
end

Class Method Details

.delete(subscription_id) ⇒ Object



19
20
21
22
# File 'lib/cardflex/subscription.rb', line 19

def self.delete(subscription_id)
  attributes = { :delete_subscription => { :subscription_id => subscription_id }}
  Configuration.gateway.subscription.request(attributes)
end