agx 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 12a614baa601cb06ea43c79debbe22c3796dfe86
4
- data.tar.gz: 8e9c959807c63150179794206fa24fc81cbb276b
3
+ metadata.gz: 8a4ba024349d1363567e12db526a7e5e5e7a9f83
4
+ data.tar.gz: d726b4f2113f03e386539966b826501b1076f6de
5
5
  SHA512:
6
- metadata.gz: ee30307fc2cb28199560bfa331f984ec3513142fe048422f3941b653a4f470464e0e185c4a4e5cd48717ce0603c5f334f780b9d46c1b48cf58788ffa5fc97aae
7
- data.tar.gz: 24e24fbfa71a88b00b264a4b99d0a26161d481ccfce929ea247da8a5e6476870eb5fc8f8aade2e9670347432944cdc03276c68d606b1b46e1aede10b0ce436a7
6
+ metadata.gz: f06f1695a3a6ced08fd6eb70e138da506e3c9ac9d9269f8428cf5cf7f6e9c9c24e5f6d3c3fec69a346677fc769720a8a9af7a2b10ffac6201c9e3508bac896cc
7
+ data.tar.gz: baa7b416ed84ef42560f950c518228673a421b5f568ac0155d563a497f5f1e4b8907a18f9c9f0ab109eb958f749277edc9871843daf3885afa175a7a3cd4eeb9
data/Gemfile CHANGED
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Required for allowing Client Credentials w/ Bearer auth instead of Basic
4
4
  # See: https://github.com/intridea/oauth2/pull/252
5
- gem 'oauth2', github: 'CropQuest/oauth2', branch: 'client_credentials_header'
5
+ gem 'oauth2', github: 'brycejohnston/oauth2', branch: 'client_credentials_header'
6
6
 
7
7
  # Specify your gem's dependencies in agx.gemspec
8
8
  gemspec
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2016 Crop Quest, Inc.
1
+ Copyright (c) 2016 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
@@ -31,9 +31,8 @@ Setup agX Content Client (OAuth 2 Client Credentials Flow)
31
31
  @agx_content_client = Agx::Content::Client.new(
32
32
  client_id: "your_client_id",
33
33
  client_secret: "your_client_secret",
34
- site: "content-api-endpoint-url", # optional
35
- token_url: "auth-token-endpoint-url", # optional
36
34
  version: "v1" # optional
35
+ prod: true # optional, false for QA
37
36
  )
38
37
  ```
39
38
 
@@ -61,16 +60,13 @@ expiration timestamp.***
61
60
  @agx_sync_client = Agx::Sync::Client.new(
62
61
  client_id: "your_client_id",
63
62
  client_secret: "your_client_secret",
64
- site: "sync-api-endpoint-url", # optional
65
- host: "sync-api-endpoint-without-protocol", # optional
66
- authorize_url: "authorize-endpoint-url", # optional
67
- token_url: "auth-token-endpoint-url", # optional
68
63
  version: "v3", # optional
69
64
  sync_id: "agx_user_sync_id",
70
65
  access_token: "agx_user_agx_token",
71
66
  refresh_token: "agx_user_refresh_token",
72
67
  token_expires_at: "access_token_expiration_timestamp",
73
- transaction_id: "agx_user_previous_transaction_id" # optional
68
+ transaction_id: "agx_user_previous_transaction_id" # optional,
69
+ prod: true # optional, false for QA
74
70
  )
75
71
  ```
76
72
 
@@ -107,11 +103,11 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
107
103
 
108
104
  ## Contributing
109
105
 
110
- Bug reports and pull requests are welcome on GitHub at https://github.com/CropQuest/agx-ruby.
106
+ Bug reports and pull requests are welcome on GitHub at https://github.com/brycejohnston/agx-ruby.
111
107
 
112
108
 
113
- ## Copyright
109
+ ## License
114
110
 
115
- Copyright (c) 2016 [Crop Quest, Inc.](http://www.cropquest.com) See LICENSE.txt for details.
111
+ The gem is available as open source under the terms of the MIT License (see [LICENSE.txt](https://github.com/brycejohnston/agx-ruby/blob/master/LICENSE.txt))
116
112
 
117
113
  [agX](http://www.agxplatform.com/) is a registered trademark of [SST Software](http://www.sstsoftware.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 = ["bjohnston@cropquest.com"]
10
+ spec.email = ["johnstonbrc@gmail.com"]
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/CropQuest/agx-ruby"
14
+ spec.homepage = "https://github.com/brycejohnston/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)/}) }
@@ -3,11 +3,12 @@ module Agx
3
3
  class Client
4
4
  attr_accessor :client_id, :client_secret, :site, :token_url, :version
5
5
 
6
- def initialize(client_id: nil, client_secret: nil, site: nil, token_url: nil, version: nil)
6
+ def initialize(client_id: nil, client_secret: nil, version: nil, prod: true)
7
+ domain = (prod ? "agxplatform.com" : "qaagxplatform.com")
7
8
  @client_id = client_id || ENV['AGX_CONTENT_CLIENT_ID']
8
9
  @client_secret = client_secret || ENV['AGX_CONTENT_CLIENT_SECRET']
9
- @site = site || "https://refdata.agxplatform.com"
10
- @token_url = token_url || "https://auth.agxplatform.com/Account/Token"
10
+ @site = "https://refdata.#{domain}"
11
+ @token_url = "https://auth.#{domain}/Account/Token"
11
12
  @version = version || "v1"
12
13
  @client = set_client
13
14
  @token = {
@@ -5,16 +5,16 @@ module Agx
5
5
  :token_url, :version, :sync_id, :access_token, :refresh_token, :token_expires_at,
6
6
  :transaction_id
7
7
 
8
- def initialize(client_id: nil, client_secret: nil, site: nil, host: nil,
9
- authorize_url: nil, token_url: nil, version: nil, sync_id: nil,
10
- access_token: nil, refresh_token: nil, token_expires_at: nil,
11
- transaction_id: nil)
8
+ def initialize(client_id: nil, client_secret: nil, version: nil,
9
+ sync_id: nil, access_token: nil, refresh_token: nil,
10
+ token_expires_at: nil, transaction_id: nil, prod: true)
11
+ domain = (prod ? "agxplatform.com" : "qaagxplatform.com")
12
12
  @client_id = client_id || ENV['AGX_SYNC_CLIENT_ID']
13
13
  @client_secret = client_secret || ENV['AGX_SYNC_CLIENT_SECRET']
14
- @site = site || "https://sync.agxplatform.com"
15
- @host = host || "sync.agxplatform.com"
16
- @authorize_url = authorize_url || "https://auth.agxplatform.com/Account/Authorize"
17
- @token_url = token_url || "https://auth.agxplatform.com/Account/Token"
14
+ @site = "https://sync.#{domain}"
15
+ @host = host || "sync.#{domain}"
16
+ @authorize_url = "https://auth.#{domain}/Account/Authorize"
17
+ @token_url = "https://auth.#{domain}/Account/Token"
18
18
  @version = version || "v3"
19
19
  @sync_id = sync_id
20
20
  @api_url = "#{@site}/api/#{@version}/Account/#{@sync_id}/"
@@ -76,8 +76,13 @@ module Agx
76
76
  "#{@api_url}Transaction/#{@transaction_id}",
77
77
  :headers => @headers
78
78
  )
79
+ return true
79
80
  rescue => e
80
- handle_error(e)
81
+ if e.response && e.response.body == "The specified transaction is invalid or expired."
82
+ return true
83
+ else
84
+ handle_error(e)
85
+ end
81
86
  end
82
87
  end
83
88
 
data/lib/agx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Agx
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
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.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryce Johnston
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-13 00:00:00.000000000 Z
11
+ date: 2016-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj
@@ -68,7 +68,7 @@ dependencies:
68
68
  version: '3.0'
69
69
  description: Ruby client for accessing SST Software's agX Platform APIs.
70
70
  email:
71
- - bjohnston@cropquest.com
71
+ - johnstonbrc@gmail.com
72
72
  executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
@@ -90,7 +90,7 @@ files:
90
90
  - lib/agx/sync.rb
91
91
  - lib/agx/sync/client.rb
92
92
  - lib/agx/version.rb
93
- homepage: https://github.com/CropQuest/agx-ruby
93
+ homepage: https://github.com/brycejohnston/agx-ruby
94
94
  licenses:
95
95
  - MIT
96
96
  metadata: {}
@@ -115,4 +115,3 @@ signing_key:
115
115
  specification_version: 4
116
116
  summary: Ruby client for accessing agX Platform APIs.
117
117
  test_files: []
118
- has_rdoc: