cropio-ruby 0.3 → 0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +5 -0
- data/lib/cropio/resource/base.rb +14 -0
- data/lib/cropio/resources/alert.rb +6 -0
- data/lib/cropio/resources/alert_type.rb +6 -0
- data/lib/cropio/resources/automatic_alert.rb +6 -0
- data/lib/cropio/resources/implement_region_mapping_item.rb +6 -0
- data/lib/cropio/resources/inventory_history_item.rb +6 -0
- data/lib/cropio/resources/machine_region.rb +6 -0
- data/lib/cropio/resources/machine_region_mapping_item.rb +6 -0
- data/lib/cropio/resources/machine_task_field_mapping_item.rb +6 -0
- data/lib/cropio/resources/photo.rb +6 -0
- data/lib/cropio/resources/version.rb +6 -0
- data/lib/cropio/resources/work_record.rb +6 -0
- data/lib/cropio/resources/work_record_machine_region_mapping_item.rb +6 -0
- data/lib/cropio/resources/work_type.rb +6 -0
- data/lib/cropio/resources/work_type_group.rb +6 -0
- data/lib/cropio/resources.rb +15 -0
- data/lib/cropio/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0f054e40c312509de7eadca96f9359280ce5ee8
|
4
|
+
data.tar.gz: 416cce05c60e86f151cbda056d64762859fc7407
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6aed002b3ab969b70be875a11777e7a4835e0f7ed084028cf0f911a8ad6bb6f1c66a8b8413996bc848079fc72130110610c2a7507a23ce25ab239ea3fafc73a
|
7
|
+
data.tar.gz: 365d9ad37b67768e257033daea5704f8e879e20a1b33190bf6e6d66af7c00607a6f2707706ba4fd00d9f18657431dc0886e62440366796ee3eb6aa269ab98a7a
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -85,6 +85,11 @@ Crop.changes('2012-01-01', '2016-01-01')
|
|
85
85
|
Crop.changes(Date.new(2012, 1, 1))
|
86
86
|
```
|
87
87
|
|
88
|
+
- get all ids
|
89
|
+
```ruby
|
90
|
+
Crop.ids
|
91
|
+
```
|
92
|
+
|
88
93
|
## Development
|
89
94
|
|
90
95
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/cropio/resource/base.rb
CHANGED
@@ -32,6 +32,10 @@ module Cropio
|
|
32
32
|
all.count
|
33
33
|
end
|
34
34
|
|
35
|
+
def self.ids
|
36
|
+
get_all_ids
|
37
|
+
end
|
38
|
+
|
35
39
|
def self.changes(from_time = nil, to_time = nil)
|
36
40
|
from_time = to_datetime_if_string(from_time)
|
37
41
|
to_time = to_datetime_if_string(to_time)
|
@@ -105,6 +109,12 @@ module Cropio
|
|
105
109
|
to_time: to_time)
|
106
110
|
limit -= limit < LIMIT ? limit : LIMIT
|
107
111
|
to_time = last_record_time(response) || from_time
|
112
|
+
|
113
|
+
# if there is one record in time range we need to step back
|
114
|
+
# for 1ms to exclude cycling
|
115
|
+
if response['data'].count == 1
|
116
|
+
to_time = (Time.parse(to_time) - 1/999999.0).iso8601(6)
|
117
|
+
end
|
108
118
|
buffer += response['data']
|
109
119
|
end
|
110
120
|
buffer
|
@@ -143,6 +153,10 @@ module Cropio
|
|
143
153
|
to_time: options[:to_time])
|
144
154
|
end
|
145
155
|
|
156
|
+
def self.get_all_ids
|
157
|
+
PROXY.get(resources_name, resource_method: :ids)['data']
|
158
|
+
end
|
159
|
+
|
146
160
|
# Converts each received attribute's hash to resources.
|
147
161
|
def self.to_instances(attr_sets)
|
148
162
|
attr_sets.map do |attr_set|
|
data/lib/cropio/resources.rb
CHANGED
@@ -29,6 +29,21 @@ require_relative './resources/user'
|
|
29
29
|
require_relative './resources/user_role'
|
30
30
|
require_relative './resources/user_role_assignment'
|
31
31
|
require_relative './resources/user_role_permission'
|
32
|
+
require_relative './resources/version'
|
33
|
+
require_relative './resources/work_record'
|
34
|
+
require_relative './resources/work_record_machine_region_mapping_item'
|
35
|
+
require_relative './resources/work_type_group'
|
36
|
+
require_relative './resources/work_type'
|
37
|
+
require_relative './resources/machine_task_field_mapping_item'
|
38
|
+
require_relative './resources/alert_type'
|
39
|
+
require_relative './resources/alert'
|
40
|
+
require_relative './resources/machine_region'
|
41
|
+
require_relative './resources/machine_region_mapping_item'
|
42
|
+
require_relative './resources/implement_region_mapping_item'
|
43
|
+
require_relative './resources/inventory_history_item'
|
44
|
+
require_relative './resources/automatic_alert'
|
45
|
+
require_relative './resources/photo'
|
46
|
+
|
32
47
|
|
33
48
|
module Cropio
|
34
49
|
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.11'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Vernidub
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -128,7 +128,10 @@ files:
|
|
128
128
|
- lib/cropio/resources/agri_work_plan.rb
|
129
129
|
- lib/cropio/resources/agri_work_plan_application_mix_item.rb
|
130
130
|
- lib/cropio/resources/agro_operation.rb
|
131
|
+
- lib/cropio/resources/alert.rb
|
132
|
+
- lib/cropio/resources/alert_type.rb
|
131
133
|
- lib/cropio/resources/application_mix_item.rb
|
134
|
+
- lib/cropio/resources/automatic_alert.rb
|
132
135
|
- lib/cropio/resources/avatar.rb
|
133
136
|
- lib/cropio/resources/chemical.rb
|
134
137
|
- lib/cropio/resources/crop.rb
|
@@ -143,11 +146,17 @@ files:
|
|
143
146
|
- lib/cropio/resources/historical_value.rb
|
144
147
|
- lib/cropio/resources/history_item.rb
|
145
148
|
- lib/cropio/resources/implement.rb
|
149
|
+
- lib/cropio/resources/implement_region_mapping_item.rb
|
150
|
+
- lib/cropio/resources/inventory_history_item.rb
|
146
151
|
- lib/cropio/resources/machine.rb
|
147
152
|
- lib/cropio/resources/machine_group.rb
|
153
|
+
- lib/cropio/resources/machine_region.rb
|
154
|
+
- lib/cropio/resources/machine_region_mapping_item.rb
|
148
155
|
- lib/cropio/resources/machine_task.rb
|
149
156
|
- lib/cropio/resources/machine_task_agro_operation_mapping_item.rb
|
157
|
+
- lib/cropio/resources/machine_task_field_mapping_item.rb
|
150
158
|
- lib/cropio/resources/note.rb
|
159
|
+
- lib/cropio/resources/photo.rb
|
151
160
|
- lib/cropio/resources/plant_threat.rb
|
152
161
|
- lib/cropio/resources/satellite_image.rb
|
153
162
|
- lib/cropio/resources/seed.rb
|
@@ -155,6 +164,11 @@ files:
|
|
155
164
|
- lib/cropio/resources/user_role.rb
|
156
165
|
- lib/cropio/resources/user_role_assignment.rb
|
157
166
|
- lib/cropio/resources/user_role_permission.rb
|
167
|
+
- lib/cropio/resources/version.rb
|
168
|
+
- lib/cropio/resources/work_record.rb
|
169
|
+
- lib/cropio/resources/work_record_machine_region_mapping_item.rb
|
170
|
+
- lib/cropio/resources/work_type.rb
|
171
|
+
- lib/cropio/resources/work_type_group.rb
|
158
172
|
- lib/cropio/version.rb
|
159
173
|
homepage: https://cropio.com
|
160
174
|
licenses: []
|