Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ferencbeutel4711/4fcf54c2457189f604b1 to your computer and use it in GitHub Desktop.
Save ferencbeutel4711/4fcf54c2457189f604b1 to your computer and use it in GitHub Desktop.
Erste Schritte
<%
require 'aboutyou-sdk'
shopApi = Ay.new(100, '3ed93394c2b5ebd12c104b177b928ad0')
%>
<head>
<%=shopApi.javaScriptTag%>
<script type="text/javascript">
window.ayAsyncInit = function() {
// do stuff here with AY object
}
</script>
</head>
<body>
<button onclick="AY.openProductLayer( <%=shopApi.sessionId%>, 508247, <%=shopApi.appId%>)">
Artikel anzeigen
</button>
</body>
</html>
<% #Die Klasse AY stellt alle Methoden Verfügung, die du für deine App benötigst.
require 'aboutyou-sdk'
shopApi = AY.new(100, '3ed93394c2b5ebd12c104b177b928ad0')
productResult = shopApi.fetchProductsByIds(
[552223, 551937],
[AboutYou::SDK::Criteria::ProductFields::DEFAULT_IMAGE]
)
products = productResult.products
products.each do |id, product|%>
<%=puts product.name%>
<%if (product.defaultImage)%>
<%=product.defaultImage.url%>
<%end
end%>
Das SDK liegt als RubyGem vor.
Dafür muss zuerst einmal RubyGems installiert werden:
https://rubygems.org/pages/download
Danach das SDK und alle abhängigen Pakete installieren.
gem install aboutyou-sdk
<%
require 'aboutyou-sdk'
shopApi = Ay.new(100, '3ed93394c2b5ebd12c104b177b928ad0')
%>
<head>
<%=shopApi.javaScriptTag%>
<script type="text/javascript">
window.ayAsyncInit = function() {
// do stuff here with AY object
}
</script>
</head>
<body>
...
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment