Skip to content

Commit 63280cb

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents aa54719 + ec6036d commit 63280cb

Some content is hidden

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

57 files changed

+1212
-317
lines changed

.env.template

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CLIENT_ID=""
2+
CLIENT_SECRET=""
3+
SHOP_URL=""

.rubocop.yml

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

CHANGELOG.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
1+
### v0.19.0.pre
2+
3+
* features
4+
* Upload multiple images for products and variations
5+
6+
### v0.18.2.pre
7+
8+
* bug-fixes
9+
* Move `#products.update_reserve_stock` from `POST` to `PUT`.
10+
11+
* enhancements
12+
* Update how `api_url` is set on `BeyondApi::Session`.
13+
14+
* features
15+
* Install, configure and fix most of the Rubocop issues.
16+
117
### v0.18.1.pre
218

319
* bug-fixes
4-
* Prevent logging `code` and `refresh_token` on `/api/token` calls
20+
* Prevent logging `code` and `refresh_token` on `/api/token` calls.
521

622
### v0.18.0.pre
723

Gemfile

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

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

68
gem "pry"
9+
10+
group :test do
11+
gem "factory_bot"
12+
end

Gemfile.lock

Lines changed: 68 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,61 @@
11
PATH
22
remote: .
33
specs:
4-
beyond_api (0.18.1.pre)
5-
faraday (~> 0.15)
4+
beyond_api (0.19.0.pre)
5+
faraday (~> 1.8.0)
66

77
GEM
88
remote: https://rubygems.org/
99
specs:
10+
activesupport (6.1.4.1)
11+
concurrent-ruby (~> 1.0, >= 1.0.2)
12+
i18n (>= 1.6, < 2)
13+
minitest (>= 5.1)
14+
tzinfo (~> 2.0)
15+
zeitwerk (~> 2.3)
16+
ast (2.4.2)
1017
coderay (1.1.3)
1118
concurrent-ruby (1.1.9)
1219
diff-lcs (1.4.4)
1320
dotenv (2.7.6)
14-
faker (2.18.0)
21+
factory_bot (6.2.0)
22+
activesupport (>= 5.0.0)
23+
faker (2.19.0)
1524
i18n (>= 1.6, < 2)
16-
faraday (0.17.4)
25+
faraday (1.8.0)
26+
faraday-em_http (~> 1.0)
27+
faraday-em_synchrony (~> 1.0)
28+
faraday-excon (~> 1.1)
29+
faraday-httpclient (~> 1.0.1)
30+
faraday-net_http (~> 1.0)
31+
faraday-net_http_persistent (~> 1.1)
32+
faraday-patron (~> 1.0)
33+
faraday-rack (~> 1.0)
1734
multipart-post (>= 1.2, < 3)
18-
i18n (1.8.10)
35+
ruby2_keywords (>= 0.0.4)
36+
faraday-em_http (1.0.0)
37+
faraday-em_synchrony (1.0.0)
38+
faraday-excon (1.1.0)
39+
faraday-httpclient (1.0.1)
40+
faraday-net_http (1.0.1)
41+
faraday-net_http_persistent (1.2.0)
42+
faraday-patron (1.0.0)
43+
faraday-rack (1.0.0)
44+
i18n (1.8.11)
1945
concurrent-ruby (~> 1.0)
2046
method_source (1.0.0)
47+
minitest (5.14.4)
2148
multipart-post (2.1.1)
49+
parallel (1.21.0)
50+
parser (3.0.3.1)
51+
ast (~> 2.4.1)
2252
pry (0.14.1)
2353
coderay (~> 1.1)
2454
method_source (~> 1.0)
55+
rainbow (3.0.0)
2556
rake (10.5.0)
57+
regexp_parser (2.1.1)
58+
rexml (3.2.5)
2659
rspec (3.10.0)
2760
rspec-core (~> 3.10.0)
2861
rspec-expectations (~> 3.10.0)
@@ -35,8 +68,31 @@ GEM
3568
rspec-mocks (3.10.2)
3669
diff-lcs (>= 1.2.0, < 2.0)
3770
rspec-support (~> 3.10.0)
38-
rspec-support (3.10.2)
39-
yard (0.9.26)
71+
rspec-support (3.10.3)
72+
rubocop (1.23.0)
73+
parallel (~> 1.10)
74+
parser (>= 3.0.0.0)
75+
rainbow (>= 2.2.2, < 4.0)
76+
regexp_parser (>= 1.8, < 3.0)
77+
rexml
78+
rubocop-ast (>= 1.12.0, < 2.0)
79+
ruby-progressbar (~> 1.7)
80+
unicode-display_width (>= 1.4.0, < 3.0)
81+
rubocop-ast (1.13.0)
82+
parser (>= 3.0.1.1)
83+
rubocop-ordered_methods (0.9)
84+
rubocop (>= 1.0)
85+
rubocop-rspec (2.6.0)
86+
rubocop (~> 1.19)
87+
ruby-progressbar (1.11.0)
88+
ruby2_keywords (0.0.5)
89+
tzinfo (2.0.4)
90+
concurrent-ruby (~> 1.0)
91+
unicode-display_width (2.1.0)
92+
webrick (1.7.0)
93+
yard (0.9.27)
94+
webrick (~> 1.7.0)
95+
zeitwerk (2.5.1)
4096

4197
PLATFORMS
4298
ruby
@@ -45,11 +101,15 @@ DEPENDENCIES
45101
beyond_api!
46102
bundler (~> 2.0)
47103
dotenv (~> 2.7)
104+
factory_bot
48105
faker (~> 2.2)
49106
pry
50107
rake (~> 10.0)
51108
rspec (~> 3.0)
109+
rubocop (~> 1.20)
110+
rubocop-ordered_methods (~> 0.9)
111+
rubocop-rspec (~> 2.4)
52112
yard (~> 0.9)
53113

54114
BUNDLED WITH
55-
2.2.26
115+
2.2.31

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: 13 additions & 9 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

30-
spec.add_dependency "faraday", "~> 0.15"
34+
spec.add_dependency "faraday", "~> 1.8.0"
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: 13 additions & 5 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)
@@ -32,8 +32,16 @@ def self.token
3232
end
3333
faraday.headers['Accept'] = 'application/json'
3434
faraday.adapter(:net_http)
35-
faraday.basic_auth(BeyondApi.configuration.client_id,
36-
BeyondApi.configuration.client_secret)
35+
faraday.request :basic_auth, BeyondApi.configuration.client_id, BeyondApi.configuration.client_secret
36+
end
37+
end
38+
39+
def self.multipart
40+
Faraday.new(ssl: { verify: true }) do |faraday|
41+
faraday.options[:open_timeout] = BeyondApi.configuration.open_timeout.to_i
42+
faraday.options[:timeout] = BeyondApi.configuration.timeout.to_i
43+
faraday.request :multipart, { flat_encode: true }
44+
faraday.adapter Faraday.default_adapter
3745
end
3846
end
3947
end

0 commit comments

Comments
 (0)