Module: Google::Cloud::Billing::V1::CloudBilling::Paths

Extended by:
Paths
Included in:
Client, Paths, Rest::Client
Defined in:
lib/google/cloud/billing/v1/cloud_billing/paths.rb

Overview

Path helper methods for the CloudBilling API.

Instance Method Summary collapse

Instance Method Details

#billing_account_path(billing_account: ) ⇒ ::String #billing_account_path(organization: , billing_account: ) ⇒ ::String

Create a fully-qualified BillingAccount resource string.

Overloads:

  • #billing_account_path(billing_account: ) ⇒ ::String

    The resource will be in the following format:

    billingAccounts/{billing_account}

    Parameters:

    • billing_account (String) (defaults to: )
  • #billing_account_path(organization: , billing_account: ) ⇒ ::String

    The resource will be in the following format:

    organizations/{organization}/billingAccounts/{billing_account}

    Parameters:

    • organization (String) (defaults to: )
    • billing_account (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/google/cloud/billing/v1/cloud_billing/paths.rb', line 46

def  **args
  resources = {
    "billing_account" => (proc do |billing_account:|
      "billingAccounts/#{}"
    end),
    "billing_account:organization" => (proc do |organization:, billing_account:|
      raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"

      "organizations/#{organization}/billingAccounts/#{}"
    end)
  }

  resource = resources[args.keys.sort.join(":")]
  raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
  resource.call(**args)
end

#organization_path(organization:) ⇒ ::String

Create a fully-qualified Organization resource string.

The resource will be in the following format:

organizations/{organization}

Parameters:

  • organization (String)

Returns:

  • (::String)


73
74
75
# File 'lib/google/cloud/billing/v1/cloud_billing/paths.rb', line 73

def organization_path organization:
  "organizations/#{organization}"
end

#project_billing_info_path(project:) ⇒ ::String

Create a fully-qualified ProjectBillingInfo resource string.

The resource will be in the following format:

projects/{project}/billingInfo

Parameters:

  • project (String)

Returns:

  • (::String)


101
102
103
# File 'lib/google/cloud/billing/v1/cloud_billing/paths.rb', line 101

def project_billing_info_path project:
  "projects/#{project}/billingInfo"
end

#project_path(project:) ⇒ ::String

Create a fully-qualified Project resource string.

The resource will be in the following format:

projects/{project}

Parameters:

  • project (String)

Returns:

  • (::String)


87
88
89
# File 'lib/google/cloud/billing/v1/cloud_billing/paths.rb', line 87

def project_path project:
  "projects/#{project}"
end