Class: BillForward::SubscriptionCharge

Inherits:
MutableEntity show all
Defined in:
lib/bill_forward/entities/subscription_charge.rb

Overview

This entity exposes the following child entities via method_missing:

Invoice .invoice

Instance Attribute Summary

Attributes inherited from BillingEntity

#_client

Class Method Summary collapse

Methods inherited from MutableEntity

#delete, #initialize, #save

Methods inherited from InsertableEntity

#initialize

Methods inherited from BillingEntity

#[], #[]=, #_dump, _load, build_entity, build_entity_array, #camel_case_lower, get_all, get_by_id, #initialize, #method_missing, request_ambiguous, request_first_heterotyped, request_many_heterotyped, #serialize, #serialize_field, singleton_client, #state_params, #to_json, #to_ordered_hash, #to_s, #to_unordered_hash

Constructor Details

This class inherits a constructor from BillForward::MutableEntity

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class BillForward::BillingEntity

Class Method Details

.batch_recalculate(id, request_object = {}, custom_client = nil) ⇒ Object

Raises:

  • (ArgumentError)


28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/bill_forward/entities/subscription_charge.rb', line 28

def batch_recalculate(id, request_object = {}, custom_client = nil)
  raise ArgumentError.new("id cannot be nil") if id.nil?

  endpoint = sprintf('recalculate',
                     ERB::Util.url_encode(id)
  )

  request_entity = BillForward::GenericEntity.new(
      request_object
  )

  self.request_first('post', endpoint, request_entity, nil, custom_client)
end

.create(entity = nil) ⇒ Object



9
10
11
12
# File 'lib/bill_forward/entities/subscription_charge.rb', line 9

def create(entity = nil)
  raise DenyMethod.new 'Create support is denied for this entity; '+
                           'Please use Invoice.create_charge or Subscription.create_charge instead.'
end

.recalculate(id, request_object = {}, custom_client = nil) ⇒ Object

Raises:

  • (ArgumentError)


14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/bill_forward/entities/subscription_charge.rb', line 14

def recalculate(id, request_object = {}, custom_client = nil)
  raise ArgumentError.new("id cannot be nil") if id.nil?

  endpoint = sprintf('%s/recalculate',
                     ERB::Util.url_encode(id)
  )

  request_entity = BillForward::GenericEntity.new(
      request_object
  )

  self.request_first('post', endpoint, request_entity, nil, custom_client)
end