Skip to content
This repository has been archived by the owner on Jun 12, 2019. It is now read-only.

Commit

Permalink
Merge pull request #15 from hakobera/set-faraday-option
Browse files Browse the repository at this point in the history
Enable pass faraday option to google-api ruby client
  • Loading branch information
abronte committed Jan 22, 2015
2 parents 0d3f9bf + d989f40 commit f3fa422
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
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

0 comments on commit f3fa422

Please sign in to comment.