Comments (8)
ok now it is working without me changing anything... i am so confused! I will close the issue, thank you mate for your help and time.
from google_currency.
Here is the full trace:
rake aborted!
Errno::ENETUNREACH: Network is unreachable - connect(2) for "www.google.com" port 80
/home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/net/http.rb:879:in `initialize'
/home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/net/http.rb:879:in `open'
/home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/net/http.rb:879:in `block in connect'
/home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/timeout.rb:76:in `timeout'
/home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/net/http.rb:878:in `connect'
/home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/net/http.rb:863:in `do_start'
/home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/net/http.rb:852:in `start'
/home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/open-uri.rb:313:in `open_http'
/home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/open-uri.rb:724:in `buffer_open'
/home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/open-uri.rb:210:in `block in open_loop'
/home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/open-uri.rb:208:in `catch'
/home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/open-uri.rb:208:in `open_loop'
/home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/open-uri.rb:149:in `open_uri'
/home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/open-uri.rb:704:in `open'
/home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/open-uri.rb:712:in `read'
/home/action/.gem/ruby/2.1.1/gems/google_currency-3.2.0/lib/money/bank/google_currency.rb:128:in `fetch_rate'
/home/action/.gem/ruby/2.1.1/gems/google_currency-3.2.0/lib/money/bank/google_currency.rb:99:in `block in get_rate'
/home/action/.gem/ruby/2.1.1/gems/google_currency-3.2.0/lib/money/bank/google_currency.rb:98:in `synchronize'
/home/action/.gem/ruby/2.1.1/gems/google_currency-3.2.0/lib/money/bank/google_currency.rb:98:in `get_rate'
/home/action/workspace/trendosaur/lib/tasks/import_newstyle.rake:22:in `block in <top (required)>'
/home/action/.gem/ruby/2.1.1/gems/rake-10.3.2/lib/rake/task_manager.rb:209:in `in_namespace'
/home/action/.gem/ruby/2.1.1/gems/rake-10.3.2/lib/rake/dsl_definition.rb:146:in `namespace'
/home/action/workspace/trendosaur/lib/tasks/import_newstyle.rake:1:in `<top (required)>'
/home/action/.gem/ruby/2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `load'
/home/action/.gem/ruby/2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `block in load'
/home/action/.gem/ruby/2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:232:in `load_dependency'
/home/action/.gem/ruby/2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `load'
/home/action/.gem/ruby/2.1.1/gems/railties-4.1.0/lib/rails/engine.rb:654:in `block in run_tasks_blocks'
/home/action/.gem/ruby/2.1.1/gems/railties-4.1.0/lib/rails/engine.rb:654:in `each'
/home/action/.gem/ruby/2.1.1/gems/railties-4.1.0/lib/rails/engine.rb:654:in `run_tasks_blocks'
/home/action/.gem/ruby/2.1.1/gems/railties-4.1.0/lib/rails/application.rb:362:in `run_tasks_blocks'
/home/action/.gem/ruby/2.1.1/gems/railties-4.1.0/lib/rails/engine.rb:449:in `load_tasks'
/home/action/workspace/trendosaur/Rakefile:6:in `<top (required)>'
/home/action/.gem/ruby/2.1.1/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load'
/home/action/.gem/ruby/2.1.1/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/home/action/.gem/ruby/2.1.1/gems/rake-10.3.2/lib/rake/application.rb:687:in `raw_load_rakefile'
/home/action/.gem/ruby/2.1.1/gems/rake-10.3.2/lib/rake/application.rb:94:in `block in load_rakefile'
/home/action/.gem/ruby/2.1.1/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/action/.gem/ruby/2.1.1/gems/rake-10.3.2/lib/rake/application.rb:93:in `load_rakefile'
/home/action/.gem/ruby/2.1.1/gems/rake-10.3.2/lib/rake/application.rb:77:in `block in run'
/home/action/.gem/ruby/2.1.1/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/action/.gem/ruby/2.1.1/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/home/action/.gem/ruby/2.1.1/gems/rake-10.3.2/bin/rake:33:in `<top (required)>'
/home/action/.gem/ruby/2.1.1/bin/rake:23:in `load'
/home/action/.gem/ruby/2.1.1/bin/rake:23:in `<main>'
from google_currency.
No idea there. Can you directly access the endpoint outside of the gem?
On Wed, Apr 8, 2015 at 11:45 AM, bnussey [email protected] wrote:
Hello,
Firstly thanks for the great gem, we have been using it with great success in the past months.
I have just started getting a Errno::ENETUNREACH: Network is unreachable - connect(2) for "www.google.com" from this gem but can't think of any changes made that would cause this. Do you have any ideas why this could be? I have tried updating to the latest gem version but to no effect.
Thanks very much.
rake db:migrate
rake aborted!
Errno::ENETUNREACH: Network is unreachable - connect(2) for "www.google.com" port 80
/home/action/.gem/ruby/2.1.1/gems/google_currency-3.2.0/lib/money/bank/google_currency.rb:128:infetch_rate' /home/action/.gem/ruby/2.1.1/gems/google_currency-3.2.0/lib/money/bank/google_currency.rb:99:in
block in get_rate'
/home/action/.gem/ruby/2.1.1/gems/google_currency-3.2.0/lib/money/bank/google_currency.rb:98:insynchronize' /home/action/.gem/ruby/2.1.1/gems/google_currency-3.2.0/lib/money/bank/google_currency.rb:98:in
get_rate'
/home/action/workspace/trendosaur/lib/tasks/import_newstyle.rake:22:inblock in <top (required)>' /home/action/workspace/trendosaur/lib/tasks/import_newstyle.rake:1:in
<top (required)>'
/home/action/.gem/ruby/2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:inload' /home/action/.gem/ruby/2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in
block in load'
/home/action/.gem/ruby/2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:232:inload_dependency' /home/action/.gem/ruby/2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in
load'
/home/action/.gem/ruby/2.1.1/gems/railties-4.1.0/lib/rails/engine.rb:654:inblock in run_tasks_blocks' /home/action/.gem/ruby/2.1.1/gems/railties-4.1.0/lib/rails/engine.rb:654:in
each'
/home/action/.gem/ruby/2.1.1/gems/railties-4.1.0/lib/rails/engine.rb:654:inrun_tasks_blocks' /home/action/.gem/ruby/2.1.1/gems/railties-4.1.0/lib/rails/application.rb:362:in
run_tasks_blocks'
/home/action/.gem/ruby/2.1.1/gems/railties-4.1.0/lib/rails/engine.rb:449:inload_tasks' /home/action/workspace/trendosaur/Rakefile:6:in
<top (required)>'(See full trace by running task with --trace)
Reply to this email directly or view it on GitHub:
#33
from google_currency.
Hey @semmons99 thanks for the help. Hmm I am able to access and use the gem absolutely fine from the console so now I am really confused:
irb(main):005:0> require 'money'
=> false
irb(main):006:0> require 'money/bank/google_currency'
=> true
irb(main):007:0> bank = Money::Bank::GoogleCurrency.new
=> #<Money::Bank::GoogleCurrency:0x007fa04c70c9e0 @rounding_method=nil, @rates={}, @mutex=#<Mutex:0x007fa04c70c990>>
irb(main):008:0> gbp = bank.get_rate(:USD, :GBP).to_f
=> 0.6702
irb(main):009:0> Money::Bank::GoogleCurrency.ttl_in_seconds = 86400
=> 86400
irb(main):010:0> Money::Bank::GoogleCurrency.ttl_in_seconds = 1
=> 1
irb(main):011:0> gbp = bank.get_rate(:USD, :GBP).to_f
=> 0.6703
irb(main):012:0> gbp = bank.get_rate(:USD, :GBP).to_f
=> 0.6703
irb(main):013:0> gbp = bank.get_rate(:USD, :GBP).to_f
=> 0.6703
irb(main):014:0> gbp = bank.get_rate(:USD, :GBP).to_f
=> 0.6703
irb(main):015:0> gbp = bank.get_rate(:USD, :GBP).to_f
=> 0.6703
from google_currency.
And here's the code I am using that has been working absolutely fine up until now:
# Currency Conversion
require 'money'
require 'money/bank/google_currency'
# set the seconds after than the current rates are automatically expired
Money::Bank::GoogleCurrency.ttl_in_seconds = 86400
# set default bank to instance of GoogleCurrency
bank = Money::Bank::GoogleCurrency.new
@gbp = bank.get_rate(:USD, :GBP).to_f
@eur = bank.get_rate(:USD, :EUR).to_f
@aud = bank.get_rate(:USD, :AUD).to_f
@cad = bank.get_rate(:USD, :CAD).to_f
@nzd = bank.get_rate(:USD, :NZD).to_f
# Currency Calculation
# Price
# GBP
def gbp_currency_conversion
@gbp * @price
end
# EUR
def eur_currency_conversion
@eur * @price
end
# AUD
def aud_currency_conversion
@aud * @price
end
# CAD
def cad_currency_conversion
@cad * @price
end
#NZD
def nzd_currency_conversion
@nzd * @price
end
# Revenue
# GBP
def gbp_revenue_currency_conversion
@gbp * @revenue
end
# EUR
def eur_revenue_currency_conversion
@eur * @revenue
end
# AUD
def aud_revenue_currency_conversion
@aud * @revenue
end
# CAD
def cad_revenue_currency_conversion
@cad * @revenue
end
#NZD
def nzd_revenue_currency_conversion
@nzd * @revenue
end
from google_currency.
Is there something on your production box blocking access to the endpoint?
On Wed, Apr 8, 2015 at 1:04 PM, bnussey [email protected] wrote:
And here's the code I am using that has been working absolutely fine up until now:
# Currency Conversion require 'money' require 'money/bank/google_currency' # set the seconds after than the current rates are automatically expired Money::Bank::GoogleCurrency.ttl_in_seconds = 86400 # set default bank to instance of GoogleCurrency bank = Money::Bank::GoogleCurrency.new @gbp = bank.get_rate(:USD, :GBP).to_f @eur = bank.get_rate(:USD, :EUR).to_f @aud = bank.get_rate(:USD, :AUD).to_f @cad = bank.get_rate(:USD, :CAD).to_f @nzd = bank.get_rate(:USD, :NZD).to_f # Currency Calculation # Price # GBP def gbp_currency_conversion @gbp * @price end # EUR def eur_currency_conversion @eur * @price end # AUD def aud_currency_conversion @aud * @price end # CAD def cad_currency_conversion @cad * @price end #NZD def nzd_currency_conversion @nzd * @price end # Revenue # GBP def gbp_revenue_currency_conversion @gbp * @revenue end # EUR def eur_revenue_currency_conversion @eur * @revenue end # AUD def aud_revenue_currency_conversion @aud * @revenue end # CAD def cad_revenue_currency_conversion @cad * @revenue end #NZD def nzd_revenue_currency_conversion @nzd * @revenue end
Reply to this email directly or view it on GitHub:
#33 (comment)
from google_currency.
well this is actually in dev, production is fine. i telnet google.com 80 from the dev area and it is all working.. so weird
from google_currency.
For me, this happened on my system when trying to perform a gem download, completely unrelated to koala, and it was because for our project, we need to download its gems through a proxy, and have the "HTTP_PROXY" terminal environment variable set, along with "HTTPS_PROXY". These seem to enable a proxy path for common commands such as curl, and maybe even wget as well.
When I loaded a fresh terminal environment without those variable set lines in my .bashrc
file, then it worked fine.
So that may be your problem.
from google_currency.
Related Issues (20)
- incorrect conversion of IDR to USD HOT 10
- Problem using GoogleCurrency with the Chilean Peso HOT 3
- Incorrect amount converting USD -> VND HOT 1
- Issue while converting from Indonesian currency to British Pound HOT 3
- undefined method `synchronize' for nil:NilClass HOT 3
- Google Currency changes CLP settings for the Money gem HOT 1
- Zambia currency exchange rate HOT 1
- Release new version to Rubygems HOT 3
- Google endpoint returning a Captcha form HOT 4
- Service moved error HOT 4
- Money::Bank::GoogleCurrencyFetchError HOT 4
- Money::Bank::GoogleCurrencyFetchError HOT 1
- Money::Bank::GoogleCurrencyFetchError and NoMethodError: undefined method `to_money' for 1:Fixnum HOT 2
- is possible to exchange for a given date HOT 1
- Occasional `OpenURI::HTTPError: 404 Not Found` starting ~3/9/2018 HOT 43
- I believe the site has been removed, so the API does not work anymore HOT 4
- Money::Bank::GoogleCurrencyFetchError: Money::Bank::GoogleCurrencyFetchError HOT 4
- ArgumentError: invalid byte sequence in Big5 HOT 1
- Google discontinued their currency converter page
- Google discontinued their currency converter page HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from google_currency.