Skip to content

Commit 44330fe

Browse files
author
Unai Abrisketa
authored
v0.18.2.pre
1 parent df11dab commit 44330fe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+821
-299
lines changed

.rubocop.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
require:
2+
- rubocop-ordered_methods
3+
- rubocop-rspec
4+
5+
AllCops:
6+
NewCops: enable
7+
8+
Style/StringLiterals:
9+
EnforcedStyle: double_quotes
10+
11+
Metrics/AbcSize:
12+
Enabled: false
13+
Metrics/MethodLength:
14+
Enabled: false
15+
Metrics/BlockLength:
16+
Enabled: false
17+
Metrics/ClassLength:
18+
Enabled: false
19+
Style/Documentation:
20+
Enabled: false
21+
Metrics/CyclomaticComplexity:
22+
Enabled: false
23+
Metrics/PerceivedComplexity:
24+
Enabled: false
25+
26+
Layout/LineLength:
27+
IgnoredPatterns: ['(\A|\s)#']
28+
29+
Style/AsciiComments:
30+
Enabled: false
31+
32+
Style/SymbolArray:
33+
EnforcedStyle: brackets

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1+
### v0.18.2.pre
2+
3+
* bug-fixes
4+
* Move `#products.update_reserve_stock` from `POST` to `PUT`.
5+
6+
* enhancements
7+
* Update how `api_url` is set on `BeyondApi::Session`.
8+
9+
* features
10+
* Install, configure and fix most of the Rubocop issues.
11+
112
### v0.18.1.pre
213

314
* bug-fixes
4-
* Prevent logging `code` and `refresh_token` on `/api/token` calls
15+
* Prevent logging `code` and `refresh_token` on `/api/token` calls.
516

617
### v0.18.0.pre
718

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
source "https://rubygems.org"
24

35
# Specify your gem's dependencies in beyond_api.gemspec

Gemfile.lock

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
PATH
22
remote: .
33
specs:
4-
beyond_api (0.18.1.pre)
4+
beyond_api (0.18.2.pre)
55
faraday (~> 0.15)
66

77
GEM
88
remote: https://rubygems.org/
99
specs:
10+
ast (2.4.2)
1011
coderay (1.1.3)
1112
concurrent-ruby (1.1.9)
1213
diff-lcs (1.4.4)
@@ -19,10 +20,16 @@ GEM
1920
concurrent-ruby (~> 1.0)
2021
method_source (1.0.0)
2122
multipart-post (2.1.1)
23+
parallel (1.20.1)
24+
parser (3.0.2.0)
25+
ast (~> 2.4.1)
2226
pry (0.14.1)
2327
coderay (~> 1.1)
2428
method_source (~> 1.0)
29+
rainbow (3.0.0)
2530
rake (10.5.0)
31+
regexp_parser (2.1.1)
32+
rexml (3.2.5)
2633
rspec (3.10.0)
2734
rspec-core (~> 3.10.0)
2835
rspec-expectations (~> 3.10.0)
@@ -36,6 +43,24 @@ GEM
3643
diff-lcs (>= 1.2.0, < 2.0)
3744
rspec-support (~> 3.10.0)
3845
rspec-support (3.10.2)
46+
rubocop (1.20.0)
47+
parallel (~> 1.10)
48+
parser (>= 3.0.0.0)
49+
rainbow (>= 2.2.2, < 4.0)
50+
regexp_parser (>= 1.8, < 3.0)
51+
rexml
52+
rubocop-ast (>= 1.9.1, < 2.0)
53+
ruby-progressbar (~> 1.7)
54+
unicode-display_width (>= 1.4.0, < 3.0)
55+
rubocop-ast (1.11.0)
56+
parser (>= 3.0.1.1)
57+
rubocop-ordered_methods (0.9)
58+
rubocop (>= 1.0)
59+
rubocop-rspec (2.4.0)
60+
rubocop (~> 1.0)
61+
rubocop-ast (>= 1.1.0)
62+
ruby-progressbar (1.11.0)
63+
unicode-display_width (2.0.0)
3964
yard (0.9.26)
4065

4166
PLATFORMS
@@ -49,6 +74,9 @@ DEPENDENCIES
4974
pry
5075
rake (~> 10.0)
5176
rspec (~> 3.0)
77+
rubocop (~> 1.20)
78+
rubocop-ordered_methods (~> 0.9)
79+
rubocop-rspec (~> 2.4)
5280
yard (~> 0.9)
5381

5482
BUNDLED WITH

Rakefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
# frozen_string_literal: true
2+
13
require "bundler/gem_tasks"
24
require "rspec/core/rake_task"
35
require "yard"
46

57
RSpec::Core::RakeTask.new(:spec)
68

7-
task :default => :spec
9+
task default: :spec
810

911
YARD::Rake::YardocTask.new do |t|
10-
t.files = ['lib/**/*.rb']
12+
t.files = ["lib/**/*.rb"]
1113
end

beyond_api.gemspec

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
# frozen_string_literal: true
12

2-
lib = File.expand_path("../lib", __FILE__)
3+
lib = File.expand_path("lib", __dir__)
34
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
45
require "beyond_api/version"
56

@@ -11,7 +12,7 @@ Gem::Specification.new do |spec|
1112
spec.summary = "Ruby client to access the Beyond API"
1213
spec.homepage = "https://github.com/ePages-de/beyond_api-ruby_client"
1314

14-
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
15+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
1516
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
1617
end
1718
spec.bindir = "exe"
@@ -20,12 +21,15 @@ Gem::Specification.new do |spec|
2021

2122
spec.required_ruby_version = ">= 2.5.1"
2223

23-
spec.add_development_dependency "bundler", "~> 2.0"
24-
spec.add_development_dependency "rake", "~> 10.0"
25-
spec.add_development_dependency "rspec", "~> 3.0"
26-
spec.add_development_dependency "yard", "~> 0.9"
27-
spec.add_development_dependency "faker", "~> 2.2"
28-
spec.add_development_dependency "dotenv", "~> 2.7"
24+
spec.add_development_dependency "bundler", "~> 2.0"
25+
spec.add_development_dependency "dotenv", "~> 2.7"
26+
spec.add_development_dependency "faker", "~> 2.2"
27+
spec.add_development_dependency "rake", "~> 10.0"
28+
spec.add_development_dependency "rspec", "~> 3.0"
29+
spec.add_development_dependency "rubocop", "~> 1.20"
30+
spec.add_development_dependency "rubocop-ordered_methods", "~> 0.9"
31+
spec.add_development_dependency "rubocop-rspec", "~> 2.4"
32+
spec.add_development_dependency "yard", "~> 0.9"
2933

3034
spec.add_dependency "faraday", "~> 0.15"
3135
end

bin/console

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
23

34
require "bundler/setup"
45
require "dotenv/load"
56
require "beyond_api"
67

7-
unless ENV["CLIENT_ID"].nil? and ENV["CLIENT_SECRET"].nil?
8+
unless ENV["CLIENT_ID"].nil? && ENV["CLIENT_SECRET"].nil?
89
BeyondApi.setup do |config|
910
config.client_id = ENV["CLIENT_ID"]
1011
config.client_secret = ENV["CLIENT_SECRET"]

lib/beyond_api.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "beyond_api/version"
24

35
require "logger"
@@ -25,7 +27,7 @@ def self.setup
2527
end
2628

2729
class Configuration
28-
attr_accessor :client_id, :client_secret, :open_timeout, :timeout, :remove_response_links,
30+
attr_accessor :client_id, :client_secret, :open_timeout, :timeout, :remove_response_links,
2931
:remove_response_key_underscores, :object_struct_responses, :raise_error_requests,
3032
:log_headers, :log_bodies, :log_level, :all_pagination_size
3133

lib/beyond_api/connection.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
require 'faraday'
3+
require "faraday"
44

55
module BeyondApi
66
class Connection
@@ -13,8 +13,8 @@ def self.default
1313
faraday.options[:timeout] = BeyondApi.configuration.timeout.to_i
1414
faraday.response :logger, LOGGER, { headers: BeyondApi.configuration.log_headers,
1515
bodies: BeyondApi.configuration.log_bodies }
16-
faraday.headers['Accept'] = 'application/json'
17-
faraday.headers['Content-Type'] = 'application/json'
16+
faraday.headers["Accept"] = "application/json"
17+
faraday.headers["Content-Type"] = "application/json"
1818
faraday.request(:multipart)
1919
faraday.request(:url_encoded)
2020
faraday.adapter(:net_http)

lib/beyond_api/error.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ class Error < StandardError
55
attr_reader :error_id, :details, :trace_id, :full_message, :status_code, :error, :error_description
66

77
def initialize(data, status_code = nil)
8-
@error_id = data['errorId']
9-
@details = data['details']
10-
@trace_id = data['traceId']
11-
@error = data['error']
12-
@error_description = data['error_description']
8+
@error_id = data["errorId"]
9+
@details = data["details"]
10+
@trace_id = data["traceId"]
11+
@error = data["error"]
12+
@error_description = data["error_description"]
1313
@full_message = data
1414
@status_code = status_code
1515

16-
super(data['message'] || data['error_description'])
16+
super(data["message"] || data["error_description"])
1717
end
1818
end
1919
end

0 commit comments

Comments
 (0)