cropio-ruby 0.32 → 0.33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cropio/connection/proxiable.rb +11 -5
- data/lib/cropio/resources/weather_history_item.rb +8 -0
- data/lib/cropio/resources.rb +1 -0
- data/lib/cropio/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65f27a9edbf12fd4df58d29befa1503ea0fa1f1c8d7df83a0e87e2d3c2426883
|
4
|
+
data.tar.gz: d85d5795cf1453379816aaa562c89f0e7ec871701893d0ac17a770e8db89cd7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1cc4ade1d5d1cc27d86ae87905ac3eb899eed2254426ee6d7b8b39882034a1c4d9b2f395143f4173b9d8258ec1a5582cb1708142aaa37e87f1b610e25d847bc
|
7
|
+
data.tar.gz: 62e6bb41f88bca576c45982ae749656c742c36a86dfc3d71e93d310215c1ace8d71d39d455840dfd867134b50aa5dedf139d562f4a6a9a411bd98f253927f6fa
|
@@ -4,7 +4,7 @@ module Cropio
|
|
4
4
|
module Connection
|
5
5
|
# Contains logic of proxing calls to HTTPS requests.
|
6
6
|
module Proxiable
|
7
|
-
# Accepts
|
7
|
+
# Accepts resources name and params to perform HTTPS GET request.
|
8
8
|
def get(resource, query = {})
|
9
9
|
rmethod = extract_resource_method!(query)
|
10
10
|
id = extract_record_id!(query)
|
@@ -13,17 +13,17 @@ module Cropio
|
|
13
13
|
headers: { params: query })
|
14
14
|
end
|
15
15
|
|
16
|
-
# Accepts
|
16
|
+
# Accepts resources name and params to perform HTTPS POST request.
|
17
17
|
def post(resource, data)
|
18
18
|
proxy(method: :post, url: url_for(resource), data: data)
|
19
19
|
end
|
20
20
|
|
21
|
-
# Accepts
|
21
|
+
# Accepts resources name and params to perform HTTPS PATCH request.
|
22
22
|
def patch(resource, data)
|
23
23
|
proxy(method: :patch, url: url_for(resource), data: data)
|
24
24
|
end
|
25
25
|
|
26
|
-
# Accepts
|
26
|
+
# Accepts resources name and params to perform HTTPS DELETE request.
|
27
27
|
def delete(resource)
|
28
28
|
proxy(method: :delete, url: url_for(resource))
|
29
29
|
end
|
@@ -31,12 +31,18 @@ module Cropio
|
|
31
31
|
protected
|
32
32
|
|
33
33
|
def url_for(resource, resource_method = nil, id = nil)
|
34
|
-
url =
|
34
|
+
url = resolve_api_url(resource)
|
35
35
|
url += "/#{resource_method}" if resource_method
|
36
36
|
url += "/#{id}" if id
|
37
37
|
url
|
38
38
|
end
|
39
39
|
|
40
|
+
def resolve_api_url(resource)
|
41
|
+
Cropio::Connection::Configurable::BASE_URL +
|
42
|
+
(resource == 'weather_history_items' ? 'a' : '') +
|
43
|
+
"/#{resource}"
|
44
|
+
end
|
45
|
+
|
40
46
|
def extract_resource_method!(query)
|
41
47
|
raise ArgumentError unless query.is_a?(Hash)
|
42
48
|
|
data/lib/cropio/resources.rb
CHANGED
@@ -70,6 +70,7 @@ require_relative './resources/fuel_type'
|
|
70
70
|
require_relative './resources/fuel_tank'
|
71
71
|
require_relative './resources/fuel_pump'
|
72
72
|
require_relative './resources/fuel_movement'
|
73
|
+
require_relative './resources/weather_history_item'
|
73
74
|
|
74
75
|
module Cropio
|
75
76
|
module Resources
|
data/lib/cropio/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cropio-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.33'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Vernidub
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -194,6 +194,7 @@ files:
|
|
194
194
|
- lib/cropio/resources/user_role_assignment.rb
|
195
195
|
- lib/cropio/resources/user_role_permission.rb
|
196
196
|
- lib/cropio/resources/version.rb
|
197
|
+
- lib/cropio/resources/weather_history_item.rb
|
197
198
|
- lib/cropio/resources/work_record.rb
|
198
199
|
- lib/cropio/resources/work_record_machine_region_mapping_item.rb
|
199
200
|
- lib/cropio/resources/work_type.rb
|