arkad82x / magentwo Goto Github PK
View Code? Open in Web Editor NEWSimple Ruby-Wrapper for the Magento 2 REST API
License: MIT License
Simple Ruby-Wrapper for the Magento 2 REST API
License: MIT License
Hi,
When product SKU has slashes, the API does not handle that case properly.
Sample.
2.4.2 :165 > Magentwo::Product['4759119/104/OS']
I, [2023-03-08T14:08:17.251754 #17316] INFO -- : Net::HTTP::Get exmaple.com//rest/V1/products/4759119/104/OS?
error 404: {"message"=>"Wniosek nie odpowiada żadnej ścieżce."}
I can encode slashes, so it works fine for 'GET'.
2.4.2 :176 > Magentwo::Product[('4759119/104/OS').gsub('/', '%2f')]
I, [2023-03-08T14:13:38.125959 #17316] INFO -- : Net::HTTP::Get mage.libertymotors.pl//rest/V1/products/4759119%2f104%2fOS?
=> #<Magentwo::Product:0x000055ce6bb1c058 @id=19505, @sku="4759119/104/OS", @name="Komin termoaktywny Alpinestars Camo Neck Tube, kolor czarny/szary, rozmiar one size", @attribute_set_id=52, @price=119, @status
But it's getting complicated on the 'save'.
Looks like the p.sku is used and it's not 'encoded' properly.
2.4.2 :178 > p.price
=> 119
2.4.2 :179 >
2.4.2 :181 > p.save
I, [2023-03-08T14:17:52.582321 #17316] INFO -- : Net::HTTP::Put mage.libertymotors.pl//rest/V1/products/4759119/104/OS
error 404: {"message"=>"Wniosek nie odpowiada żadnej ścieżce."}
We are using 0.1.91 - ruby 2.4
gem 'magentwo', '~> 0.1.91'
I can imagine, that changing p.sku to encode slashes as %2f, will force change of the SKU too, so i'ts not the option.
Looks like the best would be to 'encode' the slashes in SKU in generating the REST URI.
Can you fix it on 0.1. ?
Hi,
I was wondering how can I skip the connect method if I already have the token.
Magentwo.connect "http://example.com", "user_name", "password"
Is there another way to connect if I pass only the token?
Best Regards
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.