Skip to content

Commit

Permalink
Expose insecure channel
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Phippen committed Aug 1, 2019
1 parent 7535a97 commit 3c6df40
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
3.0.1:
- Add an insecure channel config flag
3.0.0:
- Compatability with v2 of the API: https://developers.google.com/google-ads/api/docs/release-notes
- Removed the symbol based lookup util, favoring a method based one:
Expand Down
4 changes: 4 additions & 0 deletions lib/google/ads/google_ads/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class Config
attr_accessor :treat_deprecation_warnings_as_errors
attr_accessor :warn_on_all_deprecations

attr_accessor :use_insecure_channel

def initialize(&block)
@refresh_token = nil
@client_id = nil
Expand All @@ -58,6 +60,8 @@ def initialize(&block)
@treat_deprecation_warnings_as_errors = false
@warn_on_all_deprecations = false

@use_insecure_channel = false

yield self if block_given?
end

Expand Down
10 changes: 7 additions & 3 deletions lib/google/ads/google_ads/google_ads_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,13 @@ def make_channel
MAX_METADATA_SIZE => 16*1024*1024,
}

call_creds = GRPC::Core::CallCredentials.new(get_credentials)
chan_creds = GRPC::Core::ChannelCredentials.new.compose(call_creds)
GRPC::Core::Channel.new(target, channel_args, chan_creds)
if !@config.use_insecure_channel
call_creds = GRPC::Core::CallCredentials.new(get_credentials)
chan_creds = GRPC::Core::ChannelCredentials.new.compose(call_creds)
GRPC::Core::Channel.new(target, channel_args, chan_creds)
else
GRPC::Core::Channel.new(target, channel_args, :this_channel_is_insecure)
end
end

def patch_lro_headers(class_to_return, headers)
Expand Down
2 changes: 1 addition & 1 deletion lib/google/ads/google_ads/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
module Google
module Ads
module GoogleAds
CLIENT_LIB_VERSION = '3.0.0'.freeze
CLIENT_LIB_VERSION = '3.0.1'.freeze
end
end
end

0 comments on commit 3c6df40

Please sign in to comment.