Skip to content

Commit

Permalink
Merge pull request #843 from blowmage/language-fixes
Browse files Browse the repository at this point in the history
More Language Changes
  • Loading branch information
quartzmo committed Aug 24, 2016
2 parents f7e239d + ca5a020 commit a738e43
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 8 deletions.
2 changes: 2 additions & 0 deletions google-cloud-language/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ task :acceptance, :project, :keyfile do |t, args|
# always overwrite when running tests
ENV["LANGUAGE_PROJECT"] = project
ENV["LANGUAGE_KEYFILE"] = keyfile
ENV["STORAGE_PROJECT"] = project
ENV["STORAGE_KEYFILE"] = keyfile

$LOAD_PATH.unshift "lib", "acceptance"
Dir.glob("acceptance/**/*_test.rb").each { |file| require_relative file }
Expand Down
2 changes: 1 addition & 1 deletion google-cloud-language/acceptance/language/html_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
annotation.tokens.must_be :empty?
end

it "runs only the sentiment feature" do
it "runs only the entities feature" do
doc = language.document content, format: :html
doc.must_be :html?
doc.wont_be :text?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
annotation.tokens.must_be :empty?
end

it "runs only the sentiment feature" do
it "runs only the entities feature" do
doc = language.document file, format: :html
doc.must_be :html?
doc.wont_be :text?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
annotation.tokens.must_be :empty?
end

it "runs only the sentiment feature" do
it "runs only the entities feature" do
doc = language.document url, format: :html
doc.must_be :html?
doc.wont_be :text?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
annotation.tokens.must_be :empty?
end

it "runs only the sentiment feature" do
it "runs only the entities feature" do
doc = language.document file, format: :text
doc.must_be :text?
doc.wont_be :html?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
annotation.tokens.must_be :empty?
end

it "runs only the sentiment feature" do
it "runs only the entities feature" do
doc = language.document url, format: :text
doc.must_be :text?
doc.wont_be :html?
Expand Down
2 changes: 1 addition & 1 deletion google-cloud-language/acceptance/language/text_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
annotation.tokens.must_be :empty?
end

it "runs only the sentiment feature" do
it "runs only the entities feature" do
doc = language.document content, format: :text
doc.must_be :text?
doc.wont_be :html?
Expand Down
8 changes: 6 additions & 2 deletions google-cloud-language/lib/google/cloud/language/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ def initialize project, credentials, host: nil, retries: nil,
@timeout = timeout
end

def creds
def channel
GRPC::Core::Channel.new host, nil, chan_creds
end

def chan_creds
return credentials if insecure?
GRPC::Core::ChannelCredentials.new.compose \
GRPC::Core::CallCredentials.new credentials.client.updater_proc
Expand All @@ -48,7 +52,7 @@ def service
return mocked_service if mocked_service
@service ||= V1beta1::LanguageServiceApi.new(
service_path: host,
chan_creds: creds,
channel: channel,
timeout: timeout,
app_name: "google-cloud-language",
app_version: Google::Cloud::Language::VERSION)
Expand Down

0 comments on commit a738e43

Please sign in to comment.