my_tank_info 1.0.1 → 1.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd672f9b79217735ad9fe5b46c835cb5a62400c896eed1cbfba55c991b07eeca
4
- data.tar.gz: 317aa37ace993a712176937f7aa153ac4ff38fbd5e07b039c53ec3681f726e25
3
+ metadata.gz: 036f7ec0af8d4fca2dbbcf62c38e0999ee8c53d4ef70d9aaf85862842089e178
4
+ data.tar.gz: eb89a5a9e1bba530dd379c6295857057e4dc29ce81017b396c0ec848d5b26c90
5
5
  SHA512:
6
- metadata.gz: 5468194cd00880e82d68ea1a1e05dc46d08d8e25759a807e1da2ead282765cc504ea588cf70da49a47d46e2d4a6ac6ea625a40364a4ae7f647ce42b01d2ae86b
7
- data.tar.gz: 57fefd10c9e7266e136143439d33bc45078751c65e9c8ffcda365e7a3a9a0046475950337a885f815559b0c0628ee910b87c02f1bbde9f5716ef5c580d1019a3
6
+ metadata.gz: 031657f4e3b4c59e69c0e3c601afc5d85f94001ad411e5eacf7003811dfab7360cb91ffe5c6b116a1b257c07173535326b4706e5468d70b973236146b588eaec
7
+ data.tar.gz: fd170b24cd3e6d7b12ce0ee3f7645ff1548db36450755d3042a368deec477b0a6d8260d6f5cc20660cb5d990dd9b34e2183092c620f4e387d8d9b24d10719fa9
data/CHANGELOG.md CHANGED
@@ -1,8 +1,10 @@
1
- ## [1.0.1] - 2021-09-20
1
+ ## [1.0.2] - 2021-09-21
2
+ - Add convenience methods for accessing UOM on TankReconciliationRecordCollection
3
+ - Fix bug that prevented tank reconciliation records from being updated
2
4
 
5
+ ## [1.0.1] - 2021-09-20
3
6
  - Updates Faraday gem to 1.8.0
4
7
  - Fixes Gemfile lock version of the gem
5
8
 
6
9
  ## [1.0.0] - 2021-09-20
7
-
8
10
  - Initial release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- my_tank_info (1.0.1)
4
+ my_tank_info (1.0.2)
5
5
  faraday (~> 1.7)
6
6
  faraday_middleware (~> 1.1)
7
7
 
data/README.md CHANGED
@@ -70,7 +70,7 @@ client.tank_leak_results.list(site_id: 123)
70
70
  client.line_leak_results.list(site_id: 123)
71
71
 
72
72
  # View Sensor Status Results for a site
73
- # Will return empty if the site does not have Continuous iI-tank Leak Detection (CITLD), which is
73
+ # Will return empty if the site does not have Continuous In-Tank Leak Detection (CITLD), which is
74
74
  # often referred to as CSLD or (Continuous Statistical Leak Detection)
75
75
  client.csld_results.list(site_id: 123)
76
76
 
@@ -123,6 +123,27 @@ tank.passed?
123
123
  # provided reconciliation_period to decide if tank has failed
124
124
  tank.failed?
125
125
  ```
126
+ ```ruby
127
+ date = "2021-09-11T00:09:00-04:00" # date must match the standard MyTankInfo format (%Y-%m-%dT%H:%M:%S%:z)
128
+ client.tank_reconciliation_records.retrieve(site_id: 1, date: date, reconciliation_period: :monthly)
129
+
130
+ attrs = [
131
+ {
132
+ id: "1368902",
133
+ product_name: "E-10",
134
+ start_date_time: "2021-09-16T02:00:00.0000000-05:00",
135
+ end_date_time: "2021-09-17T02:00:00.0000000-05:00",
136
+ tank_numbers: "1",
137
+ start_volume: "7252",
138
+ end_volume: "7936",
139
+ deliveries_volume: "2004",
140
+ sales_volume: "1319",
141
+ water_height: "0"
142
+ }
143
+ ]
144
+ client.tank_reconciliation_records.update(site_id: 1, date: date, reconciliation_period: :monthly, attributes: attrs)
145
+ ```
146
+
126
147
 
127
148
 
128
149
  ### Inventory API
@@ -2,7 +2,7 @@
2
2
 
3
3
  module MyTankInfo
4
4
  class EnvironmentalSitegroupsResource < Resource
5
- def list(environmental: true)
5
+ def list
6
6
  Collection.from_response(get_request("api/environmental/sitegroups"), type: EnvironmentalSitegroup)
7
7
  end
8
8
  end
@@ -10,14 +10,14 @@ module MyTankInfo
10
10
  )
11
11
  end
12
12
 
13
- def retrieve(site_id:, reconciliation_period:, started_at:)
13
+ def retrieve(site_id:, date:, reconciliation_period:)
14
14
  date =
15
- if started_at.instance_of?(DateTime) ||
16
- started_at.instance_of?(Date) ||
17
- started_at.instance_of?(Time)
18
- started_at.strftime(MYTI_DATE_TIME_FORMAT)
15
+ if date.instance_of?(DateTime) ||
16
+ date.instance_of?(Date) ||
17
+ date.instance_of?(Time)
18
+ date.strftime(MYTI_DATE_TIME_FORMAT)
19
19
  else
20
- started_at
20
+ date
21
21
  end
22
22
 
23
23
  response = get_request("api/recon/sites/#{site_id}/#{date}")
@@ -27,8 +27,13 @@ module MyTankInfo
27
27
  )
28
28
  end
29
29
 
30
- def update(site_id:, started_at:, **attributes)
31
- put("api/recon/sites/#{site_id}/#{date}", body: attributes)
30
+ def update(site_id:, date:, reconciliation_period:, attributes:)
31
+ response = put_request("api/recon/sites/#{site_id}/#{date}", body: attributes)
32
+
33
+ TankReconciliationRecordCollection.from_response(
34
+ response,
35
+ reconciliation_period: reconciliation_period
36
+ )
32
37
  end
33
38
  end
34
39
  end
@@ -2,7 +2,8 @@
2
2
 
3
3
  module MyTankInfo
4
4
  class TankReconciliationRecordCollection
5
- attr_reader :data, :size, :site_id, :reconciliation_period, :started_at, :ended_at
5
+ attr_reader :data, :size, :site_id, :reconciliation_period, :started_at, :ended_at,
6
+ :volume_uom, :height_uom
6
7
 
7
8
  def self.from_response(response, reconciliation_period:)
8
9
  body = response.body
@@ -18,9 +19,12 @@ module MyTankInfo
18
19
  @size = @data.size
19
20
  @reconciliation_period = reconciliation_period
20
21
 
21
- @site_id = @data.first.site_id
22
- @started_at = @data.min_by(&:started_at).started_at
23
- @ended_at = @data.max_by(&:started_at).started_at
22
+ @site_id = @data.first&.site_id
23
+ @started_at = @data.min_by(&:started_at)&.started_at
24
+ @ended_at = @data.max_by(&:started_at)&.started_at
25
+
26
+ @volume_uom = @data.first&.volume_uom
27
+ @height_uom = @data.first&.height_uom
24
28
  end
25
29
 
26
30
  def tanks
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MyTankInfo
4
- VERSION = "1.0.1"
4
+ VERSION = "1.0.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: my_tank_info
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Keesling
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-20 00:00:00.000000000 Z
11
+ date: 2021-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday