diff --git a/README.md b/README.md index 08295cb..87f056e 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/lib/big_query/client.rb b/lib/big_query/client.rb index cf05461..845a171 100644 --- a/lib/big_query/client.rb +++ b/lib/big_query/client.rb @@ -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( diff --git a/test/bigquery.rb b/test/bigquery.rb index ead6867..3b3c954 100644 --- a/test/bigquery.rb +++ b/test/bigquery.rb @@ -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) @@ -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