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 +4 -4
- data/Gemfile +1 -1
- data/LICENSE.txt +1 -1
- data/README.md +6 -10
- data/agx.gemspec +2 -2
- data/lib/agx/content/client.rb +4 -3
- data/lib/agx/sync/client.rb +14 -9
- data/lib/agx/version.rb +1 -1
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a4ba024349d1363567e12db526a7e5e5e7a9f83
|
4
|
+
data.tar.gz: d726b4f2113f03e386539966b826501b1076f6de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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: '
|
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
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/
|
106
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/brycejohnston/agx-ruby.
|
111
107
|
|
112
108
|
|
113
|
-
##
|
109
|
+
## License
|
114
110
|
|
115
|
-
|
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 = ["
|
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/
|
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)/}) }
|
data/lib/agx/content/client.rb
CHANGED
@@ -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,
|
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 =
|
10
|
-
@token_url =
|
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 = {
|
data/lib/agx/sync/client.rb
CHANGED
@@ -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,
|
9
|
-
|
10
|
-
|
11
|
-
|
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 =
|
15
|
-
@host = host || "sync
|
16
|
-
@authorize_url =
|
17
|
-
@token_url =
|
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
|
-
|
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
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.
|
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-
|
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
|
-
-
|
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/
|
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:
|