Skip to content

Commit

Permalink
fix(billing): default to the correct billing service version
Browse files Browse the repository at this point in the history
  • Loading branch information
dazuma committed Feb 10, 2020
1 parent 832f34b commit a07a7aa
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
4 changes: 2 additions & 2 deletions google-cloud-billing/lib/google/cloud/billing.rb
Expand Up @@ -29,7 +29,7 @@ module Billing
#
# @return [CloudBilling::Client] A client object for the specified version.
#
def self.cloud_billing_service version: :v1beta1, &block
def self.cloud_billing_service version: :v1, &block
require "google/cloud/billing/#{version.to_s.downcase}"

package_name = Google::Cloud::Billing
Expand All @@ -49,7 +49,7 @@ def self.cloud_billing_service version: :v1beta1, &block
#
# @return [CloudCatalog::Client] A client object for the specified version.
#
def self.cloud_catalog_service version: :v1beta1, &block
def self.cloud_catalog_service version: :v1, &block
require "google/cloud/billing/#{version.to_s.downcase}"

package_name = Google::Cloud::Billing
Expand Down
2 changes: 1 addition & 1 deletion google-cloud-billing/lib/google/cloud/billing/version.rb
Expand Up @@ -16,7 +16,7 @@
module Google
module Cloud
module Billing
VERSION = "0.1.0".freeze
VERSION = "0.0.1".freeze
end
end
end
40 changes: 40 additions & 0 deletions google-cloud-billing/test/google/cloud/billing/client_test.rb
@@ -0,0 +1,40 @@
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

require "helper"
require "google/cloud/billing"
require "gapic/common"
require "gapic/grpc"

describe Google::Cloud::Billing do
let(:grpc_channel) { GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure }

it "constructs a billing service client with the default version" do
Gapic::ServiceStub.stub :new, :stub do
client = Google::Cloud::Billing.cloud_billing_service do |config|
config.credentials = grpc_channel
end
client.must_be_kind_of Google::Cloud::Billing::V1::CloudBilling::Client
end
end

it "constructs a catalog service client with the default version" do
Gapic::ServiceStub.stub :new, :stub do
client = Google::Cloud::Billing.cloud_catalog_service do |config|
config.credentials = grpc_channel
end
client.must_be_kind_of Google::Cloud::Billing::V1::CloudCatalog::Client
end
end
end

0 comments on commit a07a7aa

Please sign in to comment.