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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ccbe1e848cec1e453b8bc1b13ce4433febcbbd3ebe26e3137abd9159368d5d7
4
- data.tar.gz: fde39187e4f243987f465310d6056fb636e63d245b5a546688729e1cedb70ced
3
+ metadata.gz: 3b0750cd7f1147e136a2c60d8f2ebd023024960089ec9e94cb94260040f6296c
4
+ data.tar.gz: 2596b52e80bf4de9dbeb784272a2c944b9ad24236850c440c897d4b378b3b812
5
5
  SHA512:
6
- metadata.gz: 29cc151268d422113fc600b36a18fed72bebd0e547c63e367067543845a6d6f9ff94bdc34c9b5905da7a0cf2e6a4c72dc371ced3efd2cdc430125732d62d50e5
7
- data.tar.gz: 14dcc251d90761f47ba215aadeb8a25503da8cf4049b9788d583eba626c1521242c153391d4f257aaa48c626374e82f5d30949f3722d1e131f10b549c1832f9a
6
+ metadata.gz: 6c9213252680c8c44fbeb0f3564c0cffbbc8088d676294fde652d94e51b99e2f9c9e4282c138a0f7d85160d205bec3fc8a0b96e12a1de4b83979a8e4e6dcf2fd
7
+ data.tar.gz: 83155d65446067ee1848ef52ba53d1862f2be84d751cc96c8f7bf1253c311b686b2f7a5616811bff1035f3c1ceb6a36bc94fea07ce3be67d052d53524e4bb32d
@@ -1,5 +1,5 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.4.1
5
- before_install: gem install bundler -v 1.12.5
4
+ - 2.5.1
5
+ before_install: gem install bundler -v 1.16.3
data/Gemfile CHANGED
@@ -1,4 +1,9 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ git_source(:github) do |repo_name|
4
+ repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
5
+ "https://github.com/#{repo_name}.git"
6
+ end
7
+
3
8
  # Specify your gem's dependencies in agx.gemspec
4
9
  gemspec
@@ -1,4 +1,4 @@
1
- Copyright (c) 2018 Bryce Johnston
1
+ Copyright (c) 2020 Bryce Johnston
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
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 SST Software's [agX Platform APIs](http://www.agxplatform.com/agx-apis/).
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/beaorn/agx-ruby.
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 [SST Software](http://www.sstsoftware.com/).
167
+ [agX](http://www.agxplatform.com/) is a registered trademark of [Proagrica](http://www.proagrica.com).
@@ -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@agdeveloper.com"]
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 SST Software's agX Platform APIs.}
14
- spec.homepage = "https://github.com/AgDevelopers/agx-ruby"
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.12"
26
- spec.add_development_dependency "rake", "~> 10.0"
27
- spec.add_development_dependency "rspec", "~> 3.0"
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
@@ -117,7 +117,10 @@ module Agx
117
117
  @client_id,
118
118
  @client_secret,
119
119
  site: @site,
120
- token_url: @token_url
120
+ token_url: @token_url,
121
+ connection_opts: {
122
+ request: { timeout: 300 }
123
+ }
121
124
  )
122
125
  end
123
126
 
@@ -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.body == "The specified transaction is invalid or expired."
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
  )
@@ -1,3 +1,3 @@
1
1
  module Agx
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.9"
3
3
  end
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
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: 2018-07-10 00:00:00.000000000 Z
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.12'
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.12'
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: '10.0'
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: '10.0'
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.0'
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.0'
83
- description: Ruby client for accessing SST Software's agX Platform APIs.
82
+ version: '3.9'
83
+ description: Ruby client for accessing Proagrica's agX Platform APIs.
84
84
  email:
85
- - bryce@agdeveloper.com
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/AgDevelopers/agx-ruby
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
- rubyforge_project:
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.