global_registry 1.7.0 → 1.7.1

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: e93da0073c39cfe7e3eba14f4ab788b9c9597912b86924a96bb897f4ba493d6a
4
- data.tar.gz: 6752d48b7e9f365a4a4ff3d8ae8d65499e44dcb8a2c1cc4a51d008c747439f7e
3
+ metadata.gz: b7445b679ee6053b506c2b6e58d1c5a9fa011a405f82cbccfeef099963036343
4
+ data.tar.gz: 9bc8f08b55bb27ea044cbfca6d6253a4b3f90f66678bf96b9d1aaa97ab2697c5
5
5
  SHA512:
6
- metadata.gz: f6bde8c52979ae1bc24297d0ba517bc55fc3fe2d524c295819516115ac80cfb49cce0c60957fa021d1f4f7a5631d01095d7a4f278b1c397ea87e1e13bdff8412
7
- data.tar.gz: dd6d5a4659bbe3bd1fbf4bd81dd17f46b287534bad72bc07b382c7a5b050f057739f7f746cbd65f196a2493dd9eba0b8860653a01d0d3da7eb4060eea9ca7353
6
+ metadata.gz: 2ce812d1ebb06e74f546c2a692c6538c909bc1d591194dd56fff15cafafc22877631b837aaa242a87f5651355e6ec681b779983eb89c98f610bc1d1fce91bfb4
7
+ data.tar.gz: 4ca00de747f56ef0057b88135e48b74b0def4887a9c4ba170adca458702fb179f3c8d5c5c48415c22598e0f4140305cadba8019bdea2ae7d07f5caa501aa6298
@@ -0,0 +1,29 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [master]
6
+ push:
7
+ branches: [master]
8
+
9
+ jobs:
10
+ lint-and-test:
11
+ runs-on: ubuntu-latest
12
+
13
+ env:
14
+ RAILS_ENV: test
15
+
16
+ steps:
17
+ - name: Check out files
18
+ uses: actions/checkout@v2
19
+
20
+ - name: Set up Ruby
21
+ uses: ruby/setup-ruby@v1
22
+ with:
23
+ bundler-cache: true
24
+
25
+ - name: StandardRB
26
+ run: bundle exec standardrb --format simple
27
+
28
+ - name: RSpec tests
29
+ run: bundle exec rspec --color
data/.gitignore CHANGED
@@ -3,7 +3,6 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
- Gemfile.lock
7
6
  InstalledFiles
8
7
  _yardoc
9
8
  coverage
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.4.1
1
+ 3.0.5
data/Gemfile CHANGED
@@ -1,10 +1,11 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in global_registry.gemspec
4
4
  gemspec
5
5
 
6
6
  group :development do
7
- gem 'rake'
8
- gem 'rspec'
9
- gem 'webmock'
7
+ gem "rake"
8
+ gem "rspec"
9
+ gem "webmock"
10
+ gem "standard"
10
11
  end
data/Gemfile.lock ADDED
@@ -0,0 +1,113 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ global_registry (1.7.1)
5
+ activesupport
6
+ addressable (~> 2.4)
7
+ oj (>= 2.13)
8
+ oj_mimic_json
9
+ rest-client (>= 1.6.7, < 3.0.0)
10
+ retryable-rb (~> 1.1)
11
+
12
+ GEM
13
+ remote: https://rubygems.org/
14
+ specs:
15
+ activesupport (7.0.4.2)
16
+ concurrent-ruby (~> 1.0, >= 1.0.2)
17
+ i18n (>= 1.6, < 2)
18
+ minitest (>= 5.1)
19
+ tzinfo (~> 2.0)
20
+ addressable (2.8.1)
21
+ public_suffix (>= 2.0.2, < 6.0)
22
+ ast (2.4.2)
23
+ concurrent-ruby (1.2.0)
24
+ crack (0.4.5)
25
+ rexml
26
+ diff-lcs (1.5.0)
27
+ domain_name (0.5.20190701)
28
+ unf (>= 0.0.5, < 1.0.0)
29
+ hashdiff (1.0.1)
30
+ http-accept (1.7.0)
31
+ http-cookie (1.0.5)
32
+ domain_name (~> 0.5)
33
+ i18n (1.12.0)
34
+ concurrent-ruby (~> 1.0)
35
+ json (2.6.3)
36
+ language_server-protocol (3.17.0.2)
37
+ mime-types (3.4.1)
38
+ mime-types-data (~> 3.2015)
39
+ mime-types-data (3.2022.0105)
40
+ minitest (5.17.0)
41
+ netrc (0.11.0)
42
+ oj (3.13.23)
43
+ oj_mimic_json (1.0.1)
44
+ parallel (1.22.1)
45
+ parser (3.2.0.0)
46
+ ast (~> 2.4.1)
47
+ public_suffix (5.0.1)
48
+ rainbow (3.1.1)
49
+ rake (13.0.6)
50
+ regexp_parser (2.6.2)
51
+ rest-client (2.1.0)
52
+ http-accept (>= 1.7.0, < 2.0)
53
+ http-cookie (>= 1.0.2, < 2.0)
54
+ mime-types (>= 1.16, < 4.0)
55
+ netrc (~> 0.8)
56
+ retryable-rb (1.1.0)
57
+ rexml (3.2.5)
58
+ rspec (3.12.0)
59
+ rspec-core (~> 3.12.0)
60
+ rspec-expectations (~> 3.12.0)
61
+ rspec-mocks (~> 3.12.0)
62
+ rspec-core (3.12.0)
63
+ rspec-support (~> 3.12.0)
64
+ rspec-expectations (3.12.2)
65
+ diff-lcs (>= 1.2.0, < 2.0)
66
+ rspec-support (~> 3.12.0)
67
+ rspec-mocks (3.12.3)
68
+ diff-lcs (>= 1.2.0, < 2.0)
69
+ rspec-support (~> 3.12.0)
70
+ rspec-support (3.12.0)
71
+ rubocop (1.42.0)
72
+ json (~> 2.3)
73
+ parallel (~> 1.10)
74
+ parser (>= 3.1.2.1)
75
+ rainbow (>= 2.2.2, < 4.0)
76
+ regexp_parser (>= 1.8, < 3.0)
77
+ rexml (>= 3.2.5, < 4.0)
78
+ rubocop-ast (>= 1.24.1, < 2.0)
79
+ ruby-progressbar (~> 1.7)
80
+ unicode-display_width (>= 1.4.0, < 3.0)
81
+ rubocop-ast (1.24.1)
82
+ parser (>= 3.1.1.0)
83
+ rubocop-performance (1.15.2)
84
+ rubocop (>= 1.7.0, < 2.0)
85
+ rubocop-ast (>= 0.4.0)
86
+ ruby-progressbar (1.11.0)
87
+ standard (1.22.1)
88
+ language_server-protocol (~> 3.17.0.2)
89
+ rubocop (= 1.42.0)
90
+ rubocop-performance (= 1.15.2)
91
+ tzinfo (2.0.5)
92
+ concurrent-ruby (~> 1.0)
93
+ unf (0.1.4)
94
+ unf_ext
95
+ unf_ext (0.0.8.2)
96
+ unicode-display_width (2.4.2)
97
+ webmock (3.18.1)
98
+ addressable (>= 2.8.0)
99
+ crack (>= 0.3.2)
100
+ hashdiff (>= 0.4.0, < 2.0.0)
101
+
102
+ PLATFORMS
103
+ ruby
104
+
105
+ DEPENDENCIES
106
+ global_registry!
107
+ rake
108
+ rspec
109
+ standard
110
+ webmock
111
+
112
+ BUNDLED WITH
113
+ 2.3.11
@@ -1,26 +1,24 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path("../lib", __FILE__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'global_registry/version'
3
+ require "global_registry/version"
5
4
 
6
5
  Gem::Specification.new do |gem|
7
- gem.name = 'global_registry'
8
- gem.version = GlobalRegistry::VERSION
9
- gem.authors = ['Josh Starcher']
10
- gem.email = ['josh.starcher@gmail.com']
11
- gem.description = 'This gem wraps an API for the Global Registry.'
12
- gem.summary = 'Push and pull data from the Global Registry'
13
- gem.homepage = ''
6
+ gem.name = "global_registry"
7
+ gem.version = GlobalRegistry::VERSION
8
+ gem.authors = ["Josh Starcher"]
9
+ gem.email = ["josh.starcher@gmail.com"]
10
+ gem.description = "This gem wraps an API for the Global Registry."
11
+ gem.summary = "Push and pull data from the Global Registry"
12
+ gem.homepage = ""
14
13
 
15
- gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
16
- gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
17
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
- gem.require_paths = ['lib']
14
+ gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
15
+ gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
16
+ gem.require_paths = ["lib"]
19
17
 
20
- gem.add_dependency('rest-client', '>= 1.6.7', '< 3.0.0')
21
- gem.add_dependency('oj', '>= 2.13')
22
- gem.add_dependency('oj_mimic_json')
23
- gem.add_dependency('activesupport')
24
- gem.add_dependency('retryable-rb', '~> 1.1')
25
- gem.add_dependency('addressable', '~> 2.4')
18
+ gem.add_dependency("rest-client", ">= 1.6.7", "< 3.0.0")
19
+ gem.add_dependency("oj", ">= 2.13")
20
+ gem.add_dependency("oj_mimic_json")
21
+ gem.add_dependency("activesupport")
22
+ gem.add_dependency("retryable-rb", "~> 1.1")
23
+ gem.add_dependency("addressable", "~> 2.4")
26
24
  end
@@ -1,7 +1,7 @@
1
- require 'rest-client'
2
- require 'oj'
3
- require 'retryable'
4
- require 'addressable/uri'
1
+ require "rest-client"
2
+ require "oj"
3
+ require "retryable"
4
+ require "addressable/uri"
5
5
 
6
6
  module GlobalRegistry
7
7
  class Base
@@ -14,6 +14,7 @@ module GlobalRegistry
14
14
  def self.find(id, params = {}, headers = {})
15
15
  new.find(id, params, headers)
16
16
  end
17
+
17
18
  def find(id, params = {}, headers = {})
18
19
  request(:get, params, path_with_id(id), headers)
19
20
  end
@@ -21,9 +22,11 @@ module GlobalRegistry
21
22
  def self.get(params = {}, headers = {})
22
23
  new.get(params, headers)
23
24
  end
25
+
24
26
  def get(params = {}, headers = {})
25
27
  request(:get, params, nil, headers)
26
28
  end
29
+
27
30
  def get_all_pages(params = {}, headers = {})
28
31
  results = results_from_all_pages(params, headers)
29
32
  return results unless block_given?
@@ -33,6 +36,7 @@ module GlobalRegistry
33
36
  def self.post(params = {}, headers = {})
34
37
  new.post(params, headers)
35
38
  end
39
+
36
40
  def post(params = {}, headers = {})
37
41
  request(:post, params, nil, headers)
38
42
  end
@@ -40,6 +44,7 @@ module GlobalRegistry
40
44
  def self.put(id, params = {}, headers = {})
41
45
  new.put(id, params, headers)
42
46
  end
47
+
43
48
  def put(id, params = {}, headers = {})
44
49
  request(:put, params, path_with_id(id), headers)
45
50
  end
@@ -47,6 +52,7 @@ module GlobalRegistry
47
52
  def self.delete(id, headers = {})
48
53
  new.delete(id, headers)
49
54
  end
55
+
50
56
  def delete(id, headers = {})
51
57
  request(:delete, {}, path_with_id(id), headers)
52
58
  end
@@ -56,25 +62,25 @@ module GlobalRegistry
56
62
  rescue RestClient::Exception => e
57
63
  raise unless e.response.code.to_i == 404
58
64
  end
65
+
59
66
  def delete_or_ignore(id, headers = {})
60
67
  delete(id, headers)
61
68
  rescue RestClient::Exception => e
62
69
  raise unless e.response.code.to_i == 404
63
70
  end
64
71
 
65
-
66
72
  def self.request(method, params, path = nil, headers = {})
67
73
  new.request(method, params, path, headers)
68
74
  end
69
75
 
70
76
  def request(method, params, path = nil, headers = {})
71
- raise 'You need to configure GlobalRegistry with your access_token.' unless access_token
77
+ raise "You need to configure GlobalRegistry with your access_token." unless access_token
72
78
 
73
- url = if base_url.starts_with? 'http'
74
- Addressable::URI.parse(base_url)
75
- else
76
- Addressable::URI.parse("http://#{base_url}")
77
- end
79
+ url = if base_url.starts_with? "http"
80
+ Addressable::URI.parse(base_url)
81
+ else
82
+ Addressable::URI.parse("http://#{base_url}")
83
+ end
78
84
  url.path = path || default_path
79
85
  url.query_values = headers.delete(:params) if headers[:params]
80
86
 
@@ -91,9 +97,8 @@ module GlobalRegistry
91
97
  }
92
98
  else
93
99
  url.query_values = (url.query_values || {}).merge(params) if params.any?
94
- get_args = { method: method, url: url.to_s, timeout: nil,
95
- headers: default_headers.merge(headers)
96
- }
100
+ get_args = {method: method, url: url.to_s, timeout: nil,
101
+ headers: default_headers.merge(headers)}
97
102
  RestClient::Request.execute(get_args) { |response, request, result, &block|
98
103
  handle_response(response, request, result)
99
104
  }
@@ -101,7 +106,7 @@ module GlobalRegistry
101
106
  end
102
107
 
103
108
  def default_path
104
- self.class.to_s.split('::').last.underscore.pluralize
109
+ self.class.to_s.split("::").last.underscore.pluralize
105
110
  end
106
111
 
107
112
  def path_with_id(id)
@@ -111,8 +116,8 @@ module GlobalRegistry
111
116
  private
112
117
 
113
118
  def default_headers
114
- headers = { authorization: "Bearer #{access_token}", accept: :json }
115
- headers = headers.merge('X-Forwarded-For': @xff) if @xff.present?
119
+ headers = {authorization: "Bearer #{access_token}", accept: :json}
120
+ headers = headers.merge("X-Forwarded-For": @xff) if @xff.present?
116
121
  headers
117
122
  end
118
123
 
@@ -145,8 +150,8 @@ module GlobalRegistry
145
150
  result = get(params, headers)
146
151
  overall_result = result
147
152
  loop do
148
- break unless result['meta'] && result['meta']['next_page']
149
- page = result['meta']['page'].to_i + 1
153
+ break unless result["meta"] && result["meta"]["next_page"]
154
+ page = result["meta"]["page"].to_i + 1
150
155
  result = get(params.merge(page: page), headers)
151
156
  add_result(overall_result, result)
152
157
  end
@@ -159,7 +164,7 @@ module GlobalRegistry
159
164
  next unless value.is_a?(Array)
160
165
  overall_result[key] = value.concat(result[key])
161
166
  end
162
- overall_result.delete('meta')
167
+ overall_result.delete("meta")
163
168
  end
164
169
  end
165
170
  end
@@ -1,5 +1,4 @@
1
1
  module GlobalRegistry
2
2
  class Entity < Base
3
-
4
3
  end
5
4
  end
@@ -2,7 +2,7 @@ module GlobalRegistry
2
2
  class EntityType < Base
3
3
  # This doesn't do any paging yet since, but we can add it later if needed.
4
4
  def self.for_names(names)
5
- get_all_pages('filters[name][]' => names)['entity_types']
5
+ get_all_pages("filters[name][]" => names)["entity_types"]
6
6
  end
7
7
  end
8
8
  end
@@ -1,6 +1,4 @@
1
1
  module GlobalRegistry
2
2
  class EnumValue < Base
3
-
4
3
  end
5
4
  end
6
-
@@ -1,7 +1,10 @@
1
- module GlobalRegistry #:nodoc:
1
+ module GlobalRegistry # :nodoc:
2
2
  class BadRequest < ::RestClient::BadRequest; end
3
+
3
4
  class ResourceNotFound < ::RestClient::ResourceNotFound; end
5
+
4
6
  class InternalServerError < ::RestClient::InternalServerError; end
7
+
5
8
  class OtherError < ::RestClient::Exception; end
6
9
 
7
10
  EXCEPTIONS = [BadRequest, ResourceNotFound, InternalServerError, OtherError].freeze
@@ -1,6 +1,4 @@
1
1
  module GlobalRegistry
2
2
  class Measurement < Base
3
-
4
3
  end
5
4
  end
6
-
@@ -1,6 +1,4 @@
1
1
  module GlobalRegistry
2
2
  class MeasurementType < Base
3
-
4
3
  end
5
4
  end
6
-
@@ -1,6 +1,4 @@
1
1
  module GlobalRegistry
2
2
  class Relationship < Base
3
-
4
3
  end
5
4
  end
6
-
@@ -1,6 +1,4 @@
1
1
  module GlobalRegistry
2
2
  class RelationshipType < Base
3
-
4
3
  end
5
4
  end
6
-
@@ -1,6 +1,4 @@
1
1
  module GlobalRegistry
2
2
  class System < Base
3
-
4
3
  end
5
4
  end
6
-
@@ -1,3 +1,3 @@
1
1
  module GlobalRegistry
2
- VERSION = '1.7.0'
2
+ VERSION = "1.7.1"
3
3
  end
@@ -1,14 +1,15 @@
1
- require 'active_support/core_ext/string/inflections'
2
- require 'global_registry/base'
3
- require 'global_registry/exceptions'
1
+ require "active_support/core_ext/string/inflections"
2
+ require "global_registry/base"
3
+ require "global_registry/exceptions"
4
4
 
5
- Dir[File.dirname(__FILE__) + '/global_registry/*.rb'].each do |file|
5
+ Dir[File.dirname(__FILE__) + "/global_registry/*.rb"].each do |file|
6
6
  require file
7
7
  end
8
8
 
9
9
  module GlobalRegistry
10
10
  class << self
11
- attr_accessor :base_url, :access_token
11
+ attr_accessor :access_token
12
+ attr_writer :base_url
12
13
 
13
14
  def configure
14
15
  yield self
@@ -17,7 +18,5 @@ module GlobalRegistry
17
18
  def base_url
18
19
  @base_url ||= "https://api.global-registry.org/"
19
20
  end
20
-
21
21
  end
22
22
  end
23
-
data/spec/base_spec.rb CHANGED
@@ -1,67 +1,67 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
- describe 'Base' do
4
- describe '#get' do
3
+ describe "Base" do
4
+ describe "#get" do
5
5
  before do
6
- stub_request(:get, 'http://google.com/bases')
7
- .with(headers: {authorization: 'Bearer asdf'})
8
- .to_return(:body => {a: 'b'}.to_json)
6
+ stub_request(:get, "http://google.com/bases")
7
+ .with(headers: {authorization: "Bearer asdf"})
8
+ .to_return(body: {a: "b"}.to_json)
9
9
  end
10
10
 
11
- it 'finds something' do
11
+ it "finds something" do
12
12
  response = GlobalRegistry::Base.get
13
13
  expect(response).to be_a Hash
14
14
  end
15
15
 
16
- it 'can be configured' do
17
- @custom_gr_url = stub_request(:get, 'https://cru.org/bases')
18
- .with(headers: { authorization: 'Bearer qwer',
19
- 'X-Forwarded-For': '203.0.113.7' })
20
- .to_return(:body => {a: 'b'}.to_json)
21
- gr = GlobalRegistry::Base.new(access_token: 'qwer', base_url: 'https://cru.org', xff: '203.0.113.7')
16
+ it "can be configured" do
17
+ @custom_gr_url = stub_request(:get, "https://cru.org/bases")
18
+ .with(headers: {authorization: "Bearer qwer",
19
+ "X-Forwarded-For": "203.0.113.7"})
20
+ .to_return(body: {a: "b"}.to_json)
21
+ gr = GlobalRegistry::Base.new(access_token: "qwer", base_url: "https://cru.org", xff: "203.0.113.7")
22
22
  expect(gr.get).to be_a Hash
23
23
  expect(@custom_gr_url).to have_been_requested
24
24
  end
25
25
  end
26
26
 
27
- describe '#get_all_pages' do
28
- it 'aggregates results from all pages' do
27
+ describe "#get_all_pages" do
28
+ it "aggregates results from all pages" do
29
29
  stub_page_results
30
30
 
31
- expect(GlobalRegistry::Base.new(access_token: 'asdf').get_all_pages)
32
- .to eq([{ 'id' => '1' }, { 'id' => '2' }])
31
+ expect(GlobalRegistry::Base.new(access_token: "asdf").get_all_pages)
32
+ .to eq([{"id" => "1"}, {"id" => "2"}])
33
33
  end
34
34
 
35
- it 'yields results if given a block' do
35
+ it "yields results if given a block" do
36
36
  stub_page_results
37
37
 
38
38
  expect do |b|
39
- GlobalRegistry::Base.new(access_token: 'asdf').get_all_pages.each(&b)
40
- end.to yield_successive_args({ 'id' => '1' }, { 'id' => '2' })
39
+ GlobalRegistry::Base.new(access_token: "asdf").get_all_pages.each(&b)
40
+ end.to yield_successive_args({"id" => "1"}, {"id" => "2"})
41
41
  end
42
42
 
43
43
  def stub_page_results
44
44
  page1 = {
45
- entity_types: [{ id: '1' }],
46
- meta: { page: 1, next_page: true, from: 1, to: 1 }
45
+ entity_types: [{id: "1"}],
46
+ meta: {page: 1, next_page: true, from: 1, to: 1}
47
47
  }
48
48
  page2 = {
49
- entity_types: [{ id: '2' }],
50
- meta: { page: 2, next_page: false, from: 2, to: 2 }
49
+ entity_types: [{id: "2"}],
50
+ meta: {page: 2, next_page: false, from: 2, to: 2}
51
51
  }
52
- stub_request(:get, 'http://google.com/bases')
53
- .with(headers: { authorization: 'Bearer asdf' })
52
+ stub_request(:get, "http://google.com/bases")
53
+ .with(headers: {authorization: "Bearer asdf"})
54
54
  .to_return(body: page1.to_json)
55
- stub_request(:get, 'http://google.com/bases?page=2')
56
- .with(headers: { authorization: 'Bearer asdf' })
55
+ stub_request(:get, "http://google.com/bases?page=2")
56
+ .with(headers: {authorization: "Bearer asdf"})
57
57
  .to_return(body: page2.to_json)
58
58
  end
59
59
  end
60
60
 
61
- describe '#find' do
62
- it 'correctly handles array params' do
63
- @custom_gr_url = stub_request(:get, 'http://google.com/bases/1?a[]=b&a[]=c')
64
- GlobalRegistry::Base.find(1, 'a[]': ['b','c'])
61
+ describe "#find" do
62
+ it "correctly handles array params" do
63
+ @custom_gr_url = stub_request(:get, "http://google.com/bases/1?a[]=b&a[]=c")
64
+ GlobalRegistry::Base.find(1, "a[]": ["b", "c"])
65
65
  expect(@custom_gr_url).to have_been_requested
66
66
  end
67
67
  end
data/spec/entity_spec.rb CHANGED
@@ -1,46 +1,46 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
- describe 'Entity' do
4
- describe '#get' do
3
+ describe "Entity" do
4
+ describe "#get" do
5
5
  before do
6
- stub_request(:get, 'http://google.com/entities')
7
- .to_return(:body => {a: 'b'}.to_json)
6
+ stub_request(:get, "http://google.com/entities")
7
+ .to_return(body: {a: "b"}.to_json)
8
8
  end
9
9
 
10
- it 'finds something' do
10
+ it "finds something" do
11
11
  response = GlobalRegistry::Entity.get
12
12
  expect(response).to be_a Hash
13
13
  end
14
14
 
15
- it 'can be configured' do
16
- @custom_gr_url = stub_request(:get, 'http://cru.org/entities')
17
- .to_return(:body => {a: 'b'}.to_json)
18
- gr = GlobalRegistry::Entity.new(base_url: 'cru.org')
15
+ it "can be configured" do
16
+ @custom_gr_url = stub_request(:get, "http://cru.org/entities")
17
+ .to_return(body: {a: "b"}.to_json)
18
+ gr = GlobalRegistry::Entity.new(base_url: "cru.org")
19
19
  expect(gr.get).to be_a Hash
20
20
  expect(@custom_gr_url).to have_been_requested
21
21
  end
22
22
  end
23
23
 
24
- describe '#put' do
24
+ describe "#put" do
25
25
  before do
26
- stub_request(:get, 'http://google.com/entities')
27
- .to_return(:body => {a: 'b'}.to_json)
26
+ stub_request(:get, "http://google.com/entities")
27
+ .to_return(body: {a: "b"}.to_json)
28
28
  end
29
29
 
30
- it 'sends data' do
30
+ it "sends data" do
31
31
  response = GlobalRegistry::Entity.get
32
32
  expect(response).to be_a Hash
33
33
  end
34
34
  end
35
35
 
36
- describe '#find' do
36
+ describe "#find" do
37
37
  before do
38
- stub_request(:get, 'http://google.com/entities/asdf')
39
- .to_return(:body => {a: 'b'}.to_json)
38
+ stub_request(:get, "http://google.com/entities/asdf")
39
+ .to_return(body: {a: "b"}.to_json)
40
40
  end
41
41
 
42
- it 'sends data' do
43
- response = GlobalRegistry::Entity.find('asdf')
42
+ it "sends data" do
43
+ response = GlobalRegistry::Entity.find("asdf")
44
44
  expect(response).to be_a Hash
45
45
  end
46
46
  end
data/spec/spec_helper.rb CHANGED
@@ -1,16 +1,15 @@
1
- require 'bundler/setup'
1
+ require "bundler/setup"
2
2
  Bundler.setup
3
3
 
4
- require 'global_registry'
5
- require 'active_support/core_ext/string'
6
- require 'webmock/rspec'
4
+ require "global_registry"
5
+ require "active_support/core_ext/string"
6
+ require "webmock/rspec"
7
7
 
8
8
  RSpec.configure do |_config|
9
9
  # some config here
10
-
11
10
  end
12
11
 
13
12
  GlobalRegistry.configure do |config|
14
- config.access_token = 'asdf'
15
- config.base_url = 'google.com/'
16
- end
13
+ config.access_token = "asdf"
14
+ config.base_url = "google.com/"
15
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: global_registry
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Starcher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-26 00:00:00.000000000 Z
11
+ date: 2023-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -107,10 +107,11 @@ executables: []
107
107
  extensions: []
108
108
  extra_rdoc_files: []
109
109
  files:
110
+ - ".github/workflows/ruby.yml"
110
111
  - ".gitignore"
111
112
  - ".ruby-version"
112
- - ".travis.yml"
113
113
  - Gemfile
114
+ - Gemfile.lock
114
115
  - LICENSE
115
116
  - README.md
116
117
  - Rakefile
@@ -153,7 +154,4 @@ rubygems_version: 3.3.26
153
154
  signing_key:
154
155
  specification_version: 4
155
156
  summary: Push and pull data from the Global Registry
156
- test_files:
157
- - spec/base_spec.rb
158
- - spec/entity_spec.rb
159
- - spec/spec_helper.rb
157
+ test_files: []
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- sudo: false
2
- cache: bundler
3
- language: ruby
4
- rvm:
5
- - 3.0.5
6
- script:
7
- - bundle exec rspec spec