whiplash-app 0.3.4 → 0.3.6

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: cd3b64628b99161af910828d6ebd9e5f07db20394b92d1b075ff69ffc913a323
4
- data.tar.gz: d5f7700773c10a71ae5a8f2e450cffb1f333dad0c5f38c2ad1a82d271cad52e7
3
+ metadata.gz: 8c90cff8f015d917abe3776d9aca9665bd3c42e93edc61b285e7759e0561adf9
4
+ data.tar.gz: 659d0984dc38503ebea51b9deedad41d2b1d576f4bcf991dce2d04943e95b2f4
5
5
  SHA512:
6
- metadata.gz: 554c41b60a38f3762cf11172842942efe564d9dd929d35298c39647083917f36f85a28b80941bf8c6e10abdad6629e69fc8907f89c74e7f48107e609913a5a3d
7
- data.tar.gz: a40d77b5a296b0d98291bb42158e098d34d9e9dd5945d4257774332ad7ad49d15d5305496413119ae1763dc972e12706a4fa80916e0d547ae029a6c2ab1e628d
6
+ metadata.gz: becc547a9b420147d9aa63f511e605d80887d493e01950bce99f0975f50fc57387a050380e33d6f979a35b2df78b59b27ea060915df962e5e519231470cd5632
7
+ data.tar.gz: 8c7d12ba3e4723f52917df252d81148d64a5ab0d1ef8171b8436987038a872f579dcd6e81b429034db2946711f386d78841df956a19ea9185fcbb09ffbe7e37f
@@ -26,6 +26,7 @@ module Whiplash
26
26
  results = []
27
27
  page = 1
28
28
  params[:per_page] = PER_PAGE_REQUEST_LIMIT
29
+ response = nil
29
30
 
30
31
  loop do
31
32
  partial_results_request = app_request(
@@ -33,19 +34,33 @@ module Whiplash
33
34
  endpoint: endpoint,
34
35
  params: params,
35
36
  headers: headers
36
- ).body
37
+ )
37
38
 
38
- results << partial_results_request
39
+ if !partial_results_request.success?
40
+ response = Faraday::Response.new(
41
+ body: partial_results_request.body,
42
+ status: partial_results_request.status,
43
+ method: :get
44
+ )
45
+ break
46
+ end
47
+
48
+ results << partial_results_request.body
39
49
  results.flatten!
40
50
 
41
51
  page += 1
42
52
  params[:page] = page
43
53
 
44
- break if partial_results_request.size == 0
45
- break if partial_results_request.size < PER_PAGE_REQUEST_LIMIT
54
+ break if partial_results_request.body.size == 0
55
+ break if partial_results_request.body.size < PER_PAGE_REQUEST_LIMIT
46
56
  end
47
57
 
48
- results
58
+ response ||= Faraday::Response.new(
59
+ body: results,
60
+ status: 200,
61
+ method: :get
62
+ )
63
+
49
64
  end
50
65
 
51
66
  def delete(endpoint, params = {}, headers = nil, options = {})
@@ -1,5 +1,5 @@
1
1
  module Whiplash
2
2
  module App
3
- VERSION = "0.3.4"
3
+ VERSION = "0.3.6"
4
4
  end
5
5
  end
data/lib/whiplash/app.rb CHANGED
@@ -5,7 +5,8 @@ require "whiplash/app/finder_methods"
5
5
  require "whiplash/app/signing"
6
6
  require "whiplash/app/version"
7
7
  require "oauth2"
8
- require "faraday_middleware"
8
+ require 'faraday/oauth2'
9
+
9
10
 
10
11
  module Whiplash
11
12
 
@@ -24,12 +25,12 @@ module Whiplash
24
25
  end
25
26
 
26
27
  def connection(version = "api/v2")
27
- out = Faraday.new [api_url, version].join("/") do |conn|
28
- conn.request :oauth2, token, token_type: "bearer"
29
- conn.request :json
30
- conn.response :json, :content_type => /\bjson$/
31
- conn.use :instrumentation
32
- conn.adapter Faraday.default_adapter
28
+ out = Faraday.new(url: [api_url, version].join("/")) do |conn|
29
+ conn.request :oauth2, token, token_type: "bearer" # OAuth2 middleware
30
+ conn.request :json # Automatically encode requests as JSON
31
+ conn.response :json # Automatically parse responses as JSON
32
+ conn.response :raise_error # Raise exceptions for 4xx and 5xx responses
33
+ conn.adapter Faraday.default_adapter # Use the default adapter (Net::HTTP)
33
34
  end
34
35
  return out
35
36
  end
data/whiplash-app.gemspec CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Don Sullivan, Mark Dickson"]
10
10
  spec.email = ["developers@getwhiplash.com"]
11
11
 
12
- spec.summary = "this gem provides connectivity to the Whiplash API for authentication and REST requests."
13
- spec.description = "this gem provides connectivity to the Whiplash API for authentication and REST requests."
12
+ spec.summary = "This gem provides connectivity to the Whiplash API for authentication and REST requests."
13
+ spec.description = "This gem provides connectivity to the Whiplash API for authentication and REST requests."
14
14
  spec.homepage = "https://github.com/whiplashmerch/whiplash-app"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
@@ -18,11 +18,11 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "oauth2", "~> 1.2.0"
22
- spec.add_dependency "faraday_middleware", "~> 0.11.0"
23
- spec.add_dependency "moneta", "~> 0.8.0"
21
+ spec.add_dependency "oauth2", "~> 1.2"
22
+ spec.add_dependency "faraday", "~> 2.0"
23
+ spec.add_dependency "moneta", "~> 1.0" # Updated to a more recent version if possible
24
24
 
25
- spec.add_development_dependency "bundler", "~> 1.11"
26
- spec.add_development_dependency "rake", "~> 10.0"
27
- spec.add_development_dependency "rspec", "~> 3.0"
25
+ spec.add_development_dependency "bundler", "~> 2.0"
26
+ spec.add_development_dependency "rake", "~> 13.0"
27
+ spec.add_development_dependency "rspec", "~> 3.10"
28
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whiplash-app
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Don Sullivan, Mark Dickson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-25 00:00:00.000000000 Z
11
+ date: 2024-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2
@@ -16,85 +16,85 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.2.0
19
+ version: '1.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.2.0
26
+ version: '1.2'
27
27
  - !ruby/object:Gem::Dependency
28
- name: faraday_middleware
28
+ name: faraday
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.11.0
33
+ version: '2.0'
34
34
  type: :runtime
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: 0.11.0
40
+ version: '2.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: moneta
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.8.0
47
+ version: '1.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.8.0
54
+ version: '1.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.11'
61
+ version: '2.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.11'
68
+ version: '2.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '10.0'
75
+ version: '13.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '10.0'
82
+ version: '13.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '3.0'
89
+ version: '3.10'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '3.0'
97
- description: this gem provides connectivity to the Whiplash API for authentication
96
+ version: '3.10'
97
+ description: This gem provides connectivity to the Whiplash API for authentication
98
98
  and REST requests.
99
99
  email:
100
100
  - developers@getwhiplash.com
@@ -140,6 +140,6 @@ requirements: []
140
140
  rubygems_version: 3.4.6
141
141
  signing_key:
142
142
  specification_version: 4
143
- summary: this gem provides connectivity to the Whiplash API for authentication and
143
+ summary: This gem provides connectivity to the Whiplash API for authentication and
144
144
  REST requests.
145
145
  test_files: []