Skip to content
This repository was archived by the owner on Jun 12, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ service_email: '1234@developer.gserviceaccount.com'
key: '/path/to/somekeyfile-privatekey.p12'
project_id: '54321'
dataset: 'yourdataset'
faraday_option:
timeout: 999
```

Then run tests via rake.
Expand Down
3 changes: 2 additions & 1 deletion lib/big_query/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class Client
def initialize(opts = {})
@client = Google::APIClient.new(
application_name: 'BigQuery ruby app',
application_version: BigQuery::VERSION
application_version: BigQuery::VERSION,
faraday_option: opts['faraday_option']
)

key = Google::APIClient::PKCS12.load_key(File.open(
Expand Down
10 changes: 10 additions & 0 deletions test/bigquery.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
require 'big_query'
require 'pry-byebug'

module BigQuery
class Client
attr_accessor :client
end
end

class BigQueryTest < MiniTest::Unit::TestCase
def setup
@bq = BigQuery::Client.new(config)
Expand All @@ -19,6 +25,10 @@ def config
@config = YAML.load_file(config_data)
end

def test_faraday_option_config
assert_equal @bq.client.connection.options.timeout, 999
end

def test_for_tables
table = @bq.tables.select{|t| t['id'] == "#{config['project_id']}:#{config['dataset']}.test"}.first

Expand Down