agx 0.2.2 → 0.2.3

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
- SHA1:
3
- metadata.gz: 358ca46754287a4f484a20f453f35462eb7596ed
4
- data.tar.gz: fbb5693193f3bc99cd8119b991fe8373bf15f7fb
2
+ SHA256:
3
+ metadata.gz: d101f036ad3ca77c3210c91b0f15d8a38e9e8acaec7d2cf20f4b51089904a89e
4
+ data.tar.gz: b62ff40f0118fe22d5eb0cf3f1e73435cd280cf8008cdc47922ce5e1f7664bde
5
5
  SHA512:
6
- metadata.gz: 2070b7b7e2ea87526d16e490bf92eb7c257fe5df80fcdd8c298c302bb28128642379f7455e217aceae9a3c0475d83bfb5d4db8a0dad29399bd836b98fbb93d03
7
- data.tar.gz: 2c5d0292b4efc172cbf850ce4d49874a12bf186983f5dfadf9af7549a154080a541de4639b01173b3a4a9998aae331665944724dbca49673a8be1d3a8fccd23a
6
+ metadata.gz: 2a5a30e877163b35a2175d904816ea184f7fea9e1f2ec32d031f5a73e34a4aa7ca4c2ee513fe90086894a1e734dd12c019c45575bfe1e4131e1248f3c2d10b21
7
+ data.tar.gz: 7d9d43c10d4bedfbd34830c9bb801eecffebfdac0514f82032b11d61e8817b55f314b0662fe2ffed8b5d73ac2609fdf2e3e524e700d6bc66aa2d2dbcec8876e7
@@ -1,4 +1,4 @@
1
- Copyright (c) 2017 Bryce Johnston
1
+ Copyright (c) 2018 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
@@ -74,13 +74,20 @@ Initiate a sync transaction, make Sync API requests, and end transaction
74
74
 
75
75
  ***Currently only get requests are supported***
76
76
  ```ruby
77
- # @agx_sync_client.get("Resource", start_time)
77
+ # To make calls without starting a transaction for resources that don't
78
+ # require it, use the get_nt method
79
+ # @agx_sync_client.get_nt("Resource", start_time)
78
80
  # => 'parsed_json_response_body'
81
+ growers = @agx_sync_client.get_nt("Grower")
79
82
 
80
- # You should persist transaction ID per user until transaction is successfully
81
- # ended by call to end_transaction
83
+ # To make calls that require transactions (sync locking), call start_transaction
84
+ # and then use the get method to call for the resource. You should persist
85
+ # transaction ID per user until transaction is successfully ended by call
86
+ # to end_transaction
82
87
  transaction_id = @agx_sync_client.start_transaction
83
88
 
89
+ # @agx_sync_client.get("Resource", start_time)
90
+ # => 'parsed_json_response_body'
84
91
  growers = @agx_sync_client.get("Grower")
85
92
 
86
93
  # Get all farms accessible for a grower
@@ -134,11 +141,11 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
134
141
 
135
142
  ## Contributing
136
143
 
137
- Bug reports and pull requests are welcome on GitHub at https://github.com/beaorn/agx-ruby.
144
+ Bug reports and pull requests are welcome on GitHub at https://github.com/AgDevelopers/agx-ruby.
138
145
 
139
146
 
140
147
  ## License
141
148
 
142
- 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))
149
+ The gem is available as open source under the terms of the MIT License (see [LICENSE.txt](https://github.com/AgDevelopers/agx-ruby/blob/master/LICENSE.txt))
143
150
 
144
151
  [agX](http://www.agxplatform.com/) is a registered trademark of [SST Software](http://www.sstsoftware.com/).
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.summary = %q{Ruby client for accessing agX Platform APIs.}
13
13
  spec.description = %q{Ruby client for accessing SST Software's agX Platform APIs.}
14
- spec.homepage = "https://github.com/beaorn/agx-ruby"
14
+ spec.homepage = "https://github.com/AgDevelopers/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)/}) }
@@ -50,6 +50,22 @@ module Agx
50
50
  end
51
51
  end
52
52
 
53
+ def get_nt(resource, start_time = nil)
54
+ validate_nt_sync_attributes
55
+
56
+ url = "#{@api_url}#{resource}"
57
+ if !start_time.nil?
58
+ url = "#{@api_url}#{resource}?startTime=#{start_time}"
59
+ end
60
+
61
+ begin
62
+ response = current_token.get(url, :headers => @headers)
63
+ parse_response(response.body)
64
+ rescue => e
65
+ handle_error(e)
66
+ end
67
+ end
68
+
53
69
  def start_transaction
54
70
  validate_credentials
55
71
 
@@ -105,6 +121,15 @@ module Agx
105
121
  end
106
122
  end
107
123
 
124
+ def validate_nt_sync_attributes
125
+ validate_credentials
126
+
127
+ unless @sync_id
128
+ error = Agx::Error.new("agX Sync Transaction Attributes Not Set", {title: "AGX_SYNC_ATTRIBUTES_ERROR"})
129
+ raise error
130
+ end
131
+ end
132
+
108
133
  def parse_response(response_body)
109
134
  parsed_response = nil
110
135
 
@@ -1,3 +1,3 @@
1
1
  module Agx
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
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.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryce Johnston
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-30 00:00:00.000000000 Z
11
+ date: 2018-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj
@@ -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/beaorn/agx-ruby
109
+ homepage: https://github.com/AgDevelopers/agx-ruby
110
110
  licenses:
111
111
  - MIT
112
112
  metadata: {}
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
126
  version: '0'
127
127
  requirements: []
128
128
  rubyforge_project:
129
- rubygems_version: 2.6.13
129
+ rubygems_version: 2.7.3
130
130
  signing_key:
131
131
  specification_version: 4
132
132
  summary: Ruby client for accessing agX Platform APIs.