Class: AbacatePay::Resources::Billings

Inherits:
Resource
  • Object
show all
Defined in:
lib/abacate_pay/resources/billings.rb,
lib/abacate_pay/resources/billings/product.rb,
lib/abacate_pay/resources/billings/metadata.rb

Overview

Represents a billing resource in the AbacatePay payment system.

Manages billing-related data including payment methods, products, scheduling, and customer information for recurring and one-time payments.

Defined Under Namespace

Classes: Metadata, Product

Constant Summary collapse

RESOURCE_PROPERTIES =

Maps property names to their corresponding resource classes

{
  metadata: "AbacatePay::Resources::Billings::Metadata",
  customer: "AbacatePay::Resources::Customers",
  products: "AbacatePay::Resources::Billings::Product"
}.freeze
ENUM_PROPERTIES =

Maps property names to their corresponding enum classes

{
  status: "AbacatePay::Enums::Billings::Statuses",
  frequency: "AbacatePay::Enums::Billings::Frequencies",
  methods: "AbacatePay::Enums::Billings::Methods"
}.freeze
DATETIME_PROPERTIES =

Properties that should be handled as DateTime objects

%w[
  next_billing
  created_at
  updated_at
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Billings

Creates a new Billing instance

Parameters:

  • data (Hash)

    The raw billing data

Raises:

  • (ArgumentError)

    If the data is invalid



47
48
49
# File 'lib/abacate_pay/resources/billings.rb', line 47

def initialize(data)
  fill(data)
end

Instance Attribute Details

#account_idObject

Basic attributes



32
33
34
# File 'lib/abacate_pay/resources/billings.rb', line 32

def 
  @account_id
end

#amountObject

Basic attributes



32
33
34
# File 'lib/abacate_pay/resources/billings.rb', line 32

def amount
  @amount
end

#created_atObject

DateTime attributes



41
42
43
# File 'lib/abacate_pay/resources/billings.rb', line 41

def created_at
  @created_at
end

#customerObject

Complex attributes



35
36
37
# File 'lib/abacate_pay/resources/billings.rb', line 35

def customer
  @customer
end

#dev_modeObject

Basic attributes



32
33
34
# File 'lib/abacate_pay/resources/billings.rb', line 32

def dev_mode
  @dev_mode
end

#frequencyObject

Enum attributes



38
39
40
# File 'lib/abacate_pay/resources/billings.rb', line 38

def frequency
  @frequency
end

#idObject

Basic attributes



32
33
34
# File 'lib/abacate_pay/resources/billings.rb', line 32

def id
  @id
end

#metadataObject

Complex attributes



35
36
37
# File 'lib/abacate_pay/resources/billings.rb', line 35

def 
  @metadata
end

#methodsObject

Complex attributes



35
36
37
# File 'lib/abacate_pay/resources/billings.rb', line 35

def methods
  @methods
end

#next_billingObject

DateTime attributes



41
42
43
# File 'lib/abacate_pay/resources/billings.rb', line 41

def next_billing
  @next_billing
end

#productsObject

Complex attributes



35
36
37
# File 'lib/abacate_pay/resources/billings.rb', line 35

def products
  @products
end

#statusObject

Enum attributes



38
39
40
# File 'lib/abacate_pay/resources/billings.rb', line 38

def status
  @status
end

#updated_atObject

DateTime attributes



41
42
43
# File 'lib/abacate_pay/resources/billings.rb', line 41

def updated_at
  @updated_at
end

#urlObject

Basic attributes



32
33
34
# File 'lib/abacate_pay/resources/billings.rb', line 32

def url
  @url
end

Instance Method Details

#dev_mode?Boolean?

Checks if billing is in development mode

Returns:

  • (Boolean, nil)

    True if in dev mode, false if not, or nil if not set



54
55
56
# File 'lib/abacate_pay/resources/billings.rb', line 54

def dev_mode?
  @dev_mode
end