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 +4 -4
- data/CHANGELOG.md +4 -2
- data/Gemfile.lock +1 -1
- data/README.md +22 -1
- data/lib/my_tank_info/resources/environmental_sitegroups.rb +1 -1
- data/lib/my_tank_info/resources/tank_reconciliation_records.rb +13 -8
- data/lib/my_tank_info/tank_reconciliation_record_collection.rb +8 -4
- data/lib/my_tank_info/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 036f7ec0af8d4fca2dbbcf62c38e0999ee8c53d4ef70d9aaf85862842089e178
|
4
|
+
data.tar.gz: eb89a5a9e1bba530dd379c6295857057e4dc29ce81017b396c0ec848d5b26c90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 031657f4e3b4c59e69c0e3c601afc5d85f94001ad411e5eacf7003811dfab7360cb91ffe5c6b116a1b257c07173535326b4706e5468d70b973236146b588eaec
|
7
|
+
data.tar.gz: fd170b24cd3e6d7b12ce0ee3f7645ff1548db36450755d3042a368deec477b0a6d8260d6f5cc20660cb5d990dd9b34e2183092c620f4e387d8d9b24d10719fa9
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
## [1.0.
|
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
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
|
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
|
@@ -10,14 +10,14 @@ module MyTankInfo
|
|
10
10
|
)
|
11
11
|
end
|
12
12
|
|
13
|
-
def retrieve(site_id:,
|
13
|
+
def retrieve(site_id:, date:, reconciliation_period:)
|
14
14
|
date =
|
15
|
-
if
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
-
|
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:,
|
31
|
-
|
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
|
22
|
-
@started_at = @data.min_by(&:started_at)
|
23
|
-
@ended_at = @data.max_by(&: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
|
data/lib/my_tank_info/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2021-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|