tijuana_client 0.3.1 → 1.0.0
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/.github/workflows/ci.yml +25 -0
- data/.gitignore +22 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +7 -0
- data/Gemfile +3 -14
- data/README.md +6 -1
- data/Rakefile +2 -43
- data/VERSION +1 -1
- data/lib/tijuana_client/client.rb +7 -8
- data/lib/tijuana_client/error_middleware.rb +11 -1
- data/tijuana_client.gemspec +32 -74
- metadata +72 -51
- data/.travis.yml +0 -9
- data/spec/client_spec.rb +0 -18
- data/spec/spec_helper.rb +0 -47
- data/spec/tijuana_spec.rb +0 -8
- data/spec/user_spec.rb +0 -99
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e82ebe2be6589c9b1aaeb7eb33486bd6eec027f682e601474ab71dab4bad3fae
|
|
4
|
+
data.tar.gz: 214110b8043380b446ee2d08145cd4456d9b4f8abb9d4b16f81ab256256ef714
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6ba6eafa6cde3a573781bf0d54ac1526038a47f2709e5a70e930a95f5ce6894007fa7b39663496806baa011ad6362cc279f9f625dd009ff85ca8537d413d26f1
|
|
7
|
+
data.tar.gz: 1855191e7902c18889d6108054863c6cbf0cde5c025de121409d832c619f5c95f88435ce158898c2c54602e7fd8399af34ad609f83cf43e1e025d4a5c47d0dcb
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
on: [push]
|
|
3
|
+
|
|
4
|
+
jobs:
|
|
5
|
+
test:
|
|
6
|
+
runs-on: ubuntu-latest
|
|
7
|
+
strategy:
|
|
8
|
+
matrix:
|
|
9
|
+
ruby-version: ['3.3', '3.4', '4.0']
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
- uses: ruby/setup-ruby@v1
|
|
13
|
+
with:
|
|
14
|
+
ruby-version: ${{ matrix.ruby-version }}
|
|
15
|
+
bundler-cache: true
|
|
16
|
+
- run: bundle exec rspec
|
|
17
|
+
rubocop:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
- uses: ruby/setup-ruby@v1
|
|
22
|
+
with:
|
|
23
|
+
ruby-version: '4.0'
|
|
24
|
+
bundler-cache: true
|
|
25
|
+
- run: bundle exec rubocop
|
data/.gitignore
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
*.gem
|
|
2
|
+
*.rbc
|
|
3
|
+
.bundle
|
|
4
|
+
.config
|
|
5
|
+
.idea
|
|
6
|
+
coverage
|
|
7
|
+
Gemfile.lock
|
|
8
|
+
InstalledFiles
|
|
9
|
+
lib/bundler/man
|
|
10
|
+
pkg
|
|
11
|
+
rdoc
|
|
12
|
+
spec/reports
|
|
13
|
+
test/tmp
|
|
14
|
+
test/version_tmp
|
|
15
|
+
tmp
|
|
16
|
+
|
|
17
|
+
# YARD artifacts
|
|
18
|
+
.yardoc
|
|
19
|
+
_yardoc
|
|
20
|
+
doc/
|
|
21
|
+
example.rb
|
|
22
|
+
.byebug_history
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
4.0.1
|
data/CHANGELOG.md
ADDED
data/Gemfile
CHANGED
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
source '
|
|
3
|
+
source 'https://rubygems.org'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
# Add dependencies to develop your gem here.
|
|
8
|
-
# Include everything needed to run rake, tests, features, etc.
|
|
9
|
-
group :development do
|
|
10
|
-
gem 'bundler'
|
|
11
|
-
gem 'juwelier', git: 'https://github.com/flajann2/juwelier.git'
|
|
12
|
-
gem 'pry'
|
|
13
|
-
gem 'pry-byebug'
|
|
14
|
-
gem 'rspec'
|
|
15
|
-
gem 'rubocop'
|
|
16
|
-
gem 'webmock'
|
|
17
|
-
end
|
|
5
|
+
# Specify your gem's dependencies in tijuana_client.gemspec
|
|
6
|
+
gemspec
|
data/README.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
tijuana_client
|
|
2
2
|
=========================
|
|
3
3
|
|
|
4
|
-
[](https://github.com/controlshift/tijuana_client/actions/workflows/ci.yml)
|
|
5
5
|
|
|
6
6
|
An exceptionally simple client for Getup's Tijuana
|
|
7
|
+
|
|
8
|
+
## Requirements
|
|
9
|
+
|
|
10
|
+
- Ruby 3.3, 3.4, or 4.0
|
|
11
|
+
- Faraday ~> 2.0
|
data/Rakefile
CHANGED
|
@@ -1,49 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require '
|
|
4
|
-
require 'bundler'
|
|
5
|
-
begin
|
|
6
|
-
Bundler.setup(:default, :development)
|
|
7
|
-
rescue Bundler::BundlerError => e
|
|
8
|
-
warn e.message
|
|
9
|
-
warn 'Run `bundle install` to install missing gems'
|
|
10
|
-
exit e.status_code
|
|
11
|
-
end
|
|
12
|
-
require 'rake'
|
|
13
|
-
|
|
14
|
-
require 'juwelier'
|
|
15
|
-
Juwelier::Tasks.new do |gem|
|
|
16
|
-
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
|
17
|
-
gem.name = 'tijuana_client'
|
|
18
|
-
gem.homepage = 'http://github.com/controlshift/tijuana_client'
|
|
19
|
-
gem.license = 'MIT'
|
|
20
|
-
gem.summary = %(API client for Tijuana)
|
|
21
|
-
gem.description = %(An API client for the code that runs Getup.org.au)
|
|
22
|
-
gem.email = 'nathan@controlshiftlabs.com'
|
|
23
|
-
gem.authors = ['Nathan Woodhull']
|
|
24
|
-
# dependencies defined in Gemfile
|
|
25
|
-
end
|
|
26
|
-
Juwelier::RubygemsDotOrgTasks.new
|
|
27
|
-
|
|
28
|
-
require 'rspec/core'
|
|
3
|
+
require 'bundler/gem_tasks'
|
|
29
4
|
require 'rspec/core/rake_task'
|
|
30
|
-
RSpec::Core::RakeTask.new(:spec) do |spec|
|
|
31
|
-
spec.pattern = FileList['spec/**/*_spec.rb']
|
|
32
|
-
end
|
|
33
5
|
|
|
34
|
-
RSpec::Core::RakeTask.new(:
|
|
35
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
|
36
|
-
spec.rcov = true
|
|
37
|
-
end
|
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
38
7
|
|
|
39
8
|
task default: :spec
|
|
40
|
-
|
|
41
|
-
require 'rdoc/task'
|
|
42
|
-
Rake::RDocTask.new do |rdoc|
|
|
43
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ''
|
|
44
|
-
|
|
45
|
-
rdoc.rdoc_dir = 'rdoc'
|
|
46
|
-
rdoc.title = "porpoise_external_actions #{version}"
|
|
47
|
-
rdoc.rdoc_files.include('README*')
|
|
48
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
49
|
-
end
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
1.0.0
|
|
@@ -40,18 +40,17 @@ module TijuanaClient
|
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
def setup
|
|
43
|
-
connection.
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
connection.faraday_connection = Faraday.new(connection.configuration.faraday_options) do |f|
|
|
44
|
+
f.request :multipart
|
|
45
|
+
f.request :url_encoded
|
|
46
46
|
if connection.configuration.authenticated?
|
|
47
|
-
|
|
48
|
-
connection.configuration.password
|
|
47
|
+
f.request :authorization, :basic, connection.configuration.username, connection.configuration.password
|
|
49
48
|
end
|
|
50
49
|
|
|
51
|
-
|
|
50
|
+
f.response :logger if ENV['DEBUG']
|
|
52
51
|
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
f.use TijuanaClient::ErrorMiddleware
|
|
53
|
+
f.adapter connection.configuration.adapter
|
|
55
54
|
end
|
|
56
55
|
end
|
|
57
56
|
|
|
@@ -4,7 +4,7 @@ module TijuanaClient
|
|
|
4
4
|
class ValidationError < StandardError; end
|
|
5
5
|
class EmailValidationError < StandardError; end
|
|
6
6
|
|
|
7
|
-
class ErrorMiddleware < Faraday::
|
|
7
|
+
class ErrorMiddleware < Faraday::Middleware
|
|
8
8
|
def on_complete(env)
|
|
9
9
|
case env[:status]
|
|
10
10
|
when 400
|
|
@@ -22,5 +22,15 @@ module TijuanaClient
|
|
|
22
22
|
raise Faraday::ClientError, response_values(env).to_s
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
def response_values(env)
|
|
29
|
+
{
|
|
30
|
+
status: env[:status],
|
|
31
|
+
headers: env[:response_headers],
|
|
32
|
+
body: env[:body]
|
|
33
|
+
}
|
|
34
|
+
end
|
|
25
35
|
end
|
|
26
36
|
end
|
data/tijuana_client.gemspec
CHANGED
|
@@ -1,80 +1,38 @@
|
|
|
1
|
-
#
|
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
|
-
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
|
-
# -*- encoding: utf-8 -*-
|
|
5
|
-
# stub: tijuana_client 0.3.1 ruby lib
|
|
1
|
+
# frozen_string_literal: true
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
s.version = "0.3.1"
|
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
10
5
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
s.email = "nathan@controlshiftlabs.com".freeze
|
|
17
|
-
s.extra_rdoc_files = [
|
|
18
|
-
"LICENSE.txt",
|
|
19
|
-
"README.md"
|
|
20
|
-
]
|
|
21
|
-
s.files = [
|
|
22
|
-
".rubocop.yml",
|
|
23
|
-
".ruby-gemset",
|
|
24
|
-
".ruby-version",
|
|
25
|
-
".travis.yml",
|
|
26
|
-
"Gemfile",
|
|
27
|
-
"LICENSE.txt",
|
|
28
|
-
"README.md",
|
|
29
|
-
"Rakefile",
|
|
30
|
-
"VERSION",
|
|
31
|
-
"lib/tijuana_client.rb",
|
|
32
|
-
"lib/tijuana_client/base.rb",
|
|
33
|
-
"lib/tijuana_client/client.rb",
|
|
34
|
-
"lib/tijuana_client/error_middleware.rb",
|
|
35
|
-
"lib/tijuana_client/user.rb",
|
|
36
|
-
"spec/client_spec.rb",
|
|
37
|
-
"spec/spec_helper.rb",
|
|
38
|
-
"spec/tijuana_spec.rb",
|
|
39
|
-
"spec/user_spec.rb",
|
|
40
|
-
"tijuana_client.gemspec"
|
|
41
|
-
]
|
|
42
|
-
s.homepage = "http://github.com/controlshift/tijuana_client".freeze
|
|
43
|
-
s.licenses = ["MIT".freeze]
|
|
44
|
-
s.rubygems_version = "3.0.8".freeze
|
|
45
|
-
s.summary = "API client for Tijuana".freeze
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = 'tijuana_client'
|
|
8
|
+
spec.version = File.read(File.expand_path('VERSION', __dir__)).strip
|
|
9
|
+
spec.authors = ['Nathan Woodhull', 'Owens Ehimen', 'Diego Marcet', 'Grey Moore']
|
|
10
|
+
spec.email = ['talk@controlshiftlabs.com']
|
|
46
11
|
|
|
47
|
-
|
|
48
|
-
|
|
12
|
+
spec.summary = 'API client for Tijuana'
|
|
13
|
+
spec.description = 'An API client for the code that runs Getup.org.au'
|
|
14
|
+
spec.homepage = 'https://github.com/controlshift/tijuana_client'
|
|
15
|
+
spec.license = 'MIT'
|
|
49
16
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
s.add_development_dependency(%q<bundler>.freeze, [">= 0"])
|
|
53
|
-
s.add_development_dependency(%q<juwelier>.freeze, [">= 0"])
|
|
54
|
-
s.add_development_dependency(%q<pry>.freeze, [">= 0"])
|
|
55
|
-
s.add_development_dependency(%q<pry-byebug>.freeze, [">= 0"])
|
|
56
|
-
s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
|
|
57
|
-
s.add_development_dependency(%q<rubocop>.freeze, [">= 0"])
|
|
58
|
-
s.add_development_dependency(%q<webmock>.freeze, [">= 0"])
|
|
59
|
-
else
|
|
60
|
-
s.add_dependency(%q<vertebrae>.freeze, [">= 0.6.0"])
|
|
61
|
-
s.add_dependency(%q<bundler>.freeze, [">= 0"])
|
|
62
|
-
s.add_dependency(%q<juwelier>.freeze, [">= 0"])
|
|
63
|
-
s.add_dependency(%q<pry>.freeze, [">= 0"])
|
|
64
|
-
s.add_dependency(%q<pry-byebug>.freeze, [">= 0"])
|
|
65
|
-
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
|
66
|
-
s.add_dependency(%q<rubocop>.freeze, [">= 0"])
|
|
67
|
-
s.add_dependency(%q<webmock>.freeze, [">= 0"])
|
|
68
|
-
end
|
|
69
|
-
else
|
|
70
|
-
s.add_dependency(%q<vertebrae>.freeze, [">= 0.6.0"])
|
|
71
|
-
s.add_dependency(%q<bundler>.freeze, [">= 0"])
|
|
72
|
-
s.add_dependency(%q<juwelier>.freeze, [">= 0"])
|
|
73
|
-
s.add_dependency(%q<pry>.freeze, [">= 0"])
|
|
74
|
-
s.add_dependency(%q<pry-byebug>.freeze, [">= 0"])
|
|
75
|
-
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
|
76
|
-
s.add_dependency(%q<rubocop>.freeze, [">= 0"])
|
|
77
|
-
s.add_dependency(%q<webmock>.freeze, [">= 0"])
|
|
17
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
18
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
78
19
|
end
|
|
79
|
-
|
|
20
|
+
spec.require_paths = ['lib']
|
|
21
|
+
|
|
22
|
+
spec.required_ruby_version = ['>= 3.3', '< 5.0']
|
|
23
|
+
|
|
24
|
+
# Runtime dependencies
|
|
25
|
+
spec.add_runtime_dependency 'vertebrae', '~> 1.0'
|
|
26
|
+
spec.add_runtime_dependency 'faraday', '~> 2.0'
|
|
80
27
|
|
|
28
|
+
# Development dependencies
|
|
29
|
+
spec.add_development_dependency 'bundler', '>= 2.0', '< 5.0'
|
|
30
|
+
spec.add_development_dependency 'pry', '~> 0.14'
|
|
31
|
+
spec.add_development_dependency 'pry-byebug', '~> 3.0'
|
|
32
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
|
33
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
34
|
+
spec.add_development_dependency 'rubocop', '~> 1.0'
|
|
35
|
+
spec.add_development_dependency 'webmock', '~> 3.0'
|
|
36
|
+
|
|
37
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
38
|
+
end
|
metadata
CHANGED
|
@@ -1,139 +1,162 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tijuana_client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nathan Woodhull
|
|
8
|
-
|
|
8
|
+
- Owens Ehimen
|
|
9
|
+
- Diego Marcet
|
|
10
|
+
- Grey Moore
|
|
9
11
|
bindir: bin
|
|
10
12
|
cert_chain: []
|
|
11
|
-
date:
|
|
13
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
14
|
dependencies:
|
|
13
15
|
- !ruby/object:Gem::Dependency
|
|
14
16
|
name: vertebrae
|
|
15
17
|
requirement: !ruby/object:Gem::Requirement
|
|
16
18
|
requirements:
|
|
17
|
-
- - "
|
|
19
|
+
- - "~>"
|
|
18
20
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
21
|
+
version: '1.0'
|
|
20
22
|
type: :runtime
|
|
21
23
|
prerelease: false
|
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
25
|
requirements:
|
|
24
|
-
- - "
|
|
26
|
+
- - "~>"
|
|
25
27
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
28
|
+
version: '1.0'
|
|
27
29
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
30
|
+
name: faraday
|
|
29
31
|
requirement: !ruby/object:Gem::Requirement
|
|
30
32
|
requirements:
|
|
31
|
-
- - "
|
|
33
|
+
- - "~>"
|
|
32
34
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0'
|
|
34
|
-
type: :
|
|
35
|
+
version: '2.0'
|
|
36
|
+
type: :runtime
|
|
35
37
|
prerelease: false
|
|
36
38
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
39
|
requirements:
|
|
38
|
-
- - "
|
|
40
|
+
- - "~>"
|
|
39
41
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '0'
|
|
42
|
+
version: '2.0'
|
|
41
43
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
44
|
+
name: bundler
|
|
43
45
|
requirement: !ruby/object:Gem::Requirement
|
|
44
46
|
requirements:
|
|
45
47
|
- - ">="
|
|
46
48
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '0'
|
|
49
|
+
version: '2.0'
|
|
50
|
+
- - "<"
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: '5.0'
|
|
48
53
|
type: :development
|
|
49
54
|
prerelease: false
|
|
50
55
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
56
|
requirements:
|
|
52
57
|
- - ">="
|
|
53
58
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '0'
|
|
59
|
+
version: '2.0'
|
|
60
|
+
- - "<"
|
|
61
|
+
- !ruby/object:Gem::Version
|
|
62
|
+
version: '5.0'
|
|
55
63
|
- !ruby/object:Gem::Dependency
|
|
56
64
|
name: pry
|
|
57
65
|
requirement: !ruby/object:Gem::Requirement
|
|
58
66
|
requirements:
|
|
59
|
-
- - "
|
|
67
|
+
- - "~>"
|
|
60
68
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '0'
|
|
69
|
+
version: '0.14'
|
|
62
70
|
type: :development
|
|
63
71
|
prerelease: false
|
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
73
|
requirements:
|
|
66
|
-
- - "
|
|
74
|
+
- - "~>"
|
|
67
75
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '0'
|
|
76
|
+
version: '0.14'
|
|
69
77
|
- !ruby/object:Gem::Dependency
|
|
70
78
|
name: pry-byebug
|
|
71
79
|
requirement: !ruby/object:Gem::Requirement
|
|
72
80
|
requirements:
|
|
73
|
-
- - "
|
|
81
|
+
- - "~>"
|
|
74
82
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '0'
|
|
83
|
+
version: '3.0'
|
|
76
84
|
type: :development
|
|
77
85
|
prerelease: false
|
|
78
86
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
87
|
requirements:
|
|
80
|
-
- - "
|
|
88
|
+
- - "~>"
|
|
81
89
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: '0'
|
|
90
|
+
version: '3.0'
|
|
91
|
+
- !ruby/object:Gem::Dependency
|
|
92
|
+
name: rake
|
|
93
|
+
requirement: !ruby/object:Gem::Requirement
|
|
94
|
+
requirements:
|
|
95
|
+
- - "~>"
|
|
96
|
+
- !ruby/object:Gem::Version
|
|
97
|
+
version: '13.0'
|
|
98
|
+
type: :development
|
|
99
|
+
prerelease: false
|
|
100
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
101
|
+
requirements:
|
|
102
|
+
- - "~>"
|
|
103
|
+
- !ruby/object:Gem::Version
|
|
104
|
+
version: '13.0'
|
|
83
105
|
- !ruby/object:Gem::Dependency
|
|
84
106
|
name: rspec
|
|
85
107
|
requirement: !ruby/object:Gem::Requirement
|
|
86
108
|
requirements:
|
|
87
|
-
- - "
|
|
109
|
+
- - "~>"
|
|
88
110
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: '0'
|
|
111
|
+
version: '3.0'
|
|
90
112
|
type: :development
|
|
91
113
|
prerelease: false
|
|
92
114
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
115
|
requirements:
|
|
94
|
-
- - "
|
|
116
|
+
- - "~>"
|
|
95
117
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: '0'
|
|
118
|
+
version: '3.0'
|
|
97
119
|
- !ruby/object:Gem::Dependency
|
|
98
120
|
name: rubocop
|
|
99
121
|
requirement: !ruby/object:Gem::Requirement
|
|
100
122
|
requirements:
|
|
101
|
-
- - "
|
|
123
|
+
- - "~>"
|
|
102
124
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: '0'
|
|
125
|
+
version: '1.0'
|
|
104
126
|
type: :development
|
|
105
127
|
prerelease: false
|
|
106
128
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
129
|
requirements:
|
|
108
|
-
- - "
|
|
130
|
+
- - "~>"
|
|
109
131
|
- !ruby/object:Gem::Version
|
|
110
|
-
version: '0'
|
|
132
|
+
version: '1.0'
|
|
111
133
|
- !ruby/object:Gem::Dependency
|
|
112
134
|
name: webmock
|
|
113
135
|
requirement: !ruby/object:Gem::Requirement
|
|
114
136
|
requirements:
|
|
115
|
-
- - "
|
|
137
|
+
- - "~>"
|
|
116
138
|
- !ruby/object:Gem::Version
|
|
117
|
-
version: '0'
|
|
139
|
+
version: '3.0'
|
|
118
140
|
type: :development
|
|
119
141
|
prerelease: false
|
|
120
142
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
143
|
requirements:
|
|
122
|
-
- - "
|
|
144
|
+
- - "~>"
|
|
123
145
|
- !ruby/object:Gem::Version
|
|
124
|
-
version: '0'
|
|
146
|
+
version: '3.0'
|
|
125
147
|
description: An API client for the code that runs Getup.org.au
|
|
126
|
-
email:
|
|
148
|
+
email:
|
|
149
|
+
- talk@controlshiftlabs.com
|
|
127
150
|
executables: []
|
|
128
151
|
extensions: []
|
|
129
|
-
extra_rdoc_files:
|
|
130
|
-
- LICENSE.txt
|
|
131
|
-
- README.md
|
|
152
|
+
extra_rdoc_files: []
|
|
132
153
|
files:
|
|
154
|
+
- ".github/workflows/ci.yml"
|
|
155
|
+
- ".gitignore"
|
|
133
156
|
- ".rubocop.yml"
|
|
134
157
|
- ".ruby-gemset"
|
|
135
158
|
- ".ruby-version"
|
|
136
|
-
-
|
|
159
|
+
- CHANGELOG.md
|
|
137
160
|
- Gemfile
|
|
138
161
|
- LICENSE.txt
|
|
139
162
|
- README.md
|
|
@@ -144,16 +167,12 @@ files:
|
|
|
144
167
|
- lib/tijuana_client/client.rb
|
|
145
168
|
- lib/tijuana_client/error_middleware.rb
|
|
146
169
|
- lib/tijuana_client/user.rb
|
|
147
|
-
- spec/client_spec.rb
|
|
148
|
-
- spec/spec_helper.rb
|
|
149
|
-
- spec/tijuana_spec.rb
|
|
150
|
-
- spec/user_spec.rb
|
|
151
170
|
- tijuana_client.gemspec
|
|
152
|
-
homepage:
|
|
171
|
+
homepage: https://github.com/controlshift/tijuana_client
|
|
153
172
|
licenses:
|
|
154
173
|
- MIT
|
|
155
|
-
metadata:
|
|
156
|
-
|
|
174
|
+
metadata:
|
|
175
|
+
rubygems_mfa_required: 'true'
|
|
157
176
|
rdoc_options: []
|
|
158
177
|
require_paths:
|
|
159
178
|
- lib
|
|
@@ -161,15 +180,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
161
180
|
requirements:
|
|
162
181
|
- - ">="
|
|
163
182
|
- !ruby/object:Gem::Version
|
|
164
|
-
version: '
|
|
183
|
+
version: '3.3'
|
|
184
|
+
- - "<"
|
|
185
|
+
- !ruby/object:Gem::Version
|
|
186
|
+
version: '5.0'
|
|
165
187
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
188
|
requirements:
|
|
167
189
|
- - ">="
|
|
168
190
|
- !ruby/object:Gem::Version
|
|
169
191
|
version: '0'
|
|
170
192
|
requirements: []
|
|
171
|
-
rubygems_version:
|
|
172
|
-
signing_key:
|
|
193
|
+
rubygems_version: 4.0.3
|
|
173
194
|
specification_version: 4
|
|
174
195
|
summary: API client for Tijuana
|
|
175
196
|
test_files: []
|
data/.travis.yml
DELETED
data/spec/client_spec.rb
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require File.expand_path("#{File.dirname(__FILE__)}/spec_helper")
|
|
4
|
-
|
|
5
|
-
describe TijuanaClient::Client do
|
|
6
|
-
specify { expect(subject).to respond_to :user }
|
|
7
|
-
|
|
8
|
-
describe 'instantiated' do
|
|
9
|
-
subject { described_class.new(options) }
|
|
10
|
-
|
|
11
|
-
context 'process_basic_auth' do
|
|
12
|
-
let(:options) { { basic_auth: 'login:password' } }
|
|
13
|
-
let(:config) { subject.connection.configuration }
|
|
14
|
-
specify { expect(config.username).to eq 'login' }
|
|
15
|
-
specify { expect(config.password).to eq 'password' }
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
data/spec/spec_helper.rb
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
4
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
5
|
-
require 'rspec'
|
|
6
|
-
require 'tijuana_client'
|
|
7
|
-
require 'webmock/rspec'
|
|
8
|
-
|
|
9
|
-
# Requires supporting files with custom matchers and macros, etc,
|
|
10
|
-
# in ./support/ and its subdirectories.
|
|
11
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |f| require f }
|
|
12
|
-
|
|
13
|
-
RSpec.configure do |config|
|
|
14
|
-
config.color = true
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
RSpec.configure do |config|
|
|
18
|
-
config.include WebMock::API
|
|
19
|
-
|
|
20
|
-
config.before(:each) do
|
|
21
|
-
WebMock.reset!
|
|
22
|
-
end
|
|
23
|
-
config.after(:each) do
|
|
24
|
-
WebMock.reset!
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def stub_get(path)
|
|
29
|
-
stub_tijuana_request(:get, path)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def stub_post(path)
|
|
33
|
-
stub_tijuana_request(:post, path)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def stub_tijuana_request(method, path)
|
|
37
|
-
prefix = TijuanaClient.new.connection.configuration.prefix.to_s
|
|
38
|
-
stub_request(method, "https://test.com#{prefix}#{path}")
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def fixture_path
|
|
42
|
-
File.expand_path('fixtures', __dir__)
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def fixture(file)
|
|
46
|
-
File.new(File.join(fixture_path, '/', file))
|
|
47
|
-
end
|
data/spec/tijuana_spec.rb
DELETED
data/spec/user_spec.rb
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require File.expand_path("#{File.dirname(__FILE__)}/spec_helper")
|
|
4
|
-
|
|
5
|
-
describe TijuanaClient::User do
|
|
6
|
-
subject { TijuanaClient.new(host: 'test.com') }
|
|
7
|
-
|
|
8
|
-
describe 'configuration' do
|
|
9
|
-
it 'should propagate the host' do
|
|
10
|
-
expect(subject.user.client.connection.configuration.host).to eq('test.com')
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
describe '.post_json_request' do
|
|
15
|
-
let(:client) { TijuanaClient::Client.new }
|
|
16
|
-
subject { TijuanaClient::User.new({ client: client }) }
|
|
17
|
-
let(:path) { '/foo' }
|
|
18
|
-
let(:params) { { first_name: 'Nathan' } }
|
|
19
|
-
|
|
20
|
-
it 'should jsonify params' do
|
|
21
|
-
expect(client).to receive(:post_request).with('/foo', { 'data' => JSON.generate({ first_name: 'Nathan' }) })
|
|
22
|
-
client.post_json_request(path, params)
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
describe 'create' do
|
|
27
|
-
let(:body) { '' }
|
|
28
|
-
let(:request_body) { { 'data' => JSON.generate({ first_name: 'Nathan' }) } }
|
|
29
|
-
let(:request_path) { '/api/users/' }
|
|
30
|
-
|
|
31
|
-
before(:each) do
|
|
32
|
-
stub_post(request_path).with(body: request_body).to_return(body: body, status: status,
|
|
33
|
-
headers: { content_type: 'application/json; charset=utf-8' })
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
describe 'success' do
|
|
37
|
-
let(:status) { 200 }
|
|
38
|
-
|
|
39
|
-
it 'should create a user' do
|
|
40
|
-
subject.user.create(first_name: 'Nathan')
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
describe 'an error' do
|
|
45
|
-
let(:status) { 500 }
|
|
46
|
-
|
|
47
|
-
it 'should raise' do
|
|
48
|
-
expect { subject.user.create(first_name: 'Nathan') }.to raise_exception(StandardError)
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
describe 'generic validation error' do
|
|
53
|
-
let(:status) { 400 }
|
|
54
|
-
let(:body) { '{"foo":["is bar"]}' }
|
|
55
|
-
|
|
56
|
-
it 'should return nil' do
|
|
57
|
-
expect { subject.user.create(first_name: 'Nathan') }.to raise_exception(TijuanaClient::ValidationError)
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
describe 'email validation error' do
|
|
62
|
-
let(:status) { 400 }
|
|
63
|
-
let(:body) { '{"email":["is invalid"]}' }
|
|
64
|
-
|
|
65
|
-
it 'should return nil' do
|
|
66
|
-
expect { subject.user.create(first_name: 'Nathan') }.to raise_exception(TijuanaClient::EmailValidationError)
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
describe 'basic authentication' do
|
|
72
|
-
subject { TijuanaClient.new(host: 'test.com', username: 'username', password: 'password') }
|
|
73
|
-
|
|
74
|
-
let(:body) { '' }
|
|
75
|
-
let(:request_body) { { 'data' => JSON.generate({ first_name: 'Nathan' }) } }
|
|
76
|
-
let(:request_path) { '/api/users/' }
|
|
77
|
-
|
|
78
|
-
before(:each) do
|
|
79
|
-
stub_request(:post, "https://test.com#{request_path}").with(basic_auth: %w[username password], body: request_body)
|
|
80
|
-
.to_return(body: body, status: status, headers: { content_type: 'application/json; charset=utf-8' })
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
describe 'success' do
|
|
84
|
-
let(:status) { 200 }
|
|
85
|
-
|
|
86
|
-
it 'should create a user' do
|
|
87
|
-
subject.user.create(first_name: 'Nathan')
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
describe 'unauthorized' do
|
|
92
|
-
let(:status) { 401 }
|
|
93
|
-
|
|
94
|
-
it 'should return nil' do
|
|
95
|
-
expect { subject.user.create(first_name: 'Nathan') }.to raise_exception(StandardError)
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
|
-
end
|