Class: Nombaone::Resources::OrganizationBilling

Inherits:
BaseResource
  • Object
show all
Defined in:
lib/nombaone/resources/organization.rb,
sig/nombaone/resources.rbs

Overview

Billing + dunning policy under nombaone.organization.billing.

Instance Method Summary collapse

Methods inherited from BaseResource

#encode, #initialize, #request, #request_page

Constructor Details

This class inherits a constructor from Nombaone::Resources::BaseResource

Instance Method Details

#retrieve(request_options: {}) ⇒ NombaObject

Read the org's billing + dunning policy.

Parameters:

  • request_options (Hash) (defaults to: {})
  • request_options: (Nombaone::request_options) (defaults to: {})

Returns:



11
12
13
# File 'lib/nombaone/resources/organization.rb', line 11

def retrieve(request_options: {})
  request(:get, "/organization/billing", options: request_options)
end

#update(partial_collection_enabled: OMIT, proration_credit_policy: OMIT, dunning_max_attempts: OMIT, dunning_intervals_hours: OMIT, dunning_max_window_hours: OMIT, grace_period_hours: OMIT, payday_days: OMIT, payday_pull_forward_days: OMIT, payday_bias_enabled: OMIT, default_collection_method: OMIT, comms_enabled: OMIT, request_options: {}) ⇒ NombaObject

Update the billing policy. PUT semantics, but only supplied keys change.

Examples:

nombaone.organization.billing.update(payday_bias_enabled: true, payday_days: [25, 28, 30])

Parameters:

  • partial_collection_enabled (Boolean) (defaults to: OMIT)
  • proration_credit_policy (String) (defaults to: OMIT)

    "credit_next_cycle" or "none".

  • dunning_max_attempts (Integer) (defaults to: OMIT)

    1–10.

  • dunning_intervals_hours (Array<Integer>) (defaults to: OMIT)
  • dunning_max_window_hours (Integer) (defaults to: OMIT)

    must be ≥ the largest interval.

  • grace_period_hours (Integer) (defaults to: OMIT)
  • payday_days (Array<Integer>) (defaults to: OMIT)

    days of month, 1–31.

  • payday_pull_forward_days (Integer) (defaults to: OMIT)

    0–28.

  • payday_bias_enabled (Boolean) (defaults to: OMIT)
  • default_collection_method (String) (defaults to: OMIT)

    "charge_automatically" or "send_invoice".

  • comms_enabled (Boolean) (defaults to: OMIT)
  • request_options (Hash) (defaults to: {})

Returns:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/nombaone/resources/organization.rb', line 33

def update(partial_collection_enabled: OMIT, proration_credit_policy: OMIT,
           dunning_max_attempts: OMIT, dunning_intervals_hours: OMIT,
           dunning_max_window_hours: OMIT, grace_period_hours: OMIT, payday_days: OMIT,
           payday_pull_forward_days: OMIT, payday_bias_enabled: OMIT,
           default_collection_method: OMIT, comms_enabled: OMIT, request_options: {})
  request(:put, "/organization/billing",
          body: {
            partial_collection_enabled: partial_collection_enabled,
            proration_credit_policy: proration_credit_policy,
            dunning_max_attempts: dunning_max_attempts,
            dunning_intervals_hours: dunning_intervals_hours,
            dunning_max_window_hours: dunning_max_window_hours,
            grace_period_hours: grace_period_hours,
            payday_days: payday_days,
            payday_pull_forward_days: payday_pull_forward_days,
            payday_bias_enabled: payday_bias_enabled,
            default_collection_method: default_collection_method,
            comms_enabled: comms_enabled,
          },
          options: request_options)
end