flurry 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 92052cc9650bc214947cd3c9add6c5924bc471669cefe385f06e1f44f89be82b
4
- data.tar.gz: 85f6586951d9e4a83f8fbc6a14ff53b44ca24b83479826e9f7e8f15ec3759e93
3
+ metadata.gz: 3cde1d598b20fc4514de059bcc23ca9c80fae07433c9a3f5d50cc26c872afb68
4
+ data.tar.gz: d33afbd639fc828e7fe05bb4b47b94f35654ee8e36bb85064e1cecc969ac875a
5
5
  SHA512:
6
- metadata.gz: c9dcb1f84823530e9276dff30fa2d974c4c7eefe5a4ec1bde8f948970e45be7f8b6548bab649915e534d5f2c74df06448ea475eaa86bd28b7556d1821846afc4
7
- data.tar.gz: d6c650ee3d8dfd68004501fba113f6973b5485c4063f1dc19ea33ae67a386008373da8c7262e5661ee9a7b7be6526edfba7a414412f1cfda0bc8ea44e1cb3e9a
6
+ metadata.gz: a1c24852b29328043a97eb502475581062f96d957bceff546dd822db1c9f22a9a8d0c66f7644f908192eaf8f95874d42cd559a06922a48acb8e0fb74993fabd7
7
+ data.tar.gz: 14374f12b87fc3dff4556ddd7dea211a543e5ee96ecc68cce9bf9f42df9c6089d9431a352330a651be6acc1b8a3fc6a2d27095749e461c4a2d7d112b5599c1b4
@@ -1,12 +1,13 @@
1
1
  module Flurry
2
2
  # Contains all the configuration for the gem
3
3
  class Configuration
4
- attr_accessor :token, :time_zone, :format
4
+ attr_accessor :token, :time_zone, :format, :timeout
5
5
 
6
6
  def initialize
7
7
  @token = nil
8
8
  @time_zone = nil
9
9
  @format = nil
10
+ @timeout = nil
10
11
  end
11
12
  end
12
13
  end
@@ -28,11 +28,10 @@ module Flurry
28
28
 
29
29
  def between(start, finish = nil, format: '%Y-%m-%d')
30
30
  raise Flurry::Error, 'at least start time has to be provided' unless start
31
- raise ArgumentError, 'start must be a Time/Date/DateTime' unless datetime?(start)
32
- raise ArgumentError, 'finish must be a Time/Date/DateTime' if finish && !datetime?(finish)
33
31
 
34
- finish = (finish || tomorrow(start)).strftime(format)
35
- start = start.strftime(format)
32
+ finish ||= datetime?(start) ? tomorrow(start) : start
33
+ finish = finish.strftime(format) if datetime? finish
34
+ start = start.strftime(format) if datetime? start
36
35
 
37
36
  dup.tap { |it| it.range = [start, finish] }
38
37
  end
@@ -61,8 +60,10 @@ module Flurry
61
60
  dup.tap { |it| it.format = format }
62
61
  end
63
62
 
64
- def fetch
65
- self.class.get(full_path).response
63
+ def fetch(timeout = Flurry.configuration.timeout)
64
+ options = {}
65
+ options[:timeout] = timeout if timeout
66
+ self.class.get(full_path, options).response
66
67
  end
67
68
 
68
69
  protected
@@ -1,3 +1,3 @@
1
1
  module Flurry
2
- VERSION = '0.4.0'.freeze
2
+ VERSION = '0.4.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flurry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roger Bagué
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-20 00:00:00.000000000 Z
11
+ date: 2019-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty