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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 832c9a3eb8e7b266f7466e3c9a5ddf96ad58a833a89e3049ea1b5dfb2cdc0b41
4
- data.tar.gz: '058fec100bde5c710cf07c82d8a84a8233a1517eae946b9bfee026a278d18cc1'
3
+ metadata.gz: 65f27a9edbf12fd4df58d29befa1503ea0fa1f1c8d7df83a0e87e2d3c2426883
4
+ data.tar.gz: d85d5795cf1453379816aaa562c89f0e7ec871701893d0ac17a770e8db89cd7d
5
5
  SHA512:
6
- metadata.gz: 283317dbeff4918a132d062826cb591056e462f60cc45c9b37bbf660010722d6fa1af7450a307ca86d6c8a010581ebba5a08d385af5dd51587d7805027a190c9
7
- data.tar.gz: 500e8bfe2a67dc843e17d271bce9b261ae5e68cd3256c7251281e025f2596eab85bab50906a3bb8cebc0961a61a1b624781e14be7456d0877a9ea90b6b497658
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 reources name and params to perform HTTPS GET request.
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 reources name and params to perform HTTPS POST request.
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 reources name and params to perform HTTPS PATCH request.
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 reources name and params to perform HTTPS DELETE request.
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 = "#{Cropio::Connection::Configurable::BASE_URL}/#{resource}"
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
 
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cropio
4
+ module Resources
5
+ class WeatherHistoryItem < Cropio::Resource::Base
6
+ end
7
+ end
8
+ end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Cropio
2
- VERSION = '0.32'.freeze
2
+ VERSION = '0.33'.freeze
3
3
  end
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.32'
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: 2022-03-10 00:00:00.000000000 Z
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