localeapp 0.6.5 → 0.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,4 +1,8 @@
1
- # Version 0.6.4
1
+ # Version 0.6.6
2
+
3
+ * Add a timeout configuration setting
4
+
5
+ # Version 0.6.5
2
6
 
3
7
  * Build gem with 1.8.7 to fix gemspec errors
4
8
 
@@ -56,6 +56,7 @@ module Localeapp
56
56
  :url => url,
57
57
  :method => method,
58
58
  :headers => headers,
59
+ :timeout => Localeapp.configuration.timeout,
59
60
  :verify_ssl => (Localeapp.configuration.ssl_verify ? OpenSSL::SSL::VERIFY_PEER : false)
60
61
  }
61
62
  parameters[:ca_file] = Localeapp.configuration.ssl_ca_file if Localeapp.configuration.ssl_ca_file
@@ -10,6 +10,9 @@ module Localeapp
10
10
  # The proxy to connect via
11
11
  attr_accessor :proxy
12
12
 
13
+ # The request timeout
14
+ attr_accessor :timeout
15
+
13
16
  # Whether to use https or not (defaults to true)
14
17
  attr_accessor :secure
15
18
 
@@ -76,6 +79,7 @@ module Localeapp
76
79
  def defaults
77
80
  defaults = {
78
81
  :host => 'api.localeapp.com',
82
+ :timeout => 60,
79
83
  :secure => true,
80
84
  :ssl_verify => false,
81
85
  :sending_environments => %w(development),
@@ -1,3 +1,3 @@
1
1
  module Localeapp
2
- VERSION = "0.6.5"
2
+ VERSION = "0.6.6"
3
3
  end
@@ -96,6 +96,14 @@ describe Localeapp::ApiCaller, "#call(object)" do
96
96
  end
97
97
  end
98
98
 
99
+ context "Timeout" do
100
+ it "sets the timeout to the configured timeout" do
101
+ Localeapp.configuration.timeout = 120
102
+ RestClient::Request.should_receive(:execute).with(hash_including(:timeout => 120)).and_return(double('response', :code => 200))
103
+ @api_caller.call(self)
104
+ end
105
+ end
106
+
99
107
  context "a GET request" do
100
108
  it "makes the call to the api" do
101
109
  RestClient::Request.should_receive(:execute).with(hash_including(:url => @url, :method => :get)).and_return(double('response', :code => 200))
@@ -19,6 +19,14 @@ describe Localeapp::Configuration do
19
19
  expect { configuration.proxy = 'http://localhost:8888' }.to change(configuration, :proxy).to('http://localhost:8888')
20
20
  end
21
21
 
22
+ it "sets timeout to 60 by default" do
23
+ configuration.timeout.should == 60
24
+ end
25
+
26
+ it "allows timeout setting to be overridden" do
27
+ expect { configuration.timeout = 120 }.to change(configuration, :timeout).to(120)
28
+ end
29
+
22
30
  it "sets secure to true by default" do
23
31
  configuration.secure.should == true
24
32
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: localeapp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 5
10
- version: 0.6.5
9
+ - 6
10
+ version: 0.6.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Christopher Dell
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-10-26 00:00:00 Z
19
+ date: 2012-11-08 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: i18n