Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
f12099e
wip
k4th Aug 5, 2024
75e162c
wip
k4th Aug 5, 2024
19775a7
wip
k4th Aug 5, 2024
2516fa5
wip
k4th Aug 6, 2024
754fa04
wip
k4th Aug 6, 2024
c69d9d3
adds some endpoints
citin Aug 6, 2024
0f5ac37
require created files
citin Aug 6, 2024
b4455ec
Merge pull request #1 from citin/v2
k4th Aug 6, 2024
a30d087
Add endpoints
k4th Aug 6, 2024
3446eac
wip
k4th Aug 6, 2024
c089f9b
removes configs and refactor response
citin Aug 6, 2024
cb64540
Beyond api v2 (#63)
k4th Aug 6, 2024
84818d0
adds zeitwerk
citin Aug 6, 2024
7e5b115
V2 (#62)
k4th Aug 6, 2024
28f075d
Update fetch all (#64)
k4th Aug 6, 2024
96293f3
[wip] refactor connection and request
citin Aug 7, 2024
22a7403
Merge branch 'v2' of github.com:ePages-de/beyond_api-ruby_client into v2
citin Aug 7, 2024
51b8621
[WIP] refactor connection
citin Aug 7, 2024
3f06cc0
[WIP] refactor token call
citin Aug 7, 2024
ed0d19d
Wip v2 (#65)
k4th Aug 7, 2024
d12cdce
[WIP] add authentication
citin Aug 7, 2024
ca812fc
Wip v2 (#66)
k4th Aug 7, 2024
e2eaadc
refactor session, add autentication types (#67)
citin Aug 8, 2024
d4af644
Add webhook and signer endpoints (#68)
k4th Aug 8, 2024
d5ea45b
merge-pagination
citin Aug 8, 2024
c242501
Merge pull request #70 from citin/merge-pagination
citin Aug 8, 2024
e4de87e
adds parsed parameters in request
citin Aug 8, 2024
0e62e25
add @camelize_keys to connection
citin Aug 8, 2024
544df57
removes old /resources files
citin Aug 8, 2024
4b5ff93
update gem config and some linters
citin Aug 9, 2024
4128c2b
Update README.md
k4th Aug 13, 2024
ca15e56
Update README.md
k4th Aug 13, 2024
381f4d6
Update README.md
k4th Aug 13, 2024
a10d159
update dependencies definition
citin Aug 13, 2024
ff67041
adds error handling
citin Aug 13, 2024
4602916
Update README.md
k4th Aug 14, 2024
72606fe
Add tests
k4th Aug 15, 2024
10a1133
Rename variables
k4th Aug 16, 2024
e70ca11
Rename destroy endpoint methods to delete (#73)
k4th Aug 19, 2024
bbbf757
Update tests
k4th Aug 19, 2024
9a85954
Merge remote-tracking branch 'upstream/wip-v2' into add-tests
k4th Aug 19, 2024
4410f8c
Revert "Rename destroy endpoint methods to delete (#73)" (#74)
k4th Aug 19, 2024
6677db6
Update tests
k4th Aug 19, 2024
a5a7460
Add tests
k4th Aug 19, 2024
baab83d
Update tests
k4th Aug 19, 2024
4250ec3
Update tests
k4th Aug 19, 2024
a555f4b
replace destroy by delete
citin Aug 19, 2024
8758eca
Merge pull request #3 from citin/add-tests
k4th Aug 19, 2024
7d7de9e
Merge branch 'wip-v2' into add-tests
k4th Aug 19, 2024
776c62d
Add recordings
k4th Aug 19, 2024
fe61dae
fix rubocop linter
citin Aug 19, 2024
123457c
EPT-2950 Add tests (#75)
k4th Aug 19, 2024
028109c
Revert "EPT-2950 Add tests (#75)"
citin Aug 19, 2024
5dd203e
Merge pull request #77 from ePages-de/revert-75-add-tests
citin Aug 19, 2024
f40a769
Merge pull request #76 from citin/fix-linter
citin Aug 19, 2024
6a133eb
update docs, fix some errors
citin Aug 21, 2024
8341f7c
Merge pull request #80 from citin/improve-docs
citin Aug 21, 2024
b150767
EPT-2986 Add comments (#79)
k4th Aug 21, 2024
13c1056
EPT-2953 Add endpoints to upload images (#82)
k4th Aug 28, 2024
6dc1f65
adds services from authentication
citin Sep 3, 2024
e488f0d
[WIP] add tests
citin Sep 4, 2024
8c70b3f
fix dotenv for testing
citin Sep 6, 2024
922c1fd
Merge pull request #83 from citin/add-authentication-endpoints
citin Sep 6, 2024
fdb7ba5
Add customers endpoints (#84)
k4th Sep 9, 2024
dc83c3d
EPT-2966 Add carts endpoints (#85)
k4th Oct 3, 2024
1ee4d0e
Add shop endpoints (#87)
k4th Oct 7, 2024
3e7ccbf
Add webhooks endpoints (#86)
k4th Oct 7, 2024
5df83ed
Add endpoints for shop attributes and images (#89)
k4th Oct 15, 2024
3bdb42a
Add locations endpoint (#88)
kengallego Oct 15, 2024
7a93eda
Update README.md
citin Oct 21, 2024
a4e0b3f
Adds Storefront API endpoints (#91)
citin Oct 25, 2024
0bb065f
Fix params
unabris Oct 30, 2024
6a1796a
Rename things
unabris Oct 30, 2024
df4d042
Add product availability endpoints (#92)
k4th Oct 31, 2024
bafd0d6
Add products endpoint (#93)
kengallego Nov 5, 2024
87c8778
Update versions (#95)
k4th Jun 12, 2025
130b177
Upload image by url (#96)
k4th Jul 16, 2025
cf94613
Add variation endpoints (#97)
k4th Jul 22, 2025
7d41026
Fix update variation properties (#98)
kengallego Jul 23, 2025
d069da4
Add Search endpoint (#99)
kengallego Aug 14, 2025
2c2edd0
Add endpoint to upload external images to variations (#100)
unabris Sep 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .env.template → .env.development.template
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
CLIENT_ID=""
CLIENT_SECRET=""
SHOP_URL=""
4 changes: 4 additions & 0 deletions .env.test.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
API_URL=""
CLIENT_ID=""
CLIENT_SECRET=""
REFRESH_TOKEN=""
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
.rspec_status

# Environment variables
.env
.env*
!.env.*.template

# Apple file system
.DS_Store
238 changes: 36 additions & 202 deletions GETTING_STARTED.md

Large diffs are not rendered by default.

53 changes: 42 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ $ gem install beyond_api
API methods can be accessed through the client instance methods. This gem supports the various authentication methods supported by the ePages API.

```ruby
# Initializing the client
client = BeyondApi::Token.new(api_url: 'https://team42.beyondshop.cloud/api', client_id: '<YOUR_CLIENT_ID>', client_secret: '<YOUR_CLIENT_SECRET>')
# Client for authentication
api_url = '<YOUR_SHOP_URL>/api'
client = BeyondApi::Authentication::Token.new(api_url:)
```
## Generate a token from [client credentials](https://developer.epages.com/beyond-docs/#create_a_jsonwebtoken_from_client_credentials)

Expand All @@ -71,30 +72,56 @@ client = client.client_credentials
## Generate a token from [authorization code](https://developer.epages.com/beyond-docs/#create_a_jsonwebtoken_from_authorization_code)

```ruby
client = client.get('1nBfq_')
client = client.get('<YOUR_AUTH_CODE>')

# => {:access_token=> "<YOUR_ACCESS_TOKEN>", :token_type=>"bearer", :refresh_token=> "<YOUR_REFRESH_TOKEN>", :expires_in=>3599, :scope=> "orde:r prat:dcur pypr:cur prod:urdc", :tenant_id=>1147, :iat=>1723453179, :jti=>"C0N0VYQUgzchp2GGo8WaINhpM8s="}
```

## Generate a token from [refresh token](https://developer.epages.com/beyond-docs/#create_a_jsonwebtoken_from_refresh_token)

```ruby
client = client.refresh_token('<YOUR_REFRESH_TOKEN>')
# Client for authentication
api_url = '<YOUR_SHOP_URL>/api'
refresh_token = '<YOUR_REFRESH_TOKEN>'
client = BeyondApi::Authentication::Token.new(api_url:)

# => {:access_token=> "<YOUR_ACCESS_TOKEN>", :token_type=>"bearer", :refresh_token=> "<YOUR_REFRESH_TOKEN>", :expires_in=>3599, :scope=> "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd", :tenant_id=>1147, :iat=>1723453179, :jti=>"C0N0VYQUgzchp2GGo8WaINhpM8s="}
client.refresh(refresh_token)

# => {:access_token=> "<NEW_ACCESS_TOKEN>", :token_type=>"bearer", :refresh_token=> "<NEW_REFRESH_TOKEN>", :expires_in=>3599, :scope=> "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd", :tenant_id=>1147, :iat=>1723453179, :jti=>"C0N0VYQUgzchp2GGo8WaINhpM8s="}
```

## Making requests

After generating your token following the instructions above, you can start using this gem to access various resources available, including categories, products, orders, webhooks, and more.

```ruby
client = BeyondApi::ProductManagement::Category.new(api_url: ENV["API_URL"], access_token: '<YOUR_ACCESS_TOKEN>')

# Retrieve all categories
client.all
# Define the API URL and access token
api_url = '<YOUR_SHOP_URL>/api'
access_token = '<YOUR_ACCESS_TOKEN>'

# Create a new client instance for category management
client = BeyondApi::ProductManagement::Category.new(api_url:, access_token:)

# Find a specific category by its ID
client.find('category-id')

# The response is a hash representing the category details:
# => {
# :id=>"8a4a8f6a-e3d9-4616-9e89-12c42c084534",
# :name=>"DO-NOT-DELETE Category",
# :type=>"SMART",
# :default_sort=>"HIGHEST_PRICE_FIRST",
# :filters=>[],
# :links=>{
# :self=>{
# :href=>"https://team42-beyond-api.beyondshop.cloud/api/categories/8a4a8f6a-e3d9-4616-9e89-12c42c084534"
# },
# :category=>{
# :href=>"https://team42-beyond-api.beyondshop.cloud/api/categories/8a4a8f6a-e3d9-4616-9e89-12c42c084534"
# }
# }
# }

# => {:embedded=>{:categories=>[{:id=>"539c1671-1540-4254-adaf-8b22b188d6d2", :name=>"New Category", :type=>"SMART", :default_sort=>"HIGHEST_PRICE_FIRST", :filters=>[], :links=> {:self=>{:href=>"https://team42.beyondshop.cloud/api/categories/539c1671-1540-4254-adaf-8b22b188d6d2"}, :category=>{:href=>"https://team42.beyondshop.cloud/api/categories/539c1671-1540-4254-adaf-8b22b188d6d2"}}}]}, :links=>{:self=>{:href=>"https://team42.beyondshop.cloud/api/categories?page=0&size=20"}}, :page=>{:size=>20, :total_elements=>9, :total_pages=>1, :number=>0}}
```

## Documentation
Expand All @@ -103,10 +130,14 @@ See [GETTING_STARTED](https://github.com/ePages-de/beyond_api-ruby_client/blob/m

## Development

Check out the repo an run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
Check out the repo an run `bin/setup` to install dependencies. Rename the file `.env.development.template` to `.env.development` and fill in the necessary information. Then, you can run `bin/console` for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run `bundle exec rake install`.

## Test

Rename the file `.env.test.template` to `.env.test` and fill in the necessary information. Then, run `rspec` to run the tests.

## Contributing

Please see [CONTRIBUTING](https://github.com/ePages-de/beyond_api-ruby_client/blob/master/CONTRIBUTING.md).
Expand Down
12 changes: 6 additions & 6 deletions bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
require "bundler/setup"
require "dotenv/load"
require "beyond_api"
require "pry"

Dotenv.load('.env.development')

unless ENV["CLIENT_ID"].nil? && ENV["CLIENT_SECRET"].nil?
BeyondApi.setup do |config|
config.client_id = ENV["CLIENT_ID"]
config.client_secret = ENV["CLIENT_SECRET"]
end
BeyondApi.setup do |config|
config.client_id = ENV.fetch("CLIENT_ID", nil)
config.client_secret = ENV.fetch("CLIENT_SECRET", nil)
end

require "pry"
Pry.start
2 changes: 1 addition & 1 deletion lib/beyond_api/concerns/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def parse_request(hash)
def handle_request
Response.new(yield).parse
rescue Faraday::TimeoutError, Faraday::ConnectionFailed => e
raise FaradayError, e
raise BeyondApi::FaradayError, e
end

def agent
Expand Down
2 changes: 0 additions & 2 deletions lib/beyond_api/error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ def initialize(response)
super
end
end

class FaradayError < Error; end
end
5 changes: 5 additions & 0 deletions lib/beyond_api/faraday_error.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

module BeyondApi
class FaradayError < Error; end
end