rtx-api 0.3.1 → 0.4.3

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: ef858f06474a8ee43054c1bac8a2f1bf0160e85a
4
- data.tar.gz: ff3bb4d926d1c022e1c58ce68dea4db927b3d492
3
+ metadata.gz: e0b63f758c0c2bca1e1d6746d9b046c7a8d39bdc
4
+ data.tar.gz: 57790164cc08bfdd07d12e8a60a01eb0b2daf605
5
5
  SHA512:
6
- metadata.gz: 852439157ffad8652b595a10d2d097b027c7f0665ae111b7865c43417dbaf8601f66b832484ce13570b66e5d35b50a831e53e5924df5003c0b1a542f3a3f050d
7
- data.tar.gz: 26f571423e1c8f1e02500eee43b6afb2bf745516a20ed9496ff270e7633175e5db7d843c5ab333a6cb4020d9234c1d0217e827f67095ecef95eb1e9b22ec78f3
6
+ metadata.gz: 8bdbccc1be110d39ac17238786d4c6612a2d21a678a3122677cf206caa329e2783029cc4b50d95ded4fe06555bb01951b68ba713824981eea2c6a5fe2f7a71ac
7
+ data.tar.gz: 83cb2bf41ed17f9d8afa9c072be126d4b23221c0b689081e058a3b9d0e435cdaebab82d47f795bd27e85542d574dbad8f994c1179ac75910730770d9f5231f05
@@ -1,4 +1,7 @@
1
1
  language: ruby
2
+ addons:
3
+ code_climate:
4
+ repo_token: 0a659ed837c1f84266607a52710053cb96ff09edf9589cc16c7820cb21289987
2
5
  gemfile:
3
6
  - Gemfile
4
7
  rvm:
@@ -9,4 +12,10 @@ script:
9
12
  - bundle exec rake test
10
13
  env:
11
14
  global:
12
- secure: ZKA3gxZ13JbmstnDo0FOVUxnWvU2uY4tI/zjob4Lyu9sYrnI7ge7LSf8RNbpwmLdzHT45OgD5LrV4dQp6Z2lmDJygQBQXkZ+tnyPrxDvEWKhjH70ve6EJ5qzQxrAiIX9iP4iWJ7t3HPI3yEwCyaVjlFKF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XiLqsvRqDfCwlBhmuryPCmVwfBQcV7zzcuEV32xr0/ogGInR/ccUZXXnG6RCSBgXE+1Pp3xQS+iR39ND3Su7IViVsmMBhcMxdGPGTlVufBFhZtHS+qhze5XbS39jRp05cvYzjao1I6Mvt+C+KAxb4v6fzUSNAdNgVWLnUlmhkcE8=
17
+ branches:
18
+ only:
19
+ - master
20
+ after_script:
21
+ - bundle exec codeclimate-test-reporter
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # rtx-api-client-ruby [![Build Status](https://travis-ci.org/reviewtrackers/rtx-api-client-ruby.svg?branch=master)](https://travis-ci.org/reviewtrackers/rtx-api-client-ruby)
1
+ # rtx-api-client-ruby [![Build Status](https://travis-ci.com/reviewtrackers/rtx-api-client-ruby.svg?token=LBGpi53KtKBbpp2CUDq4&branch=master)](https://travis-ci.com/reviewtrackers/rtx-api-client-ruby)
2
2
 
3
3
  Ruby Client for the RTX API.
4
4
 
@@ -21,10 +21,22 @@ module RTX
21
21
  if request.code != 201
22
22
  raise API::Errors::AuthenticationError.new("Authentication Login Error: #{response}")
23
23
  end
24
- @token = response[:token]
25
- @expires = response[:expires_at]
26
- @account_id = response[:account_id]
27
- @profile_id = response[:profile_id]
24
+ set_attributes(response[:token], response[:expires_at], response[:account_id], response[:profile_id])
25
+ end
26
+
27
+ def authenticate_as(email, &block)
28
+ authenticate if !authenticated?
29
+ response = collection(:users, email: email)
30
+ if response[:_total] == 1
31
+ user = response[:_embedded][:users][0]
32
+ auth_response = post(:auth_tokens, account_id: user[:account_id], user_id: user[:id])
33
+ client = self.class.new(auth_response[:email], auth_response[:token])
34
+ client.set_attributes(auth_response[:token], auth_response[:expires_at], auth_response[:account_id], auth_response[:profile_id])
35
+ block.call(client)
36
+ else
37
+ raise API::Errors::ClientError.new("User not found with associated email address: #{email}")
38
+ end
39
+ true
28
40
  end
29
41
 
30
42
  def expired?
@@ -105,12 +117,19 @@ module RTX
105
117
  path
106
118
  end
107
119
 
120
+ def set_attributes(token, expires, account_id, profile_id)
121
+ @token = token
122
+ @expires = expires
123
+ @account_id = account_id
124
+ @profile_id = profile_id
125
+ end
126
+
108
127
  protected
109
128
 
110
129
  def default_headers
111
130
  {
112
- 'Content-Type' => "application/vnd.rtx.v2.hal+json",
113
- 'Accept' => "application/vnd.rtx.v2.hal+json",
131
+ 'Content-Type' => "application/hal+json",
132
+ 'Accept' => "application/hal+json",
114
133
  'User-Agent' => "rtx-api-client-ruby/#{API::VERSION}"
115
134
  }.freeze
116
135
  end
@@ -1,12 +1,17 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RTX
2
4
  module API
3
5
  class Resources
6
+ # rubocop:disable Metrics/MethodLength
4
7
  def self.allowed_resources
5
8
  {
6
9
  accounts: 'accounts',
10
+ account_settings: 'account_settings',
7
11
  alerts: 'alerts',
8
12
  alert_frequencies: 'alert_frequencies',
9
13
  alert_types: 'alert_types',
14
+ auth_tokens: 'auth/tokens',
10
15
  campaigns: 'campaigns',
11
16
  contacts: 'contacts',
12
17
  countries: 'countries',
@@ -17,11 +22,14 @@ module RTX
17
22
  layouts: 'layouts',
18
23
  locations: 'locations',
19
24
  notes: 'notes',
25
+ passwords: 'passwords',
20
26
  permissions: 'permissions',
27
+ plan_changes: 'plan_changes',
21
28
  profiles: 'profiles',
22
29
  requests: 'requests',
23
30
  request_pages: 'request_pages',
24
31
  request_types: 'request_types',
32
+ responses: 'responses',
25
33
  reviews: 'reviews',
26
34
  review_status_labels: 'review_status_labels',
27
35
  single_sign_ons: 'single_sign_ons',
@@ -35,6 +43,7 @@ module RTX
35
43
  whitelabels: 'whitelabels'
36
44
  }.freeze
37
45
  end
46
+ # rubocop:enable Metrics/MethodLength
38
47
  end
39
48
  end
40
49
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RTX
2
4
  module API
3
- VERSION = "0.3.1"
5
+ VERSION = '0.4.3'
4
6
  end
5
7
  end
@@ -0,0 +1,18 @@
1
+ # Title
2
+ [Link to passing hydra (unless you're triggering through this PR)]
3
+
4
+ [Description]
5
+
6
+ #### Do you have tests for your changes?
7
+ - [ ] Yes
8
+ - [ ] No (if no, why not?)
9
+
10
+ # Proof
11
+
12
+ ## Before
13
+ [Attach prior behavior if applicable]
14
+
15
+ ## After
16
+ [Attach new behavior proof]
17
+
18
+ - [ ] Zach's Checkbox (aka: I've manually regression tested any large changes)
@@ -6,12 +6,11 @@ require 'rtx/api/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "rtx-api"
8
8
  spec.version = RTX::API::VERSION
9
- spec.authors = ["ReviewTrackers Engineering"]
10
- spec.email = ["engineering@reviewtrackers.com"]
9
+ spec.authors = ["Review Trackers Engineering"]
10
+ spec.email = ["nate@reviewtrackers.com"]
11
11
 
12
12
  spec.summary = %q{Ruby Client for the Review Trackers RTX API.}
13
13
  spec.description = %q{A Ruby Client for the RTX API provided by Review Trackers.}
14
- spec.homepage = "https://github.com/reviewtrackers/rtx-api-client-ruby"
15
14
  spec.license = "MIT"
16
15
 
17
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
@@ -24,4 +23,6 @@ Gem::Specification.new do |spec|
24
23
  # add dependencies here. development dependencies should go into the Gemfile
25
24
  spec.add_dependency 'httparty'
26
25
  spec.add_dependency 'oj'
26
+ spec.add_development_dependency 'codeclimate-test-reporter', '~> 1.0.0'
27
+ spec.add_development_dependency 'simplecov'
27
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rtx-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
- - ReviewTrackers Engineering
7
+ - Review Trackers Engineering
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-26 00:00:00.000000000 Z
11
+ date: 2020-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -38,9 +38,37 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: codeclimate-test-reporter
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.0.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.0.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: simplecov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
41
69
  description: A Ruby Client for the RTX API provided by Review Trackers.
42
70
  email:
43
- - engineering@reviewtrackers.com
71
+ - nate@reviewtrackers.com
44
72
  executables: []
45
73
  extensions: []
46
74
  extra_rdoc_files: []
@@ -61,8 +89,9 @@ files:
61
89
  - lib/rtx/api/errors/request_error.rb
62
90
  - lib/rtx/api/resources.rb
63
91
  - lib/rtx/api/version.rb
92
+ - pull_request_template.md
64
93
  - rtx-api.gemspec
65
- homepage: https://github.com/reviewtrackers/rtx-api-client-ruby
94
+ homepage:
66
95
  licenses:
67
96
  - MIT
68
97
  metadata: {}
@@ -82,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
111
  version: '0'
83
112
  requirements: []
84
113
  rubyforge_project:
85
- rubygems_version: 2.5.1
114
+ rubygems_version: 2.6.8
86
115
  signing_key:
87
116
  specification_version: 4
88
117
  summary: Ruby Client for the Review Trackers RTX API.