agx 0.2.4 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/Gemfile +5 -0
- data/LICENSE.txt +1 -1
- data/README.md +20 -4
- data/agx.gemspec +7 -7
- data/lib/agx/content/client.rb +4 -1
- data/lib/agx/sync/client.rb +17 -1
- data/lib/agx/version.rb +1 -1
- metadata +12 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b0750cd7f1147e136a2c60d8f2ebd023024960089ec9e94cb94260040f6296c
|
4
|
+
data.tar.gz: 2596b52e80bf4de9dbeb784272a2c944b9ad24236850c440c897d4b378b3b812
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c9213252680c8c44fbeb0f3564c0cffbbc8088d676294fde652d94e51b99e2f9c9e4282c138a0f7d85160d205bec3fc8a0b96e12a1de4b83979a8e4e6dcf2fd
|
7
|
+
data.tar.gz: 83155d65446067ee1848ef52ba53d1862f2be84d751cc96c8f7bf1253c311b686b2f7a5616811bff1035f3c1ceb6a36bc94fea07ce3be67d052d53524e4bb32d
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
[gem]: https://rubygems.org/gems/agx
|
6
6
|
|
7
|
-
Ruby client for accessing
|
7
|
+
Ruby client for accessing Proagrica's [agX Platform APIs](http://www.agxplatform.com/agx-apis/).
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
@@ -72,7 +72,6 @@ expiration timestamp.***
|
|
72
72
|
|
73
73
|
Initiate a sync transaction, make Sync API requests, and end transaction
|
74
74
|
|
75
|
-
***Currently only get requests are supported***
|
76
75
|
```ruby
|
77
76
|
# To make calls without starting a transaction for resources that don't
|
78
77
|
# require it, use the get_nt method
|
@@ -96,6 +95,21 @@ farms = @agx_sync_client.get("Grower/#{grower.guid}/Farm")
|
|
96
95
|
# Get all server changes on farms accessible for a grower since start_time
|
97
96
|
farms = @agx_sync_client.get("Grower/#{grower.guid}/Farm", last_sync_date.to_s)
|
98
97
|
|
98
|
+
# Put (insert) a new Grower
|
99
|
+
now = Time.now.utc
|
100
|
+
new_grower = {
|
101
|
+
"SyncID": @agx_sync_client.sync_id,
|
102
|
+
"ID": SecureRandom.uuid,
|
103
|
+
"Name": "MYNEWGROWER",
|
104
|
+
"ModifiedOn": now,
|
105
|
+
"CreatedOn": now,
|
106
|
+
"CreatorID": @agx_sync_client.sync_id,
|
107
|
+
"EditorID": @agx_sync_client.sync_id,
|
108
|
+
"SchemaVersion": "4.0"
|
109
|
+
}
|
110
|
+
|
111
|
+
@client.put("Grower", new_grower.to_json)
|
112
|
+
|
99
113
|
# etc...
|
100
114
|
|
101
115
|
@agx_sync_client.end_transaction
|
@@ -106,6 +120,8 @@ user_transaction_id = nil
|
|
106
120
|
|
107
121
|
### agX Pictures API
|
108
122
|
|
123
|
+
*Note: The pictures API client implementation still needs more work.*
|
124
|
+
|
109
125
|
Setup agX Pictures Client
|
110
126
|
|
111
127
|
```ruby
|
@@ -141,11 +157,11 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
141
157
|
|
142
158
|
## Contributing
|
143
159
|
|
144
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
160
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/cropquest/agx-ruby.
|
145
161
|
|
146
162
|
|
147
163
|
## License
|
148
164
|
|
149
165
|
The gem is available as open source under the terms of the MIT License (see [LICENSE.txt](https://github.com/beaorn/agx-ruby/blob/master/LICENSE.txt))
|
150
166
|
|
151
|
-
[agX](http://www.agxplatform.com/) is a registered trademark of [
|
167
|
+
[agX](http://www.agxplatform.com/) is a registered trademark of [Proagrica](http://www.proagrica.com).
|
data/agx.gemspec
CHANGED
@@ -7,11 +7,11 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "agx"
|
8
8
|
spec.version = Agx::VERSION
|
9
9
|
spec.authors = ["Bryce Johnston"]
|
10
|
-
spec.email = ["bryce@
|
10
|
+
spec.email = ["bryce.johnston@hey.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{Ruby client for accessing agX Platform APIs.}
|
13
|
-
spec.description = %q{Ruby client for accessing
|
14
|
-
spec.homepage = "https://github.com/
|
13
|
+
spec.description = %q{Ruby client for accessing Proagrica's agX Platform APIs.}
|
14
|
+
spec.homepage = "https://github.com/cropquest/agx-ruby"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_dependency "oj", "< 4"
|
23
23
|
spec.add_dependency "oauth2", "< 2"
|
24
24
|
|
25
|
-
spec.add_development_dependency "bundler", "~> 1
|
26
|
-
spec.add_development_dependency "rake", "~>
|
27
|
-
spec.add_development_dependency "rspec", "~> 3.
|
28
|
-
end
|
25
|
+
spec.add_development_dependency "bundler", "~> 2.1"
|
26
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.9"
|
28
|
+
end
|
data/lib/agx/content/client.rb
CHANGED
data/lib/agx/sync/client.rb
CHANGED
@@ -66,6 +66,19 @@ module Agx
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
+
def put(resource, body)
|
70
|
+
validate_sync_attributes
|
71
|
+
|
72
|
+
url = "#{@api_url}#{resource}?transactionId=#{@transaction_id}"
|
73
|
+
|
74
|
+
begin
|
75
|
+
response = current_token.put(url, {:body => body, :headers => @headers})
|
76
|
+
parse_response(response.body)
|
77
|
+
rescue => e
|
78
|
+
handle_error(e)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
69
82
|
def start_transaction
|
70
83
|
validate_credentials
|
71
84
|
|
@@ -95,7 +108,7 @@ module Agx
|
|
95
108
|
)
|
96
109
|
return true
|
97
110
|
rescue => e
|
98
|
-
if e.response && e.response.
|
111
|
+
if e.response && e.response.status && e.response.status.to_i >= 400
|
99
112
|
return true
|
100
113
|
else
|
101
114
|
handle_error(e)
|
@@ -190,6 +203,9 @@ module Agx
|
|
190
203
|
token_url: @token_url,
|
191
204
|
options: {
|
192
205
|
ssl: { ca_path: "/usr/lib/ssl/certs" }
|
206
|
+
},
|
207
|
+
connection_opts: {
|
208
|
+
request: { timeout: 300 }
|
193
209
|
}
|
194
210
|
}
|
195
211
|
)
|
data/lib/agx/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: agx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryce Johnston
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|
@@ -44,45 +44,45 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1
|
47
|
+
version: '2.1'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1
|
54
|
+
version: '2.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '13.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '13.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '3.
|
75
|
+
version: '3.9'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '3.
|
83
|
-
description: Ruby client for accessing
|
82
|
+
version: '3.9'
|
83
|
+
description: Ruby client for accessing Proagrica's agX Platform APIs.
|
84
84
|
email:
|
85
|
-
- bryce@
|
85
|
+
- bryce.johnston@hey.com
|
86
86
|
executables: []
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
@@ -106,7 +106,7 @@ files:
|
|
106
106
|
- lib/agx/sync.rb
|
107
107
|
- lib/agx/sync/client.rb
|
108
108
|
- lib/agx/version.rb
|
109
|
-
homepage: https://github.com/
|
109
|
+
homepage: https://github.com/cropquest/agx-ruby
|
110
110
|
licenses:
|
111
111
|
- MIT
|
112
112
|
metadata: {}
|
@@ -125,8 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
|
-
|
129
|
-
rubygems_version: 2.7.6
|
128
|
+
rubygems_version: 3.1.2
|
130
129
|
signing_key:
|
131
130
|
specification_version: 4
|
132
131
|
summary: Ruby client for accessing agX Platform APIs.
|