numerousapp 1.2.4 → 1.2.5

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/numerousapp.rb +37 -4
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6efa6612d0f0241fc691bc8fde23131ec47566d4
4
- data.tar.gz: 35947e9d1a0357cb754a326b9c6a9b9b0ae90a3f
3
+ metadata.gz: 7c1e0e8af6d101d4cc85bb0176cc96e1f5a8f1ef
4
+ data.tar.gz: 3b62e911c8ea1f100bf88d8a7d5502f14a84eac7
5
5
  SHA512:
6
- metadata.gz: 5dde128d7b5aaa33082ee5b26217eddc21eca1f849b41314a2f340117efdddc147a82f3dad0247cc35d4fe105e68c4060ed6f0d47c14082d66d9494e3869ac42
7
- data.tar.gz: d88cac07ba321bc4076a6f1416c71029c85d1c5279a9d4a56431e8a206b3bfbf3d72cf381f170c2b6143ee1dc16c4e41d1440d281c579326f599d405c8a97772
6
+ metadata.gz: 0bf3dff34e878ed67fab672f765f2c1e3d9d043d42b642d4f8ad37f09069510d92917e09574644e950ee9275c161d21cbb23798e72972bfc66d6a530b27be36b
7
+ data.tar.gz: 013c8ac3c5b57a5b4aec596068079cff445f7799f6b25c99d45afbc7769ece57d9467b317911191a8d616d16319b873b863e358a19b094e1c456ab0c8f50f62b
data/lib/numerousapp.rb CHANGED
@@ -223,7 +223,7 @@ class NumerousClientInternals
223
223
 
224
224
  protected
225
225
 
226
- VersionString = '20150730-1.2.4'
226
+ VersionString = '20150811-1.2.5'
227
227
 
228
228
  MethMap = {
229
229
  GET: Net::HTTP::Get,
@@ -1254,6 +1254,10 @@ class NumerousMetric < NumerousClientInternals
1254
1254
  list: 'events',
1255
1255
  dupFilter: 'id'
1256
1256
  },
1257
+ at: { # variation for finding specific event by time stamp
1258
+ appendPath: '/at?t=%{timestr}',
1259
+ httpMethod: :GET
1260
+ },
1257
1261
  POST: {
1258
1262
  successCodes: [ 201 ]
1259
1263
  }
@@ -1533,11 +1537,34 @@ class NumerousMetric < NumerousClientInternals
1533
1537
  # Obtain a specific metric event from the server
1534
1538
  #
1535
1539
  # @param [String] eId The specific event ID
1540
+ # @param [String] before
1541
+ # Timestamp. Do not specify eId with this. You can also
1542
+ # also provide this as a strftime-able date/time object.
1536
1543
  # @return [Hash] The string-key hash of the event
1537
1544
  # @raise [NumerousError] Not found (.code will be 404)
1538
1545
  #
1539
- def event(eId)
1540
- api = getAPI(:event, :GET, {eventID:eId})
1546
+ def event(eId=nil, before:nil)
1547
+ if eId and before
1548
+ raise ArgumentError
1549
+ elsif eId
1550
+ api = getAPI(:event, :GET, {eventID:eId})
1551
+ else # the "before" variant
1552
+ # if you gave us a formattable time try converting it
1553
+ begin
1554
+ ts = before.strftime('%Y-%m-%dT%H:%M:%S.')
1555
+ # note: we truncate, rather than round, the microseconds
1556
+ # for simplicity (in case usec is 999900 for example).
1557
+ begin
1558
+ ts += ("%03dZ" % (before.usec/1000))
1559
+ rescue NoMethodError # in case no usec method (?)
1560
+ ts += '000Z'
1561
+ end
1562
+ rescue NoMethodError # just take your argument
1563
+ ts = before # which should be a string already
1564
+ end
1565
+ api = getAPI(:events, :at, {timestr:before})
1566
+ end
1567
+
1541
1568
  return @nr.simpleAPI(api)
1542
1569
  end
1543
1570
 
@@ -1674,7 +1701,13 @@ class NumerousMetric < NumerousClientInternals
1674
1701
  # if you gave us a formattable time try converting it
1675
1702
  begin
1676
1703
  ts = updated.strftime('%Y-%m-%dT%H:%M:%S.')
1677
- ts += ("%03dZ" % ((updated.usec+500)/1000))
1704
+ # note: we truncate, rather than round, the microseconds
1705
+ # for simplicity (in case usec is 999900 for example).
1706
+ begin
1707
+ ts += ("%03dZ" % (updated.usec/1000))
1708
+ rescue NoMethodError # in case no usec method (?)
1709
+ ts += '000Z'
1710
+ end
1678
1711
  rescue NoMethodError # just take your argument
1679
1712
  ts = updated # which should be a string already
1680
1713
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: numerousapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neil Webber
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-30 00:00:00.000000000 Z
11
+ date: 2015-08-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Classes implementing the NumerousApp REST APIs for metrics. Requires
14
14
  Ruby 2.x