├── .gitignore
├── bower.json
├── .github
└── ISSUE_TEMPLATE.md
├── travis
└── travis-ci-apache
├── package.json
├── magento-collect.html
├── LICENSE.md
├── generator
├── templateSingle.txt
└── generator.js
├── magento-collect-rma-rma.html
├── magento-collect-sales-order.html
├── magento-collect-tax-tax-rate.html
├── magento-collect-tax-tax-rule.html
├── test
├── static-api-results
│ └── products
│ │ └── 24-MB01
└── scenarios.js
├── magento-collect-quote-cart-total.html
├── magento-collect-sales-invoice.html
├── magento-collect-sales-shipment.html
├── magento-collect-gift-message-cart.html
├── magento-collect-catalog-product.html
├── magento-collect-sales-creditmemo.html
├── magento-collect-sales-order-item.html
├── magento-collect-sales-transaction.html
├── magento-collect-tax-tax-class.html
├── magento-collect-quote-cart.html
├── magento-collect-catalog-category.html
├── magento-collect-quote-guest-cart.html
├── magento-collect-gift-wrapping-wrapping.html
├── magento-collect-eav-attribute-set.html
├── magento-collect-quote-guest-cart-total.html
├── magento-collect-catalog-product-attribute.html
├── magento-collect-gift-message-guest-cart.html
├── magento-collect-gift-message-item.html
├── magento-collect-catalog-category-attribute.html
├── magento-collect-catalog-attribute-set.html
├── magento-collect-bundle-product-option.html
├── magento-collect-configurable-product-option.html
├── magento-collect-catalog-product-custom-option.html
├── magento-collect-gift-message-guest-item.html
├── .travis.yml
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | bower_components
2 | .DS_Store
3 | node_modules
4 | demo
--------------------------------------------------------------------------------
/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "magento-collect",
3 | "description": "A Magento WebAPI integration for Polymer",
4 | "main": "magento-collect.html",
5 | "keywords": [
6 | "web-components",
7 | "polymer",
8 | "magento 2",
9 | "webapi"
10 | ],
11 | "authors": [
12 | "Bob van Luijt (@bobvanluijt)"
13 | ],
14 | "license": "BSD-3",
15 | "homepage": "https://github.com/bobvanluijt/magento-collect",
16 | "ignore": [
17 | "**/.*",
18 | "node_modules",
19 | "bower_components",
20 | "test",
21 | "tests"
22 | ],
23 | "dependencies": {
24 | "polymer": "^1.6.1"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ### Description
2 |
3 |
4 | ### Expected outcome
5 |
6 |
7 |
8 | ### Actual outcome
9 |
10 |
11 |
12 | ### Live Demo
13 |
14 |
15 | ### Steps to reproduce
16 |
17 |
22 |
23 | ### Browsers Affected
24 |
25 | - [ ] Chrome
26 | - [ ] Firefox
27 | - [ ] Safari 9
28 | - [ ] Safari 8
29 | - [ ] Safari 7
30 | - [ ] Edge
31 | - [ ] IE 11
32 | - [ ] IE 10
33 |
--------------------------------------------------------------------------------
/travis/travis-ci-apache:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Options FollowSymLinks MultiViews ExecCGI
5 | AllowOverride All
6 | Order deny,allow
7 | Allow from all
8 | Require all granted
9 |
10 |
11 | # Wire up Apache to use Travis CI's php-fpm.
12 |
13 |
14 | Require all granted
15 |
16 | AddHandler php5-fcgi .php
17 | Action php5-fcgi /php5-fcgi
18 | Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
19 | FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization
20 |
21 |
22 | ServerName localhost
23 | ServerAlias www.localhost
24 | DocumentRoot /var/www/magento2/pub
25 |
26 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "magento-collect",
3 | "description": "A Magento WebAPI integration for Polymer",
4 | "scripts": {
5 | "lint": "eslint ."
6 | },
7 | "repository": {
8 | "type": "git",
9 | "url": "git+https://github.com/dorel/Magento-2-BDD-REST-API.git"
10 | },
11 | "keywords": [
12 | "BDD",
13 | "Magento 2"
14 | ],
15 | "bugs": {
16 | "url": "https://github.com/dorel/Magento-2-BDD-REST-API/issues"
17 | },
18 | "eslintConfig": {
19 | "extends": "google"
20 | },
21 | "author": "Bob van Luijt ",
22 | "license": "ISC",
23 | "homepage": "https://github.com/dorel/Magento-2-BDD-REST-API#readme",
24 | "devDependencies": {
25 | "assert": "*",
26 | "chai": "*",
27 | "eslint": "^3.5.0",
28 | "eslint-config-google": "^0.6.0",
29 | "should": "*",
30 | "supertest": "*"
31 | },
32 | "dependencies": {
33 | "request": "^2.81.0"
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/magento-collect.html:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
17 | [[value]]
18 |
19 |
41 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright (c) 2016, Kubrickology
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | * Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | * Neither the name of weaviate nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
--------------------------------------------------------------------------------
/generator/templateSingle.txt:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
24 |
25 |
26 |
27 |
42 |
--------------------------------------------------------------------------------
/magento-collect-rma-rma.html:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
24 |
25 |
26 |
27 |
42 |
--------------------------------------------------------------------------------
/magento-collect-sales-order.html:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
24 |
25 |
26 |
27 |
42 |
--------------------------------------------------------------------------------
/magento-collect-tax-tax-rate.html:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
24 |
25 |
26 |
27 |
42 |
--------------------------------------------------------------------------------
/magento-collect-tax-tax-rule.html:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
24 |
25 |
26 |
27 |
42 |
--------------------------------------------------------------------------------
/test/static-api-results/products/24-MB01:
--------------------------------------------------------------------------------
1 | {
2 | id: 1,
3 | sku: '24-MB01',
4 | name: 'Joust Duffle Bag',
5 | attribute_set_id: 15,
6 | price: 34,
7 | status: 1,
8 | visibility: 4,
9 | type_id: 'simple',
10 | created_at: '2016-10-17 13:50:45',
11 | updated_at: '2016-10-17 13:50:45',
12 | extension_attributes: [],
13 | product_links: [],
14 | options: [],
15 | media_gallery_entries: [{
16 | id: 1,
17 | media_type: 'image',
18 | label: 'Image',
19 | position: 1,
20 | disabled: false,
21 | types: [Object],
22 | file: '/m/b/mb01-blue-0.jpg'
23 | }],
24 | tier_prices: [],
25 | custom_attributes: [{
26 | attribute_code: 'description',
27 | value: '
The sporty Joust Duffle Bag can\'t be beat - not in the gym, not on the luggage carousel, not anywhere. Big enough to haul a basketball or soccer ball and some sneakers with plenty of room to spare, it\'s ideal for athletes with places to go.
62 |
63 | ```
64 |
65 | ## Immutable Store
66 |
67 | Immutable storage is inspired by [Netflix's Falcor](https://github.com/Netflix/falcor). If you collect data, you can store it locally during a session. When a user goes back to a previously visited page, it will first travel the local object to find the information needed rather than going to the API directly.
68 |
69 | ## Usage and overview of available sub-elements
70 |
71 | Overview:
72 | - [magento-collect-product](#magento-collect-product)
73 | - [magento-collect-products](#magento-collect-products)
74 | - [magento-collect-item](#magento-collect-item)
75 | - _...soon more to follow..._
76 |
77 | #### <magento-collect-product>
78 |
79 | ```html
80 |
81 | ```
82 |
83 | The complete product becomes available with by binding it within the tags.
84 |
85 | ```html
86 |
87 |
88 |
89 | ```
90 |
91 | You can also combine data bindings with conditionals.
92 |
93 | ```html
94 |
95 |
96 |
97 |
98 |
99 | ```
100 |
101 | #### <magento-collect-products>
102 |
103 | You can also collect products using filters, for example all products that start with a certain name. This might also be use to collect multiple products.
104 |
105 | You can define multiple filters by using a semicolon as seperator.
106 |
107 | ```html
108 |
109 | ```
110 |
111 | The complete product becomes available with double curly braces. The filtering work as follows:
112 | - Add `filter=""` tag and add
113 |
114 | ```html
115 |
116 |
117 |
118 |
119 |
120 | ```
121 |
122 | The filters and criteria are based on the [Magento 2 WebAPI Search Criteria](http://devdocs.magento.com/guides/v2.1/howdoi/webapi/search-criteria.html).
123 |
124 | ### The Mage-Polymer-Object
125 |
126 | The Magento 2 Object is saved following the GET endpoint responses.
127 |
128 | For example:
129 |
130 | When an element has the following bindings: `{{ MAGE.product.name}}` and `{{ MAGE.product.weigth}}` it will result in the request: `[RESTURL]/products/24-MB01?fields=name,weigth`. It will locally create the following MAGE object:
131 |
132 | ```
133 | {
134 | "MAGE": {
135 | "/products/24-MB01": {
136 | "name": "Joust Duffle Bag",
137 | "weight": 0
138 | }
139 | }
140 | }
141 | ```
142 |
143 | If a new call is done to the Magento 2 API it will first check the collected information in the `MAGE` object. If it is not available in the object it will collect it from the Magento API setting the filter for this specific values.
144 |
145 | In the above example, requesting: `{{ MAGE.product.name }}` and `{{ MAGE.product.type_id }}` will result in the request: `[RESTURL]/products/24-MB01?fields=type_id`
146 |
147 | This feature can be disabled (see (Installation)[#Installation] )
148 |
149 | ## Contributing
150 |
151 | 1. Fork it!
152 | 2. Create your feature branch: `git checkout -b my-new-feature`
153 | 3. Commit your changes: `git commit -am 'Add some feature'`
154 | 4. Push to the branch: `git push origin my-new-feature`
155 | 5. Submit a pull request :D
156 |
157 | ## Credits
158 |
159 | Bob van Luijt (@bobvanluijt)
160 |
161 | ## License
162 |
163 | See license.md file.
164 |
--------------------------------------------------------------------------------