core-client 0.1.0 → 0.2.4

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: 7dda13fa264b10472b7db87768d3c40d9302a50998026d0943e16797d619132a
4
- data.tar.gz: 637e0c307bd02fea6f9faba4980dd4237f7b4e8830a16320ecdc0e36e3c69a71
3
+ metadata.gz: 854b90778a899450c1bbef5fce155fc1db4f6f004f4b4ea11d4699eb02c85f24
4
+ data.tar.gz: 4e15f2ddbb25f35d650a07f00decb9d6c3a633dd242f35ca0f58be28b68ee4bf
5
5
  SHA512:
6
- metadata.gz: 7aec65e47b12de803433a1506c31a24d2c69c8b146e3ff1cff36b9cba592487e73e3ebc27fdfc03b6a707bbe2cc75a36c74e7c10f98c7d38d78ecda13e4f558b
7
- data.tar.gz: 3f4b316b009de32b75f133db3505cef779301dc92d19b3076363001aaa074b2d4de761b4e2a592182e526f612b2647350b11fe1fbd083f15bf6127d45298ed4b
6
+ metadata.gz: a2b3c31c71a22e5c59676aabae2a5f0a2a33bb7429a5d7f20ac0f16eb4b9ab59d03079994029d580879555cc49c55985a01500854cbe7ee35ef1e914e61cc0eb
7
+ data.tar.gz: 630e54d656a83070d819d3499907cd7859c718e50fdc19fdf7cd0cf3b0bb5371dd05280fff988d539e36d9de9caf2a1b048d9cb2dff748959f0646299f4794a2
data/.gitignore CHANGED
@@ -6,7 +6,8 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ *.sw[a-zA-Z]
9
10
 
10
11
  # rspec failure tracking
11
12
  .rspec_status
12
- .env
13
+ .env
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.1
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- core-client (0.1.0)
5
- activesupport (= 6.0.2.1)
4
+ core-client (0.2.4)
5
+ activesupport (~> 6.0.3, >= 6.0.3.1)
6
6
  dotenv (~> 2.7)
7
7
  json_api_client (~> 1.16)
8
8
  rack (~> 2.2)
@@ -11,57 +11,59 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- activemodel (6.0.2.1)
15
- activesupport (= 6.0.2.1)
16
- activesupport (6.0.2.1)
14
+ activemodel (6.0.3.5)
15
+ activesupport (= 6.0.3.5)
16
+ activesupport (6.0.3.5)
17
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
18
  i18n (>= 0.7, < 2)
19
19
  minitest (~> 5.1)
20
20
  tzinfo (~> 1.1)
21
- zeitwerk (~> 2.2)
21
+ zeitwerk (~> 2.2, >= 2.2.2)
22
22
  addressable (2.7.0)
23
23
  public_suffix (>= 2.0.2, < 5.0)
24
- ast (2.4.0)
25
- concurrent-ruby (1.1.6)
24
+ ast (2.4.2)
25
+ concurrent-ruby (1.1.8)
26
26
  diff-lcs (1.3)
27
27
  domain_name (0.5.20190701)
28
28
  unf (>= 0.0.5, < 1.0.0)
29
- dotenv (2.7.5)
30
- faraday (0.17.3)
29
+ dotenv (2.7.6)
30
+ faraday (1.1.0)
31
31
  multipart-post (>= 1.2, < 3)
32
- faraday_middleware (0.14.0)
33
- faraday (>= 0.7.4, < 1.0)
32
+ ruby2_keywords
33
+ faraday_middleware (1.0.0)
34
+ faraday (~> 1.0)
34
35
  http-accept (1.7.0)
35
36
  http-cookie (1.0.3)
36
37
  domain_name (~> 0.5)
37
- i18n (1.8.2)
38
+ i18n (1.8.9)
38
39
  concurrent-ruby (~> 1.0)
39
- jaro_winkler (1.5.4)
40
- json_api_client (1.16.1)
40
+ json_api_client (1.18.0)
41
41
  activemodel (>= 3.2.0)
42
42
  activesupport (>= 3.2.0)
43
43
  addressable (~> 2.2)
44
- faraday (~> 0.15, >= 0.15.2)
45
- faraday_middleware (~> 0.9)
44
+ faraday (>= 0.15.2, < 1.2.0)
45
+ faraday_middleware (>= 0.9.0, < 1.2.0)
46
46
  rack (>= 0.2)
47
47
  mime-types (3.3.1)
48
48
  mime-types-data (~> 3.2015)
49
- mime-types-data (3.2019.1009)
50
- minitest (5.14.0)
49
+ mime-types-data (3.2021.0212)
50
+ minitest (5.14.3)
51
51
  multipart-post (2.1.1)
52
52
  netrc (0.11.0)
53
- parallel (1.19.1)
54
- parser (2.7.0.2)
55
- ast (~> 2.4.0)
56
- public_suffix (4.0.3)
57
- rack (2.2.2)
53
+ parallel (1.20.1)
54
+ parser (3.0.0.0)
55
+ ast (~> 2.4.1)
56
+ public_suffix (4.0.6)
57
+ rack (2.2.3)
58
58
  rainbow (3.0.0)
59
- rake (10.5.0)
59
+ rake (13.0.1)
60
+ regexp_parser (2.0.3)
60
61
  rest-client (2.1.0)
61
62
  http-accept (>= 1.7.0, < 2.0)
62
63
  http-cookie (>= 1.0.2, < 2.0)
63
64
  mime-types (>= 1.16, < 4.0)
64
65
  netrc (~> 0.8)
66
+ rexml (3.2.4)
65
67
  rspec (3.9.0)
66
68
  rspec-core (~> 3.9.0)
67
69
  rspec-expectations (~> 3.9.0)
@@ -75,28 +77,34 @@ GEM
75
77
  diff-lcs (>= 1.2.0, < 2.0)
76
78
  rspec-support (~> 3.9.0)
77
79
  rspec-support (3.9.2)
78
- rubocop (0.79.0)
79
- jaro_winkler (~> 1.5.1)
80
+ rubocop (0.92.0)
80
81
  parallel (~> 1.10)
81
- parser (>= 2.7.0.1)
82
+ parser (>= 2.7.1.5)
82
83
  rainbow (>= 2.2.2, < 4.0)
84
+ regexp_parser (>= 1.7)
85
+ rexml
86
+ rubocop-ast (>= 0.5.0)
83
87
  ruby-progressbar (~> 1.7)
84
- unicode-display_width (>= 1.4.0, < 1.7)
85
- rubocop-able (0.2.0)
86
- rubocop (~> 0.76)
87
- rubocop-rails (~> 2.3.0)
88
- rubocop-rails (2.3.2)
88
+ unicode-display_width (>= 1.4.0, < 2.0)
89
+ rubocop-able (0.2.2)
90
+ rubocop (= 0.92)
91
+ rubocop-rails (~> 2.8.1)
92
+ rubocop-ast (1.4.1)
93
+ parser (>= 2.7.1.5)
94
+ rubocop-rails (2.8.1)
95
+ activesupport (>= 4.2.0)
89
96
  rack (>= 1.1)
90
- rubocop (>= 0.72.0)
91
- ruby-progressbar (1.10.1)
97
+ rubocop (>= 0.87.0)
98
+ ruby-progressbar (1.11.0)
99
+ ruby2_keywords (0.0.4)
92
100
  thread_safe (0.3.6)
93
- tzinfo (1.2.6)
101
+ tzinfo (1.2.9)
94
102
  thread_safe (~> 0.1)
95
103
  unf (0.1.4)
96
104
  unf_ext
97
- unf_ext (0.0.7.6)
98
- unicode-display_width (1.6.1)
99
- zeitwerk (2.2.2)
105
+ unf_ext (0.0.7.7)
106
+ unicode-display_width (1.7.0)
107
+ zeitwerk (2.4.2)
100
108
 
101
109
  PLATFORMS
102
110
  ruby
@@ -104,10 +112,9 @@ PLATFORMS
104
112
  DEPENDENCIES
105
113
  bundler (~> 2.0)
106
114
  core-client!
107
- rake (~> 10.0)
115
+ rake (~> 13.0)
108
116
  rspec (~> 3.0)
109
- rubocop (~> 0.76)
110
- rubocop-able (~> 0.2.0)
117
+ rubocop-able (~> 0.2.2)
111
118
 
112
119
  BUNDLED WITH
113
- 2.0.2
120
+ 2.1.4
data/README.md CHANGED
@@ -33,6 +33,8 @@ Or install it yourself as:
33
33
 
34
34
  To use the Core API you need a token, which can be request via Slack in the `#core` channel. This token needs to be set in an ENV variable called `CORE_API_TOKEN`. `Core::Client` will automatically use that ENV variable to sign all the requests sent through the gem.
35
35
 
36
+ To use a different Core environment, you need to set the `CORE_API_URL` variable. `Core::Client` will automatically sent all the requests to the value in that ENV variable.
37
+
36
38
  Both versions (v1 and v2) share similar methods to access the resources:
37
39
  - `.all` returns an array of resources
38
40
  - `.first` returns the first element of `.all`
data/Rakefile CHANGED
@@ -3,4 +3,4 @@ require "rspec/core/rake_task"
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
data/core-client.gemspec CHANGED
@@ -3,15 +3,15 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require "core/client/version"
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = "core-client"
7
- spec.version = Core::Client::VERSION
8
- spec.authors = ["Able"]
9
- spec.email = ["engineering@able.co"]
6
+ spec.name = "core-client"
7
+ spec.version = Core::Client::VERSION
8
+ spec.authors = ["Able"]
9
+ spec.email = ["engineering@able.co"]
10
10
 
11
- spec.summary = %q{Core API client for Ruby.}
12
- spec.description = %q{Core API client for Ruby. Supports v1 and v2.}
13
- spec.homepage = "https://core.able.co"
14
- spec.license = "MIT"
11
+ spec.summary = %q{Core API client for Ruby.}
12
+ spec.description = %q{Core API client for Ruby. Supports v1 and v2.}
13
+ spec.homepage = "https://core.able.co"
14
+ spec.license = "MIT"
15
15
 
16
16
  spec.metadata["allowed_push_host"] = "https://rubygems.org"
17
17
 
@@ -21,21 +21,20 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  # Specify which files should be added to the gem when it is released.
23
23
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
24
+ spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
25
25
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
26
  end
27
- spec.bindir = "exe"
28
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.bindir = "exe"
28
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
29
  spec.require_paths = ["lib"]
30
30
 
31
31
  spec.add_development_dependency "bundler", "~> 2.0"
32
- spec.add_development_dependency "rake", "~> 10.0"
32
+ spec.add_development_dependency "rake", "~> 13.0"
33
33
  spec.add_development_dependency "rspec", "~> 3.0"
34
- spec.add_development_dependency "rubocop", "~> 0.76"
35
- spec.add_development_dependency "rubocop-able", "~> 0.2.0"
34
+ spec.add_development_dependency "rubocop-able", "~> 0.2.2"
36
35
  spec.add_dependency "dotenv", "~> 2.7"
37
36
  spec.add_dependency "json_api_client", "~> 1.16"
38
37
  spec.add_dependency "rest-client", "~> 2.1"
39
- spec.add_dependency "activesupport", "6.0.2.1"
38
+ spec.add_dependency "activesupport", "~> 6.0.3", ">= 6.0.3.1"
40
39
  spec.add_dependency "rack", "~> 2.2"
41
40
  end
@@ -10,7 +10,7 @@ module Core
10
10
  class << self
11
11
  def client
12
12
  @client ||= RestClient::Resource.new(
13
- "https://core.able.co/api",
13
+ "#{ENV['CORE_URL'] || 'https://core.able.co'}/api",
14
14
  headers: { "Authorization" => "Bearer #{ENV['CORE_API_TOKEN']}" }
15
15
  )
16
16
  end
@@ -5,7 +5,7 @@ module Core
5
5
  module Client
6
6
  module V2
7
7
  class Base < JsonApiClient::Resource
8
- self.site = "https://core.able.co/api/v2"
8
+ self.site = "#{ENV['CORE_URL'] || 'https://core.able.co'}/api/v2"
9
9
  self.raise_on_blank_find_param = true
10
10
 
11
11
  class << self
@@ -18,4 +18,4 @@ module Core
18
18
  end
19
19
  end
20
20
 
21
- Core::Client::V2::Base.connection_options[:headers] = { "Authorization" => "Bearer #{ENV['CORE_API_TOKEN']}" }
21
+ Core::Client::V2::Base.connection_options[:headers] = { "Authorization" => "Bearer #{ENV['CORE_API_TOKEN']}" }
@@ -0,0 +1,10 @@
1
+ require_relative "./base"
2
+
3
+ module Core
4
+ module Client
5
+ module V2
6
+ class Cheer < Base
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,13 @@
1
+ require_relative "./base"
2
+
3
+ module Core
4
+ module Client
5
+ module V2
6
+ class CheerMention < Base
7
+ def self.table_name
8
+ "cheer-mentions"
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ require_relative "./base"
2
+
3
+ module Core
4
+ module Client
5
+ module V2
6
+ class FeedbackHighlight < Base
7
+ def self.table_name
8
+ "feedback-highlights"
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ require_relative "./base"
2
+
3
+ module Core
4
+ module Client
5
+ module V2
6
+ class FeedbackMessage < Base
7
+ def self.table_name
8
+ "feedback-messages"
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ require_relative "./base"
2
+
3
+ module Core
4
+ module Client
5
+ module V2
6
+ class FeedbackRequest < Base
7
+ def self.table_name
8
+ "feedback-requests"
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -7,4 +7,4 @@ module Core
7
7
  end
8
8
  end
9
9
  end
10
- end
10
+ end
@@ -10,4 +10,4 @@ module Core
10
10
  end
11
11
  end
12
12
  end
13
- end
13
+ end
@@ -10,4 +10,4 @@ module Core
10
10
  end
11
11
  end
12
12
  end
13
- end
13
+ end
@@ -10,4 +10,4 @@ module Core
10
10
  end
11
11
  end
12
12
  end
13
- end
13
+ end
@@ -7,4 +7,4 @@ module Core
7
7
  end
8
8
  end
9
9
  end
10
- end
10
+ end
@@ -10,4 +10,4 @@ module Core
10
10
  end
11
11
  end
12
12
  end
13
- end
13
+ end
@@ -10,4 +10,4 @@ module Core
10
10
  end
11
11
  end
12
12
  end
13
- end
13
+ end
@@ -7,4 +7,4 @@ module Core
7
7
  end
8
8
  end
9
9
  end
10
- end
10
+ end
@@ -4,7 +4,10 @@ module Core
4
4
  module Client
5
5
  module V2
6
6
  class User < Base
7
+ def self.current
8
+ requestor.custom("current", { request_method: :get }, {}).first
9
+ end
7
10
  end
8
11
  end
9
12
  end
10
- end
13
+ end
@@ -1,5 +1,5 @@
1
1
  module Core
2
2
  module Client
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: core-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Able
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-19 00:00:00.000000000 Z
11
+ date: 2021-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '13.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '13.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,34 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
- - !ruby/object:Gem::Dependency
56
- name: rubocop
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '0.76'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '0.76'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: rubocop-able
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
59
  - - "~>"
74
60
  - !ruby/object:Gem::Version
75
- version: 0.2.0
61
+ version: 0.2.2
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
66
  - - "~>"
81
67
  - !ruby/object:Gem::Version
82
- version: 0.2.0
68
+ version: 0.2.2
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: dotenv
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -126,16 +112,22 @@ dependencies:
126
112
  name: activesupport
127
113
  requirement: !ruby/object:Gem::Requirement
128
114
  requirements:
129
- - - '='
115
+ - - "~>"
130
116
  - !ruby/object:Gem::Version
131
- version: 6.0.2.1
117
+ version: 6.0.3
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: 6.0.3.1
132
121
  type: :runtime
133
122
  prerelease: false
134
123
  version_requirements: !ruby/object:Gem::Requirement
135
124
  requirements:
136
- - - '='
125
+ - - "~>"
126
+ - !ruby/object:Gem::Version
127
+ version: 6.0.3
128
+ - - ">="
137
129
  - !ruby/object:Gem::Version
138
- version: 6.0.2.1
130
+ version: 6.0.3.1
139
131
  - !ruby/object:Gem::Dependency
140
132
  name: rack
141
133
  requirement: !ruby/object:Gem::Requirement
@@ -161,6 +153,7 @@ files:
161
153
  - ".gitignore"
162
154
  - ".rspec"
163
155
  - ".rubocop.yml"
156
+ - ".ruby-version"
164
157
  - ".travis.yml"
165
158
  - CHANGELOG.md
166
159
  - CODE_OF_CONDUCT.md
@@ -186,6 +179,11 @@ files:
186
179
  - lib/core/client/v1/role.rb
187
180
  - lib/core/client/v1/user.rb
188
181
  - lib/core/client/v2/base.rb
182
+ - lib/core/client/v2/cheer.rb
183
+ - lib/core/client/v2/cheer_mention.rb
184
+ - lib/core/client/v2/feedback_highlight.rb
185
+ - lib/core/client/v2/feedback_message.rb
186
+ - lib/core/client/v2/feedback_request.rb
189
187
  - lib/core/client/v2/product.rb
190
188
  - lib/core/client/v2/product_assignment.rb
191
189
  - lib/core/client/v2/product_investment.rb
@@ -219,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
217
  - !ruby/object:Gem::Version
220
218
  version: '0'
221
219
  requirements: []
222
- rubygems_version: 3.1.2
220
+ rubygems_version: 3.2.3
223
221
  signing_key:
224
222
  specification_version: 4
225
223
  summary: Core API client for Ruby.