redshop 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +7 -0
- data/Rakefile +37 -0
- data/app/assets/javascripts/redshop/angular/app.js +9 -0
- data/app/assets/javascripts/redshop/angular/components/home.js +27 -0
- data/app/assets/javascripts/redshop/angular/controllers/home.js +20 -0
- data/app/assets/javascripts/redshop/angular/lib/restangular.js +1350 -0
- data/app/assets/javascripts/redshop/application.js +18 -0
- data/app/assets/stylesheets/redshop/application.scss +3 -0
- data/app/assets/stylesheets/redshop/bootstrap.min.css +14 -0
- data/app/assets/stylesheets/redshop/pages.sass +38 -0
- data/app/assets/stylesheets/redshop/style.sass +2 -0
- data/app/controllers/redshop/api/carts_controller.rb +35 -0
- data/app/controllers/redshop/application_controller.rb +14 -0
- data/app/controllers/redshop/carts_controller.rb +10 -0
- data/app/controllers/redshop/pages_controller.rb +9 -0
- data/app/helpers/redshop/application_helper.rb +4 -0
- data/app/helpers/redshop/carts_helper.rb +17 -0
- data/app/models/redshop/category.rb +5 -0
- data/app/models/redshop/product.rb +8 -0
- data/app/services/redshop/add_to_cart.rb +33 -0
- data/app/services/redshop/cart_count_service.rb +27 -0
- data/app/views/layouts/redshop/application.haml +17 -0
- data/app/views/redshop/carts/show.html.erb +2 -0
- data/app/views/redshop/pages/home.haml +25 -0
- data/app/views/redshop/shared/_flashes.haml +4 -0
- data/app/views/redshop/shared/_header.haml +22 -0
- data/config/routes.rb +15 -0
- data/db/migrate/20160218231810_create_redshop_categories.rb +10 -0
- data/db/migrate/20160218232000_create_redshop_products.rb +13 -0
- data/db/migrate/20160219160430_add_attachment_image_to_products.rb +11 -0
- data/db/seeds.rb +14 -0
- data/lib/redshop.rb +4 -0
- data/lib/redshop/engine.rb +5 -0
- data/lib/redshop/version.rb +3 -0
- data/lib/tasks/redshop_tasks.rake +4 -0
- data/test/controllers/redshop/carts_controller_test.rb +25 -0
- data/test/controllers/redshop/pages_controller_test.rb +15 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +26 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/redis.rb +1 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20160218232316_create_redshop_categories.redshop.rb +11 -0
- data/test/dummy/db/migrate/20160218232317_create_redshop_products.redshop.rb +14 -0
- data/test/dummy/db/migrate/20160219160730_add_attachment_image_to_products.redshop.rb +12 -0
- data/test/dummy/db/schema.rb +39 -0
- data/test/dummy/db/seeds.rb +1 -0
- data/test/dummy/log/development.log +19208 -0
- data/test/dummy/log/production.log +0 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/assets/application-8f06a73c35179188914ab50e057157639fce1401c1cdca640ac9cec33746fc5b.js +13 -0
- data/test/dummy/public/assets/application-8f06a73c35179188914ab50e057157639fce1401c1cdca640ac9cec33746fc5b.js.gz +0 -0
- data/test/dummy/public/assets/application-e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113.css +16 -0
- data/test/dummy/public/assets/application-e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113.css.gz +0 -0
- data/test/dummy/public/assets/redshop/application-767f3bbb27116e6df97f26cb3467aa0b52140ac7f22f7783415ef6f61a51ecbb.css +2384 -0
- data/test/dummy/public/assets/redshop/application-767f3bbb27116e6df97f26cb3467aa0b52140ac7f22f7783415ef6f61a51ecbb.css.gz +0 -0
- data/test/dummy/public/assets/redshop/application-c0c359428cce620f3f7a27d013e827e8714951d6ae56d2d1f673688bfc028b39.js +19 -0
- data/test/dummy/public/assets/redshop/application-c0c359428cce620f3f7a27d013e827e8714951d6ae56d2d1f673688bfc028b39.js.gz +0 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/system/redshop/products/images/000/000/023/medium/iddoloribuspossimus.png +0 -0
- data/test/dummy/public/system/redshop/products/images/000/000/023/original/iddoloribuspossimus.png +0 -0
- data/test/dummy/public/system/redshop/products/images/000/000/024/medium/rerumsunteveniet.png +0 -0
- data/test/dummy/public/system/redshop/products/images/000/000/024/original/rerumsunteveniet.png +0 -0
- data/test/dummy/public/system/redshop/products/images/000/000/025/medium/doloraliquammagni.png +0 -0
- data/test/dummy/public/system/redshop/products/images/000/000/025/original/doloraliquammagni.png +0 -0
- data/test/dummy/public/system/redshop/products/images/000/000/026/medium/nequequiaet.png +0 -0
- data/test/dummy/public/system/redshop/products/images/000/000/026/original/nequequiaet.png +0 -0
- data/test/dummy/public/system/redshop/products/images/000/000/027/medium/nihilperferendisvoluptate.png +0 -0
- data/test/dummy/public/system/redshop/products/images/000/000/027/original/nihilperferendisvoluptate.png +0 -0
- data/test/dummy/public/system/redshop/products/images/000/000/028/medium/adabsit.png +0 -0
- data/test/dummy/public/system/redshop/products/images/000/000/028/original/adabsit.png +0 -0
- data/test/dummy/public/system/redshop/products/images/000/000/029/medium/sitdolorumerror.png +0 -0
- data/test/dummy/public/system/redshop/products/images/000/000/029/original/sitdolorumerror.png +0 -0
- data/test/dummy/public/system/redshop/products/images/000/000/030/medium/sintetcum.png +0 -0
- data/test/dummy/public/system/redshop/products/images/000/000/030/original/sintetcum.png +0 -0
- data/test/dummy/public/system/redshop/products/images/000/000/031/medium/sedfacilissunt.png +0 -0
- data/test/dummy/public/system/redshop/products/images/000/000/031/original/sedfacilissunt.png +0 -0
- data/test/dummy/public/system/redshop/products/images/000/000/032/medium/eligendidictacommodi.png +0 -0
- data/test/dummy/public/system/redshop/products/images/000/000/032/original/eligendidictacommodi.png +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/-38Mqdj5uX9SR8fOfinEvZVwgYPuorYNSZ4zrhZMDPs.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/-6yI9Iosab5jksr2iCGU5vloHIwb7hs-44nGPAVesds.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/-HSe7Uux0d8rY0s2CmSlwIkWd0I9EV7fcliaJ-dC20E.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/-WzIuOvjxS94_dc39kc6mJ4fIVIWEyKEeApbq-rHNps.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/-i2VVy8HuM0OR2j1q-bzEI711NjlkVLvcTHoJQkOOuU.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/-ukmfG_pf_-E24OLRDq9KmpukeMJ8tM6lwSAr6wFWo8.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/0LqAMDmi8lmeV6ylxcJxbflOt_MFixday4lNIB0k740.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/0MoOjylBxZi5mTbe17paGU2AJxcGzcpGkOUzsF5MqYw.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/0XuUV1frIoEU62jD8djyY1Lmot5TbuPJ_4UoBV651yo.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/0ayHMyFpx3wT0AFd7hynZvRJf_-dt8brOGws_2EGe_0.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/0b3mHT4yYQaqkf9zHohmmC_cIJCh1e93awdzw4y16ms.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/0jrOO_aa5NwAZp1vfLTBeDay4He4T7sAjzJRQHHVdMY.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/0uJq0soQEeaUYKjVgUzro3TxrhwLlknv__Qn4EnD7yM.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/1AC0zX3hMJxBmpG7Bhr03lJgi71rWg54hMYqDMkShZU.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/1l9gl52lqsuKnymQSUpSLUZI7sF6C1pPz_Qb93_tp9Y.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/21TD867q4QiBpo2Y3dWNHlK8FXP_VxhCveUBSP-4r0s.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/2DiTPxUbBxobYWFLXfnrAZBcFIycKf6WmqtU-Jji7wg.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/2YI6wHwgnuiDGLoa7IhQPgBJKXWZlYuFzlC5g7IeNm8.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/2Z3yj69fuqXA8XQ7uTYeOsC61CYeMEEfiBVEEWf_Sm8.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/2qbrfBWXHFXwf2syu3fehMt_hoEbdPgNkqVK5Wzu_bc.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/3ATDBPiFwjLOisOIviY-laSH62ZrpWIVMHlFAeTO2dU.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/47Juk3VNwtBjqoJJRpVANhSa8k4hnkfZlkNWKRrqitg.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/4H9GlMpw_dKrEZpGJokZ8NBM_L3BCLijADes5KW4GTI.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/4k_NT5OjPvzv5Jz49CrPKyVJX6b4EViZWaFZcya5o8Q.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/4qgMfCVG7eRDhSmbkmBBvMi_y5ggLygXPDyLp011dSQ.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/5AJvekcLzHuSw2UZlNY4UpcApf35KfMkm4WxNgoTzbA.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/5Ax6HL7cyP14nTmmhH-fGAEPja1xGlA144enh_wB-Fk.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/5Y7JPC1CCD1i8IzpgRqAJbkC23EBmfNiP-6aSeGiDiU.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/5jEqSUBiRrmJVOWoLLtbX2LlXldHEMs8RGk2WQRR8GA.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/6FklcUoIx_Rib1aKtjonxAJpV9exuAzkgBeTMR31f_A.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/6jK2nQg--UwECwcZnv-N2ms9CldSWJ7CroDUPFVj76Q.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/6jkfSqPAHMlKO3wuyxAX7dT4fwZVBcI1rg0kmP3o3p4.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/7-nr4DXppa5XhaXEM4xtLC-n7XazD5NjwkHzk0BaSxM.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/75BZCI0f-_fF8PkEhKJBMvfdH1FVB4Sfjza_ulPtZ6I.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/7X94fi2Xv0RwIIrCRwRjFYZpEaDVSxM8M-76qjJ1AwE.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/7cAu_onlWEntyjXKnDCBTqPgI8ApRjhL0HwrS8m096s.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/7hOmdxiBTi2viz5fiheEJDeqmf6rVShKL_gyhJGwVAE.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/8NKjyrCMoZ4DQzkwbyv4xRbdGCt7R7jnJ4Bfqdj8sZA.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/8Ug-wu_M0m-4ehQUmlKfN1ekZM9lZV2GGqsAOyprFBk.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/8mkiwGZtFzcQFEZFNg24I22ogqmzzxhQoC14ow1ZsaU.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/8qgC1JRrICpK6Iy9XL6TrDrLPzYts7GHYwhLIUUc8fg.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/91bk1eP-37sQ_2FYC7tRMcHPlRFQUS_b4fWKUGRdk8Y.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/9ciLxfvuIZJnLDYNqY1566OJ_csVJznqNm7OvXhuSZ0.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/9iH9UPIMV4S-7qKHkbpobZfYIsOSz2dZWKQfO9sYDgQ.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/9j4c42KXv-1ExeJw0RjngBtNNUzWII5Cbx1pCbnuORg.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/9lTKpOF5TmBuzFrpz1hz7mmpALP9UrQ3PU4Oh-WWfus.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/9w3T5Sbx3TgBltfwDYIulisLj4uQkGRzLYtmzBxmIhc.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/ACUSUG-WcBcqBKYliafQ_zQuVDbzv0Vtk3s-C99Zx_Q.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/AeL6tnlElijp8AlHpj7Od6rKwGP3gWTVVnqt8fqbGxQ.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/B2gtyazm1lMSNsEef_-0HVzMUizfFoetlyqAAjlgK7Q.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/Bm32K7CT4qc6DxRU16nGckM4OuMWFOg9Gn3rTVI7MCE.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/C6_1pUEkAgAmLZSrYJoKRT83WG-XeXsCssC_zqIgRD8.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/CRJd1wjN5gdU56BQMxlZLzxp0i7tt7k71cG0t5QiwOo.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/CTmAO8Y3Ld2HYq9HmfDqWk35n4fp64GZBRQvgc6-t-U.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/CbBrjFWPHPW2f5jkiQlY1hIATn18OfIz0BPtQpZ2BFU.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/CeS23X9ftX31LuBolc7WzLwwtNnE3rBd3BSWnToWVNM.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/Cm2YazIr_jbRHxgPnNgiVW2y47n17SmejALAFHDnfD8.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/DOLNGXM3EjNpFhNQvXliHakYP8sH195Hcn3AaT5u3lY.cache +4 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/DfqvOmejSuUzmTwvD9Ql1yje_1gHtqeNQZ6XmmtMMQs.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/DtLZrbZrYVYkqRf--MzPM5LGPSHLLONjWhZ682BnD-o.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/DzphQHsnGZIWsibUssKFL0znmRxdsX90l2bnMdEpMVg.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/E16vRx208LkX-v7ojCtPDsEsDl3anRPfpHQRRKACXGI.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/EEIrCRSfIYDDLASduT8hdYIHIOj5q-onZB1rUi0zUbs.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/EUv_bEcSHTF5RmZY1nQBc-w42zTXEIj8Ta1-7Km0tFU.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/Eu2rLWjuqD6X-bU3sygdmJB7TCLs5rF-u9cIcwhzzH4.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/FBIeiKg4NU08B1qrkdHfd8AfjHPklBSD4JndF1j6eo8.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/FgnlOxGgxhSeWhNeGbP8M75c3OJnW6-nkBnnfW5bBLk.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/FpO27e8TaeWWqPytjzqoRortNnny6JkrRfzTUlBxJa0.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/GJJEPf6oBbDKQ6HjfEZiOt2BywKnwIJRJEC26VcowgA.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/HOHQ2s9qbEUuMtrtnXlRk5cZKg8B_GKjHY0EO9WMW00.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/H_EfGDQlFv8l3a4S4j3VJWdpUWmBKzuu440ccWslbD4.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/HkqEcQvNBAOSAo8bzM_QE7TpgTgOyBdVAyQu1hIB-sw.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/Hs-n-XytEDmQ0D0hZQhPAgWYLPYXQllOMrV9QPT30Wg.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/Hs0yaBGzcAUwhfSL0IoGD2tNM-pn1ZGxYuUCDzLD5NM.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/Ht2spLzjuHpF-j_kRnujNfYzJ8cB9NcNmYyJ2zmjjOk.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/HvxiabwVXgXmbBOHfzG9qthEleKkle66DndtFMT_CmY.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/HzeW1wVb9eiFAaVh7JVup7ERTXbpZNTSSwbKU72F7dc.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/JS_GdkmeRYiRTry9qhEkLw32QngkX57jGLaMjV3UL74.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/JuGGozsIZ-C0frzuaNIel2Ico1zjvUDRWbPJzS0hNTA.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/KDAnHacyqNUQDi1fz6m5KEkY5Wkgd33SeoPD9P4vEJ0.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/KNNL5_WAFn8P1dRmN-heD6h4wnDIHxTiG_gglbzOzCs.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/KPp_zTZuJAB4hVqBfny8xhl6W9KPlo5cDwk4uwxzjJE.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/L7HF1M3k89TZdMxDMaLrUZGRopI1xU2L-aQpepkowC4.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/LM2yM-90bb9is2YEI9_wTK5Xy7N8gp0CDI10hPTSJNY.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/LMuwGygDaT5EzMuiv2Iw-_PAgqBWzcpXBchapp7TSrw.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/LVrub1Fjs6f4t30u5KlC00O8cW-N9r9BBWufRrHE-Xg.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/LWa5u5nX8O9YffzBG8ccoGJdlB3osL9Uh0qh53W1L8U.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/M7yoLbDcq5T9UvlHpnJ1HJX2UQqPQvFqFPfLpZdk3G8.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/MeG0yz0sBwtgd5iIgb27KVwWhG44qbCc-Bb4GSSt0vU.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/NDeufIc4Vf_5VzuJJVuziUS7vwP2J5Mo8gaF0s6Jg0c.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/NDfKCyrgIhCfRuPQCjMSYLIyuF0Hfv3FGYhdREUGNSc.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/NFmH_jMK-MI6v1usEuqP1jY3zpwgDsy4FM07spcAzTE.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/NbrNVS-ofhR3xemWuab2ISCpwsHNBAx1mfPbR5FtjMY.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/Nolzo_aYeTj6Br9AJgxqRws8LNySRp7pyFVeVKHHXW8.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/NpikdOW2C01yhS6Z9NQwS12EABJeUEhRMqIo9wTnThc.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/OBBI88mqejRUgSJ19aT858v5KRWSQgzvS-R7MrAgudk.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/OJszhLDlhEdnE7CLZQXb5Y53djKX7kmJQFq1QifkaSk.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/OOoQPDlaeWFQLIpW2RpzR4uO06NuvBQLrOSDUnXfhl0.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/OU0gzc8I4ziCG58bWYqg5lJktSfLcbcWzRe-n4GgLUk.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/OZcs-_vS1KlB-IXgG6s6OsEbJ-mUvsMv1gUD0FnxTdA.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/P2lqicj0kUGjfPwJK2Jq8vcQeHsk-pPdp0avQLxoCYs.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/PCAQyPEQ5Aw59iPfW3fI5ma7LIonKYqwctRdMGOrkUQ.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/PowbErqeXtPqdcgRKNwsbDAyLyTwMk_9tjXMlZ_dHGk.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/PvwsoMNc62n2yEeG_JWAnOVy6ZtH5wmhLzouQsTXYXo.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/Q-zs6kXxjN4HRrwOftqBMGxjYTeHwawozCFHHGENgDA.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/QCsiM_-OPDBOYhlmpQ8o8FqZAtM7n-7EWE_XNBTcP1I.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/QLTKF5MPWQCuZw229AK1mSpV_fGKSJP2JxvfaxsgLKI.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/QS4hhaluHKsI8FAuiymGZQEMNAZfHpg-5QB2ULhdHDA.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/QdrU4UUzBbaGZkIsfzAMa_g5TiYGHreHLwNkz31-orQ.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/RBg4V5qry8dm4B6GZlxKxK8GCGAP7NhdrvsmN0UyoSo.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/RcmXJFgdst6F9RuAcac2lXufOTOhEJ93535zUbk9_zE.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/RnWB-DyLgB2GuxKAw3uLW8-rR70yVQt7KtJFO-b-YZM.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/SN6AOu_o4cX_Coy6E1FKGldtNLT-BmNduIjseWQ81Ek.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/SRrCq_7hOhpmSWLQyWN8UsEkCghLoCzrDsI-1rgBs9I.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/Sr8NUBkZsZHKa2BIhzbC23sT8bC4LMquEmoH0qqEp_E.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/TDYpOeyCmpHpMW-JCagaHWf-EZPXQ8H1MPmnBhdgT_8.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/Tg2LG48oFfVfk9ccdJwBJH_BgJRIERGxiNGDFfY10qw.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/U8_3O-UYSVW6Y3F9Tl7D6Tz5jrPcrNmKOj5wbKyxA9E.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/UBoKFZEr2MIezXFB1UP-jRSbSA-BglhsNM1uwOkIgY8.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/UIFQi9wgEJnP1IIjBntSwjPm-Oyz9MXw91J-A04Tm9A.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/V6JsdrEoX-eOPWgfqPiZ-dzq739s5-adePNWxDiWWiA.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/VKYpksnO7_36fMpY9xEFDESVmG6D9D-sHKZWI8X2uAU.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/VKiC82K1a7wMexJkfqzb3B4HDzngKHM5as-Fraqa-m0.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/VMcXH4J2l0EjTUVKfmbLVJwXkF1QrHrwFg5ydmc4Clw.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/VWhb62TMkvSYCYAQ3eHh64GJCuXp0Is03DKlbU5NiV8.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/V__idWMSLZoC91-xvUMIFf-dsezg7T433y-sOSwaO3U.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/VuVPpRps96lIRLdvlUc1DvXxWnAjjXd9NjJQ6ZicfL0.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/VzoN38Q_75c1rQuM3EWhW6RFccEodItAn-RKFv3zr8s.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/W4jmd_av7Q5Sj3BNbBNFNwxjuZabmf8lMjvReZFYY2U.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/W7IMZ5JfNED6NUMXkCZAIa2kBNEzdvhzdOaE2m6CT6w.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/WEbjn1M1FOuG4sWFIG67Yx8STkUYealFa0NeL6mRzjQ.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/WOat77LskgD6RqBQtEx0GZ3nKDM2qmoTsQRamaVilmM.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/Wd2EyMb3d_BiqLtVnuSLY-Klopurnzb9iowzbLMT4GA.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/WpAnAoR7o0gCD4IjvBEWny_hSW6adN_iq3lNG4HR48w.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/WtzjyUupcSMH7wfkkaacSvEC40RuVeyJQwdR8ethABU.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/X2o1AMSd0fXr2hYEQ_-xtIrhw-xZwqwMYGjNmJjqCrA.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/X6KB9gPSxHI-tGidQEno1yKNv9pRB7y9Id5Yzzm49ag.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/X9KaTro0Mqsr9wtRuX0u53wEOveADEPZKfm5QSlptjo.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/XJh9yUZ9oMTg0GrsrvJk2lHfbPuaLEGUomB0Th99bpc.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/XKFX8g9Zv8Q0sSTwguTDU8nwHZOdiJ6rJia3G7Y2c-0.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/XPO7YTUR5gESxiv_b7TZkA6X1LXz7_YyMaFdy8LAu9U.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/XolO9YIO0f71Vz2OeVvjeoxHrdc4Mp5_uGyCJVNOKtA.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/Y5cguNxbZq15pmmKUlSHAT4ZfpWynrPmazNSrRiQ_S0.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/YAC51rk-b0MMm5pfyrGAieUnpPce5rPLtxi9Urro_B0.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/YI9BkmN6nXXDcpnVGpiQY8qJNnh40_cLemGFXpaJi38.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/YN8MdlRreL3Ne18ZySMwPe_XLZe5yW1i0JOkYM-92Rs.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/YNWnD4jkcre04ymHXILnDh9etzBy0Oka2exbjlbJMe0.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/Yzbhi3fTzewEqb9B78jRDVWFm__pWnp_BA1jHxLWkMk.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/Z64fsGShNKgovOcJcKZKzMXSozJXJIht4IbAut8zbow.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/ZMf2hqaXws8Sap5-MBFiut79OlOezeHE0T6YDiQwTAI.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/ZUjSadTVfDOclIeuxKr3YWM7TVudys_M0v2u7EuN5mk.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/ZsLcG28danPmDpzODXoEOPo__cDRne2x36EYDxbBshI.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/_-0afD1OtMBaOHcZCDoYT73_y47uh02p-3JXRUtkrXw.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/_35X3vi1zpt0fb3wrGrYGFbb6jT5lGGiOTApDm_n7Bc.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/_Ip2Of9aq0XSf-Izp1o1kwdHfWhQou2UU2tMNOLEoqA.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/_MVqRc7f6X1AUMemuLRPNioTQuAN7icCfqAiGoGUFo4.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/_jYVeheqRRNTKZYkOoze4rGT8JP94hJfqnlu20ONpDs.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/_tU6Iu45Gmf8SSzsaECryzRWwKzt4cg-LQj3XzSBcsQ.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/a95rURfjgPRAsKS-7tSJy8r0-vf9HxbkwdH2Dj6TWEI.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/aPIIeF9Nt511fi8ilaMIR2yEfKDye-UVlRRqk0x1ctY.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/ajNXZbLeGVYWOjwj0ch-rbz-yMZyD3sh8d2AeQjdJuI.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/aylN9mh7ydYTcWh8crirlDfC-3EvKFuVex8BfNs3w0U.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/az8LNnfnQkzvlvZ5AKWmxnYeC-JQTc5zDr7bSq5H-Mk.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/bSrEBdsGoC-C1224gW_ny0-2I9_1kZ0kxSTK4hY7vnI.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/brmxaY2awO6olJoBRp5q0pVD4DEwX_tC4CAPSultjVY.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/buoGoCqeS5vW2VWQxHWNv4S4erch1JlA_1LM-Gjp4XU.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/cMa12d00qVWDCq0YBkTiwVjeGtdpPTT8z0Lacj90GUE.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/cjgUPFKBA5hdI_sPtm_PpNyK1BUF-VOrYPEZ_0Idi8U.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/dDQYvyq0ZWt1ej5a2jsaNmrePQt3gEiHHgijmOD26mc.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/dMFywlCbPGkyJ5k8jrIXsjFGsydOcc09Qa1E8voK2eg.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/dNA3tTBzJp17JwMb-95vPIL2BDhPIZP-d_k21xi0VA0.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/d_MKaD2T8mP5v9yp0Cwuf2tZ-CeYLxCUefg9YN4wQSs.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/e9wqHi6Ab2R_zrT1s-YYGcIo-DcM-qjQG7Q3gH9ADQU.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/eCowDJA6KhFjkh_1WF71Vv9s--6wMJSEQBNb9ySxskk.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/eL0LQVdm83MMyJR-FnLDm3DkAD959an5tokAHZQXGY8.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/f4K1pHYp9JxAPVdUrMDdPwQkR267eOgjj0I_CgjStJg.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/fEP4HsX-frQeynP0z6SJXjS1I3mZSV7uF4CKlZGdUpg.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/fFMeUG5ZFBHQMqgve3_QfSpWvbS3vXRvh7iPbOrFF9Y.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/fRctDor4YXbAf90cfdDhHR5WowgUxo_6bW5B4wCK7sM.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/fiqQX9xiJjYLckpFQuMq3OGR8KNQ_r3Z4lwcxsgZbJs.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/fpl3vB4DJXHg7JVbDLj5K8r8o2-kkYVpe1SUJRW8OtA.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/gDqID2T5pHTi_5f9ynaL7evi2PZ0QqILoSu3N0kvGi0.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/gSSbe4rbu3aH42DGbvsrl_ilQsFSQX5LitnVaOMUmfE.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/gwnx57kQ24mmYF0LHhkUnjN2SkcI-KO55IqCMxDLfgc.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/hEurT7UbSQxAoWSTzaV-ORtqqMG65d7ChHDFmKkLOEU.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/hTunyXipxrXKaJByHoQ_tOF_BcPxUrJOCjtsNO-oMNs.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/iOU1MwS-aj0m8QosuMz6GQhk-crUTtbvJoGKU5GMQus.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/jeOmEHQmNXesQiWz0ag8AkN76Zi_i2Wvle-Gnt4DAnk.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/jzAUwei2JQ8EKzwpzw449o1wjyDiDhb-2n3kwrBUeLk.cache +5 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/k_T2EM_2wPPyud9d0cYgo4w21wZJAsxltYMVRoC9ZKs.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/kaRK4SE0AbgZ9R409rhyYE3b98d1T7clH9WUV3k_oKo.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/klLVt1bi9VaUqOQLCkehLIxRYBl1V618_Qz05rTlVVk.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/lHVa42KAzBU7O9g8LmTIZqT3lNd-IpPS6y_cOw_XHwo.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/le99PY3UDyVKIiiGPVjBifg34HdjyqeSendZE1LXoEo.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/lkJXbEXjis_5Bcd20ENKKMJqY7bKX-nb40nPxtV9ZkQ.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/luAzemVCnM2BidiwJGvBwrrR0V86QyMseeSgt_SgeT4.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/m97lv_wvDmgAAswS-p8ADZSKDqIyughsd-GJ3bKn2js.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/mUjkDq-ga9QiqwMinHwVwvW1oxtgUe87T7HAFGPyGwM.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/mvpWy-YO1Ww_MS5_oBRAgq5IUDnAJRKdFwWfkP-gBDA.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/myT1xjkTllZx_KCovuuL5J8DDg7JZJjprm0njVmGa04.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/nJmDePB0VrVbXIbfTmvuTUQnYvEHEcyrB4bHfaE2EFs.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/nLeQUmt2QWJ6x8BuVBWlFJDe7ylroMj1VTx3GQwVmOE.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/nMCDeTKLa1gsbykA0eWa7cYRJ3dP3gNfxRpfy9xKpSo.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/nfJ5Utgk3A08lcKYUI4_NsL83zrBH7K_Ig0bYXI0YWw.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/nv-jSJ6waisJ3UkE9uBz85VEhAMsBV3vMehMNTaSBV8.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/o1pyb-uAJSvm9bOfNvyDp-Kx22cQvR6D5TAFOsot69o.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/oMw2QvGvD9GK11wMfdfEvj-wytmtCRlf7zu8O3svBDM.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/oNY31dTF5K21LJoQr0tM0yRXnhVbFmKNNJvY2Td6NbQ.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/opK0mT283G2lul-x3qk7ceeh6eonc1uQHTZLldEcHBc.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/oxvOG9iHMnn2h0KzPY09-Inyd80fOe0weREBdWSthdo.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/pRRMGsT-4naFYHrBR_JvH3MN9iGfZPEqa7BN1OeWF1M.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/pv3TNUHI9pBVxCopIenyWctiyRO0lTVjCRla8CG95LY.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/qq1wy7MyCFEAWNVvZNQNP-ZRTI4qs12XZGYMdby0KGc.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/r8PNc5UlUe39EGAX0YYd9IH9_8fJSMnAvjDxBPdgOzM.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/rCmZ_H1ZvzbLW7b7kPZ6g3GaYo-UmTfQlP2-OnwPWGk.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/rNQivq8XZ3azRbRAPj9-IyXVySaWleVpcjK0O-5J9Tw.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/rzmu6FCTsgOaxIXTCwzIqTZrdpaS-8rcSs3PoLIA1kU.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/sFi7XoMYMvsCQFy_Ha2nnkJaeLaR_4JFhZp2WpLtJm0.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/sLDN0KwXlXLBeN8hSc-EC72SqZy1bpPFlcGbeatm-fE.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/shs0Dp_nfsJEb6OAlNra3tAg0VHonv0rboq4Iql_hUw.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/sntb5KUGkiAfhPAT0DHStiWgNZcbISgJM-JQTmGORRg.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/t8u0nWUug4WtejziM036ccUOOf5KyL329v_7UvhbVS8.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/tGMFTdr6byjWn5siuBRD9OkZfKQoeENSKojsoGYS60E.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/tIXs55n6t8F1lgjiblz4HRn_N-VGGtQvroojuN6yelA.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/tLA1DwXj-Odd-1VNvFuMtbN10_peKOYIfkpE7CFtbK8.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/towwb2cvZkbabhlgsLgdb3SBQCHip2evO4kMlpZVf_0.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/tsokU9dtas4OFBG3XAVhwlrGSi72UhcdW1cyKDhqc8c.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/tu4FO0BienUmIjqF5D03nmOkFM1TnymNORxAy3OpumA.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/tuWQcn_DL1uWX_sm6g5k3nRcKzj9LnnR-eb9i7UsEco.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/uFqCXQUJf3W0KIwfEU_tTG0xm0x3t9U0sE2FoXIRB4A.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/uH6Qhrf8JnNhyZ979PYXrpURpwWN1MfnlmppmgJp_uU.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/uOzF5L3zn9m8l9rGxH3xOdJsI-n2DxMDMFg1wZEAP0k.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/uuJxHpo6-K5t0uH9m6SfI7hQZWtxvoLKiJhgV69D3v8.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/uwMiLyLP2BMZ76ZGs5GZjgjJaWEU2_jTvD5LIc7lo5w.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/vppAAlLV4sQfFROFZzZmvf0TG0lzdKw4S5BjWrPNABA.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/vq9-A7e_CBzRbtKcytwdHP8-R2QEiNpe6BxN1sUpwNk.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/wI4NJR1uH1zTGqbqYgPtM8nvAqhkoUeIldMCIyvxARo.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/wVq9UNb6-yLZLQPVVsunvAJR_qtYxbcKz20mWhhacXA.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/whfj5JaQ-Il6_8sH8hgOR5pdyjxMoabWSHVBpfiPgvk.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/xXKgEj1mGeXr-aLvYUnxzy9HY376PVsJE8-oT0sBvyA.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/xwFdh4EUn340xtyQ9QQ703Crok_waCE651_rTAI65ME.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/yDWvAwOmkscIGqCJx9hnPujLfwHamk8z3C0pzn6yLqs.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/yHrlJ72762MNOjZ0N_HBX3EMGv-LK05H99ZBLIC7_54.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/yQZ8QLlGRykgwR4EUi2ZDKzXdW5LlAr6gFM2IRAZ5QY.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/yTXsra_hwF_yidCdaA7m_fd0bMRcMButUPwEyCmiHdQ.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/yl41YvjlQ7RNmxiPmB4YMww7LHdus_lpaF94lkU4ktY.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/zCMrwQBiqIv5yn-BB0OdAhdSMYcdhIXhVdQZorYn9Jc.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/zuMR6jGTP6rSQSVTdbUXZHUa3-GXinjREMihW2VjA2s.cache +0 -0
- data/test/fixtures/redshop/categories.yml +9 -0
- data/test/fixtures/redshop/products.yml +15 -0
- data/test/integration/navigation_test.rb +8 -0
- data/test/models/redshop/category_test.rb +9 -0
- data/test/models/redshop/product_test.rb +9 -0
- data/test/redshop_test.rb +7 -0
- data/test/test_helper.rb +21 -0
- metadata +1052 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f3cdd11f2ce86777b9ed199d2dabec6db20ca401
|
4
|
+
data.tar.gz: e153f0e3541be56a4b12f3b0f4caea8662f702de
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 99a21aa67d889de1f1d02316f7372538c7b0ea4da921b0b76d92e48f07b7c0ce03ca58efc27c806eb5e29a4a9bfb766a60983315301e16adba215c2e462e8e45
|
7
|
+
data.tar.gz: af1a724f898c9b6d814b0568fec1148cbc83551e8e09a1f0be40034a7844fc64cb4023d2f4112e19aa164a5379acce48628c14e30d13e62f324d47a8d67b42a1
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2016 Vitaliy
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Redshop'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
load 'rails/tasks/statistics.rake'
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
Bundler::GemHelper.install_tasks
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
28
|
+
|
29
|
+
Rake::TestTask.new(:test) do |t|
|
30
|
+
t.libs << 'lib'
|
31
|
+
t.libs << 'test'
|
32
|
+
t.pattern = 'test/**/*_test.rb'
|
33
|
+
t.verbose = false
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
task default: :test
|
@@ -0,0 +1,9 @@
|
|
1
|
+
var app = angular.module('Redshop', ['restangular'])
|
2
|
+
.config(function (RestangularProvider) {
|
3
|
+
|
4
|
+
RestangularProvider.setBaseUrl("http://localhost:3000/shop/api");
|
5
|
+
//RestangularProvider.setRequestSuffix('.json');
|
6
|
+
//RestangularProvider.setDefaultHttpFields({xsrfCookieName:'csrftoken', xsrfHeaderName:'X-CSRFToken'});
|
7
|
+
});
|
8
|
+
|
9
|
+
_.contains = _.includes
|
@@ -0,0 +1,27 @@
|
|
1
|
+
(function() {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
angular
|
5
|
+
.module('Redshop')
|
6
|
+
.factory('cartService', cartService);
|
7
|
+
|
8
|
+
function cartService(Restangular) {
|
9
|
+
var service = {
|
10
|
+
addToCart : addToCart,
|
11
|
+
getCartCount : getCartCount
|
12
|
+
}
|
13
|
+
|
14
|
+
var baseUrl = 'http://localhost:3000/shop/api'
|
15
|
+
|
16
|
+
return service;
|
17
|
+
///////////////////
|
18
|
+
|
19
|
+
function addToCart(cartId, productId) {
|
20
|
+
return Restangular.oneUrl('cart', baseUrl + '/cart/add/').customPUT({'cart_id': cartId, product_id: productId});
|
21
|
+
};
|
22
|
+
|
23
|
+
function getCartCount() {
|
24
|
+
return Restangular.oneUrl('count', baseUrl + '/cart/count/').get();
|
25
|
+
}
|
26
|
+
}
|
27
|
+
})();
|
@@ -0,0 +1,20 @@
|
|
1
|
+
app.controller('HomeCtrl', HomeCtrl)
|
2
|
+
|
3
|
+
function HomeCtrl(cartService) {
|
4
|
+
var vm = this;
|
5
|
+
|
6
|
+
vm.test = '123'
|
7
|
+
|
8
|
+
vm.getCartCount = function() {
|
9
|
+
cartService.getCartCount().then(function(res) {
|
10
|
+
vm.cartCount = res;
|
11
|
+
});
|
12
|
+
}
|
13
|
+
|
14
|
+
vm.getCartCount();
|
15
|
+
|
16
|
+
vm.addToCart = function(cartId, productId) {
|
17
|
+
cartService.addToCart(cartId, productId);
|
18
|
+
vm.getCartCount();
|
19
|
+
}
|
20
|
+
}
|
@@ -0,0 +1,1350 @@
|
|
1
|
+
(function() {
|
2
|
+
|
3
|
+
var restangular = angular.module('restangular', []);
|
4
|
+
|
5
|
+
restangular.provider('Restangular', function() {
|
6
|
+
// Configuration
|
7
|
+
var Configurer = {};
|
8
|
+
Configurer.init = function(object, config) {
|
9
|
+
object.configuration = config;
|
10
|
+
|
11
|
+
/**
|
12
|
+
* Those are HTTP safe methods for which there is no need to pass any data with the request.
|
13
|
+
*/
|
14
|
+
var safeMethods= ['get', 'head', 'options', 'trace', 'getlist'];
|
15
|
+
config.isSafe = function(operation) {
|
16
|
+
return _.contains(safeMethods, operation.toLowerCase());
|
17
|
+
};
|
18
|
+
|
19
|
+
var absolutePattern = /^https?:\/\//i;
|
20
|
+
config.isAbsoluteUrl = function(string) {
|
21
|
+
return _.isUndefined(config.absoluteUrl) || _.isNull(config.absoluteUrl) ?
|
22
|
+
string && absolutePattern.test(string) :
|
23
|
+
config.absoluteUrl;
|
24
|
+
};
|
25
|
+
|
26
|
+
config.absoluteUrl = _.isUndefined(config.absoluteUrl) ? true : config.absoluteUrl;
|
27
|
+
object.setSelfLinkAbsoluteUrl = function(value) {
|
28
|
+
config.absoluteUrl = value;
|
29
|
+
};
|
30
|
+
/**
|
31
|
+
* This is the BaseURL to be used with Restangular
|
32
|
+
*/
|
33
|
+
config.baseUrl = _.isUndefined(config.baseUrl) ? '' : config.baseUrl;
|
34
|
+
object.setBaseUrl = function(newBaseUrl) {
|
35
|
+
config.baseUrl = /\/$/.test(newBaseUrl) ?
|
36
|
+
newBaseUrl.substring(0, newBaseUrl.length-1) :
|
37
|
+
newBaseUrl;
|
38
|
+
return this;
|
39
|
+
};
|
40
|
+
|
41
|
+
/**
|
42
|
+
* Sets the extra fields to keep from the parents
|
43
|
+
*/
|
44
|
+
config.extraFields = config.extraFields || [];
|
45
|
+
object.setExtraFields = function(newExtraFields) {
|
46
|
+
config.extraFields = newExtraFields;
|
47
|
+
return this;
|
48
|
+
};
|
49
|
+
|
50
|
+
/**
|
51
|
+
* Some default $http parameter to be used in EVERY call
|
52
|
+
**/
|
53
|
+
config.defaultHttpFields = config.defaultHttpFields || {};
|
54
|
+
object.setDefaultHttpFields = function(values) {
|
55
|
+
config.defaultHttpFields = values;
|
56
|
+
return this;
|
57
|
+
};
|
58
|
+
|
59
|
+
config.withHttpValues = function(httpLocalConfig, obj) {
|
60
|
+
return _.defaults(obj, httpLocalConfig, config.defaultHttpFields);
|
61
|
+
};
|
62
|
+
|
63
|
+
config.encodeIds = _.isUndefined(config.encodeIds) ? true : config.encodeIds;
|
64
|
+
object.setEncodeIds = function(encode) {
|
65
|
+
config.encodeIds = encode;
|
66
|
+
};
|
67
|
+
|
68
|
+
config.defaultRequestParams = config.defaultRequestParams || {
|
69
|
+
get: {},
|
70
|
+
post: {},
|
71
|
+
put: {},
|
72
|
+
remove: {},
|
73
|
+
common: {}
|
74
|
+
};
|
75
|
+
|
76
|
+
object.setDefaultRequestParams = function(param1, param2) {
|
77
|
+
var methods = [],
|
78
|
+
params = param2 || param1;
|
79
|
+
if (!_.isUndefined(param2)) {
|
80
|
+
if (_.isArray(param1)) {
|
81
|
+
methods = param1;
|
82
|
+
} else {
|
83
|
+
methods.push(param1);
|
84
|
+
}
|
85
|
+
} else {
|
86
|
+
methods.push('common');
|
87
|
+
}
|
88
|
+
|
89
|
+
_.each(methods, function (method) {
|
90
|
+
config.defaultRequestParams[method] = params;
|
91
|
+
});
|
92
|
+
return this;
|
93
|
+
};
|
94
|
+
|
95
|
+
object.requestParams = config.defaultRequestParams;
|
96
|
+
|
97
|
+
config.defaultHeaders = config.defaultHeaders || {};
|
98
|
+
object.setDefaultHeaders = function(headers) {
|
99
|
+
config.defaultHeaders = headers;
|
100
|
+
object.defaultHeaders = config.defaultHeaders;
|
101
|
+
return this;
|
102
|
+
};
|
103
|
+
|
104
|
+
object.defaultHeaders = config.defaultHeaders;
|
105
|
+
|
106
|
+
/**
|
107
|
+
* Method overriders will set which methods are sent via POST with an X-HTTP-Method-Override
|
108
|
+
**/
|
109
|
+
config.methodOverriders = config.methodOverriders || [];
|
110
|
+
object.setMethodOverriders = function(values) {
|
111
|
+
var overriders = _.extend([], values);
|
112
|
+
if (config.isOverridenMethod('delete', overriders)) {
|
113
|
+
overriders.push('remove');
|
114
|
+
}
|
115
|
+
config.methodOverriders = overriders;
|
116
|
+
return this;
|
117
|
+
};
|
118
|
+
|
119
|
+
config.jsonp = _.isUndefined(config.jsonp) ? false : config.jsonp;
|
120
|
+
object.setJsonp = function(active) {
|
121
|
+
config.jsonp = active;
|
122
|
+
};
|
123
|
+
|
124
|
+
config.isOverridenMethod = function(method, values) {
|
125
|
+
var search = values || config.methodOverriders;
|
126
|
+
return !_.isUndefined(_.find(search, function(one) {
|
127
|
+
return one.toLowerCase() === method.toLowerCase();
|
128
|
+
}));
|
129
|
+
};
|
130
|
+
|
131
|
+
/**
|
132
|
+
* Sets the URL creator type. For now, only Path is created. In the future we'll have queryParams
|
133
|
+
**/
|
134
|
+
config.urlCreator = config.urlCreator || 'path';
|
135
|
+
object.setUrlCreator = function(name) {
|
136
|
+
if (!_.has(config.urlCreatorFactory, name)) {
|
137
|
+
throw new Error('URL Path selected isn\'t valid');
|
138
|
+
}
|
139
|
+
|
140
|
+
config.urlCreator = name;
|
141
|
+
return this;
|
142
|
+
};
|
143
|
+
|
144
|
+
/**
|
145
|
+
* You can set the restangular fields here. The 3 required fields for Restangular are:
|
146
|
+
*
|
147
|
+
* id: Id of the element
|
148
|
+
* route: name of the route of this element
|
149
|
+
* parentResource: the reference to the parent resource
|
150
|
+
*
|
151
|
+
* All of this fields except for id, are handled (and created) by Restangular. By default,
|
152
|
+
* the field values will be id, route and parentResource respectively
|
153
|
+
*/
|
154
|
+
config.restangularFields = config.restangularFields || {
|
155
|
+
id: 'id',
|
156
|
+
route: 'route',
|
157
|
+
parentResource: 'parentResource',
|
158
|
+
restangularCollection: 'restangularCollection',
|
159
|
+
cannonicalId: '__cannonicalId',
|
160
|
+
etag: 'restangularEtag',
|
161
|
+
selfLink: 'href',
|
162
|
+
get: 'get',
|
163
|
+
getList: 'getList',
|
164
|
+
put: 'put',
|
165
|
+
post: 'post',
|
166
|
+
remove: 'remove',
|
167
|
+
head: 'head',
|
168
|
+
trace: 'trace',
|
169
|
+
options: 'options',
|
170
|
+
patch: 'patch',
|
171
|
+
getRestangularUrl: 'getRestangularUrl',
|
172
|
+
getRequestedUrl: 'getRequestedUrl',
|
173
|
+
putElement: 'putElement',
|
174
|
+
addRestangularMethod: 'addRestangularMethod',
|
175
|
+
getParentList: 'getParentList',
|
176
|
+
clone: 'clone',
|
177
|
+
ids: 'ids',
|
178
|
+
httpConfig: '_$httpConfig',
|
179
|
+
reqParams: 'reqParams',
|
180
|
+
one: 'one',
|
181
|
+
all: 'all',
|
182
|
+
several: 'several',
|
183
|
+
oneUrl: 'oneUrl',
|
184
|
+
allUrl: 'allUrl',
|
185
|
+
customPUT: 'customPUT',
|
186
|
+
customPOST: 'customPOST',
|
187
|
+
customDELETE: 'customDELETE',
|
188
|
+
customGET: 'customGET',
|
189
|
+
customGETLIST: 'customGETLIST',
|
190
|
+
customOperation: 'customOperation',
|
191
|
+
doPUT: 'doPUT',
|
192
|
+
doPOST: 'doPOST',
|
193
|
+
doDELETE: 'doDELETE',
|
194
|
+
doGET: 'doGET',
|
195
|
+
doGETLIST: 'doGETLIST',
|
196
|
+
fromServer: 'fromServer',
|
197
|
+
withConfig: 'withConfig',
|
198
|
+
withHttpConfig: 'withHttpConfig',
|
199
|
+
singleOne: 'singleOne',
|
200
|
+
plain: 'plain',
|
201
|
+
save: 'save',
|
202
|
+
restangularized: 'restangularized'
|
203
|
+
};
|
204
|
+
object.setRestangularFields = function(resFields) {
|
205
|
+
config.restangularFields =
|
206
|
+
_.extend(config.restangularFields, resFields);
|
207
|
+
return this;
|
208
|
+
};
|
209
|
+
|
210
|
+
config.isRestangularized = function(obj) {
|
211
|
+
return !!obj[config.restangularFields.restangularized];
|
212
|
+
};
|
213
|
+
|
214
|
+
config.setFieldToElem = function(field, elem, value) {
|
215
|
+
var properties = field.split('.');
|
216
|
+
var idValue = elem;
|
217
|
+
_.each(_.initial(properties), function(prop) {
|
218
|
+
idValue[prop] = {};
|
219
|
+
idValue = idValue[prop];
|
220
|
+
});
|
221
|
+
idValue[_.last(properties)] = value;
|
222
|
+
return this;
|
223
|
+
};
|
224
|
+
|
225
|
+
config.getFieldFromElem = function(field, elem) {
|
226
|
+
var properties = field.split('.');
|
227
|
+
var idValue = elem;
|
228
|
+
_.each(properties, function(prop) {
|
229
|
+
if (idValue) {
|
230
|
+
idValue = idValue[prop];
|
231
|
+
}
|
232
|
+
});
|
233
|
+
return angular.copy(idValue);
|
234
|
+
};
|
235
|
+
|
236
|
+
config.setIdToElem = function(elem, id /*, route */) {
|
237
|
+
config.setFieldToElem(config.restangularFields.id, elem, id);
|
238
|
+
return this;
|
239
|
+
};
|
240
|
+
|
241
|
+
config.getIdFromElem = function(elem) {
|
242
|
+
return config.getFieldFromElem(config.restangularFields.id, elem);
|
243
|
+
};
|
244
|
+
|
245
|
+
config.isValidId = function(elemId) {
|
246
|
+
return '' !== elemId && !_.isUndefined(elemId) && !_.isNull(elemId);
|
247
|
+
};
|
248
|
+
|
249
|
+
config.setUrlToElem = function(elem, url /*, route */) {
|
250
|
+
config.setFieldToElem(config.restangularFields.selfLink, elem, url);
|
251
|
+
return this;
|
252
|
+
};
|
253
|
+
|
254
|
+
config.getUrlFromElem = function(elem) {
|
255
|
+
return config.getFieldFromElem(config.restangularFields.selfLink, elem);
|
256
|
+
};
|
257
|
+
|
258
|
+
config.useCannonicalId = _.isUndefined(config.useCannonicalId) ? false : config.useCannonicalId;
|
259
|
+
object.setUseCannonicalId = function(value) {
|
260
|
+
config.useCannonicalId = value;
|
261
|
+
return this;
|
262
|
+
};
|
263
|
+
|
264
|
+
config.getCannonicalIdFromElem = function(elem) {
|
265
|
+
var cannonicalId = elem[config.restangularFields.cannonicalId];
|
266
|
+
var actualId = config.isValidId(cannonicalId) ? cannonicalId : config.getIdFromElem(elem);
|
267
|
+
return actualId;
|
268
|
+
};
|
269
|
+
|
270
|
+
/**
|
271
|
+
* Sets the Response parser. This is used in case your response isn't directly the data.
|
272
|
+
* For example if you have a response like {meta: {'meta'}, data: {name: 'Gonto'}}
|
273
|
+
* you can extract this data which is the one that needs wrapping
|
274
|
+
*
|
275
|
+
* The ResponseExtractor is a function that receives the response and the method executed.
|
276
|
+
*/
|
277
|
+
|
278
|
+
config.responseInterceptors = config.responseInterceptors || [];
|
279
|
+
|
280
|
+
config.defaultResponseInterceptor = function(data /*, operation, what, url, response, deferred */) {
|
281
|
+
return data;
|
282
|
+
};
|
283
|
+
|
284
|
+
config.responseExtractor = function(data, operation, what, url, response, deferred) {
|
285
|
+
var interceptors = angular.copy(config.responseInterceptors);
|
286
|
+
interceptors.push(config.defaultResponseInterceptor);
|
287
|
+
var theData = data;
|
288
|
+
_.each(interceptors, function(interceptor) {
|
289
|
+
theData = interceptor(theData, operation,
|
290
|
+
what, url, response, deferred);
|
291
|
+
});
|
292
|
+
return theData;
|
293
|
+
};
|
294
|
+
|
295
|
+
object.addResponseInterceptor = function(extractor) {
|
296
|
+
config.responseInterceptors.push(extractor);
|
297
|
+
return this;
|
298
|
+
};
|
299
|
+
|
300
|
+
config.errorInterceptors = config.errorInterceptors || [];
|
301
|
+
object.addErrorInterceptor = function(interceptor) {
|
302
|
+
config.errorInterceptors.push(interceptor);
|
303
|
+
return this;
|
304
|
+
};
|
305
|
+
|
306
|
+
object.setResponseInterceptor = object.addResponseInterceptor;
|
307
|
+
object.setResponseExtractor = object.addResponseInterceptor;
|
308
|
+
object.setErrorInterceptor = object.addErrorInterceptor;
|
309
|
+
|
310
|
+
/**
|
311
|
+
* Response interceptor is called just before resolving promises.
|
312
|
+
*/
|
313
|
+
|
314
|
+
|
315
|
+
/**
|
316
|
+
* Request interceptor is called before sending an object to the server.
|
317
|
+
*/
|
318
|
+
config.requestInterceptors = config.requestInterceptors || [];
|
319
|
+
|
320
|
+
config.defaultInterceptor = function(element, operation, path, url, headers, params, httpConfig) {
|
321
|
+
return {
|
322
|
+
element: element,
|
323
|
+
headers: headers,
|
324
|
+
params: params,
|
325
|
+
httpConfig: httpConfig
|
326
|
+
};
|
327
|
+
};
|
328
|
+
|
329
|
+
config.fullRequestInterceptor = function(element, operation, path, url, headers, params, httpConfig) {
|
330
|
+
var interceptors = angular.copy(config.requestInterceptors);
|
331
|
+
var defaultRequest = config.defaultInterceptor(element, operation, path, url, headers, params, httpConfig);
|
332
|
+
return _.reduce(interceptors, function(request, interceptor) {
|
333
|
+
return _.extend(request, interceptor(request.element, operation,
|
334
|
+
path, url, request.headers, request.params, request.httpConfig));
|
335
|
+
}, defaultRequest);
|
336
|
+
};
|
337
|
+
|
338
|
+
object.addRequestInterceptor = function(interceptor) {
|
339
|
+
config.requestInterceptors.push(function(elem, operation, path, url, headers, params, httpConfig) {
|
340
|
+
return {
|
341
|
+
headers: headers,
|
342
|
+
params: params,
|
343
|
+
element: interceptor(elem, operation, path, url),
|
344
|
+
httpConfig: httpConfig
|
345
|
+
};
|
346
|
+
});
|
347
|
+
return this;
|
348
|
+
};
|
349
|
+
|
350
|
+
object.setRequestInterceptor = object.addRequestInterceptor;
|
351
|
+
|
352
|
+
object.addFullRequestInterceptor = function(interceptor) {
|
353
|
+
config.requestInterceptors.push(interceptor);
|
354
|
+
return this;
|
355
|
+
};
|
356
|
+
|
357
|
+
object.setFullRequestInterceptor = object.addFullRequestInterceptor;
|
358
|
+
|
359
|
+
config.onBeforeElemRestangularized = config.onBeforeElemRestangularized || function(elem) {
|
360
|
+
return elem;
|
361
|
+
};
|
362
|
+
object.setOnBeforeElemRestangularized = function(post) {
|
363
|
+
config.onBeforeElemRestangularized = post;
|
364
|
+
return this;
|
365
|
+
};
|
366
|
+
|
367
|
+
object.setRestangularizePromiseInterceptor = function(interceptor) {
|
368
|
+
config.restangularizePromiseInterceptor = interceptor;
|
369
|
+
return this;
|
370
|
+
};
|
371
|
+
|
372
|
+
/**
|
373
|
+
* This method is called after an element has been "Restangularized".
|
374
|
+
*
|
375
|
+
* It receives the element, a boolean indicating if it's an element or a collection
|
376
|
+
* and the name of the model
|
377
|
+
*
|
378
|
+
*/
|
379
|
+
config.onElemRestangularized = config.onElemRestangularized || function(elem) {
|
380
|
+
return elem;
|
381
|
+
};
|
382
|
+
object.setOnElemRestangularized = function(post) {
|
383
|
+
config.onElemRestangularized = post;
|
384
|
+
return this;
|
385
|
+
};
|
386
|
+
|
387
|
+
config.shouldSaveParent = config.shouldSaveParent || function() {
|
388
|
+
return true;
|
389
|
+
};
|
390
|
+
object.setParentless = function(values) {
|
391
|
+
if (_.isArray(values)) {
|
392
|
+
config.shouldSaveParent = function(route) {
|
393
|
+
return !_.contains(values, route);
|
394
|
+
};
|
395
|
+
} else if (_.isBoolean(values)) {
|
396
|
+
config.shouldSaveParent = function() {
|
397
|
+
return !values;
|
398
|
+
};
|
399
|
+
}
|
400
|
+
return this;
|
401
|
+
};
|
402
|
+
|
403
|
+
/**
|
404
|
+
* This lets you set a suffix to every request.
|
405
|
+
*
|
406
|
+
* For example, if your api requires that for JSon requests you do /users/123.json, you can set that
|
407
|
+
* in here.
|
408
|
+
*
|
409
|
+
*
|
410
|
+
* By default, the suffix is null
|
411
|
+
*/
|
412
|
+
config.suffix = _.isUndefined(config.suffix) ? null : config.suffix;
|
413
|
+
object.setRequestSuffix = function(newSuffix) {
|
414
|
+
config.suffix = newSuffix;
|
415
|
+
return this;
|
416
|
+
};
|
417
|
+
|
418
|
+
/**
|
419
|
+
* Add element transformers for certain routes.
|
420
|
+
*/
|
421
|
+
config.transformers = config.transformers || {};
|
422
|
+
object.addElementTransformer = function(type, secondArg, thirdArg) {
|
423
|
+
var isCollection = null;
|
424
|
+
var transformer = null;
|
425
|
+
if (arguments.length === 2) {
|
426
|
+
transformer = secondArg;
|
427
|
+
} else {
|
428
|
+
transformer = thirdArg;
|
429
|
+
isCollection = secondArg;
|
430
|
+
}
|
431
|
+
|
432
|
+
var typeTransformers = config.transformers[type];
|
433
|
+
if (!typeTransformers) {
|
434
|
+
typeTransformers = config.transformers[type] = [];
|
435
|
+
}
|
436
|
+
|
437
|
+
typeTransformers.push(function(coll, elem) {
|
438
|
+
if (_.isNull(isCollection) || (coll === isCollection)) {
|
439
|
+
return transformer(elem);
|
440
|
+
}
|
441
|
+
return elem;
|
442
|
+
});
|
443
|
+
|
444
|
+
return object;
|
445
|
+
};
|
446
|
+
|
447
|
+
object.extendCollection = function(route, fn) {
|
448
|
+
return object.addElementTransformer(route, true, fn);
|
449
|
+
};
|
450
|
+
|
451
|
+
object.extendModel = function(route, fn) {
|
452
|
+
return object.addElementTransformer(route, false, fn);
|
453
|
+
};
|
454
|
+
|
455
|
+
config.transformElem = function(elem, isCollection, route, Restangular, force) {
|
456
|
+
if (!force && !config.transformLocalElements && !elem[config.restangularFields.fromServer]) {
|
457
|
+
return elem;
|
458
|
+
}
|
459
|
+
var typeTransformers = config.transformers[route];
|
460
|
+
var changedElem = elem;
|
461
|
+
if (typeTransformers) {
|
462
|
+
_.each(typeTransformers, function(transformer) {
|
463
|
+
changedElem = transformer(isCollection, changedElem);
|
464
|
+
});
|
465
|
+
}
|
466
|
+
return config.onElemRestangularized(changedElem, isCollection, route, Restangular);
|
467
|
+
};
|
468
|
+
|
469
|
+
config.transformLocalElements = _.isUndefined(config.transformLocalElements) ?
|
470
|
+
false :
|
471
|
+
config.transformLocalElements;
|
472
|
+
|
473
|
+
object.setTransformOnlyServerElements = function(active) {
|
474
|
+
config.transformLocalElements = !active;
|
475
|
+
};
|
476
|
+
|
477
|
+
config.fullResponse = _.isUndefined(config.fullResponse) ? false : config.fullResponse;
|
478
|
+
object.setFullResponse = function(full) {
|
479
|
+
config.fullResponse = full;
|
480
|
+
return this;
|
481
|
+
};
|
482
|
+
|
483
|
+
|
484
|
+
//Internal values and functions
|
485
|
+
config.urlCreatorFactory = {};
|
486
|
+
|
487
|
+
/**
|
488
|
+
* Base URL Creator. Base prototype for everything related to it
|
489
|
+
**/
|
490
|
+
|
491
|
+
var BaseCreator = function() {
|
492
|
+
};
|
493
|
+
|
494
|
+
BaseCreator.prototype.setConfig = function(config) {
|
495
|
+
this.config = config;
|
496
|
+
return this;
|
497
|
+
};
|
498
|
+
|
499
|
+
BaseCreator.prototype.parentsArray = function(current) {
|
500
|
+
var parents = [];
|
501
|
+
while(current) {
|
502
|
+
parents.push(current);
|
503
|
+
current = current[this.config.restangularFields.parentResource];
|
504
|
+
}
|
505
|
+
return parents.reverse();
|
506
|
+
};
|
507
|
+
|
508
|
+
function RestangularResource(config, $http, url, configurer) {
|
509
|
+
var resource = {};
|
510
|
+
_.each(_.keys(configurer), function(key) {
|
511
|
+
var value = configurer[key];
|
512
|
+
|
513
|
+
// Add default parameters
|
514
|
+
value.params = _.extend({}, value.params, config.defaultRequestParams[value.method.toLowerCase()]);
|
515
|
+
// We don't want the ? if no params are there
|
516
|
+
if (_.isEmpty(value.params)) {
|
517
|
+
delete value.params;
|
518
|
+
}
|
519
|
+
|
520
|
+
if (config.isSafe(value.method)) {
|
521
|
+
|
522
|
+
resource[key] = function() {
|
523
|
+
return $http(_.extend(value, {
|
524
|
+
url: url
|
525
|
+
}));
|
526
|
+
};
|
527
|
+
|
528
|
+
} else {
|
529
|
+
|
530
|
+
resource[key] = function(data) {
|
531
|
+
return $http(_.extend(value, {
|
532
|
+
url: url,
|
533
|
+
data: data
|
534
|
+
}));
|
535
|
+
};
|
536
|
+
|
537
|
+
}
|
538
|
+
});
|
539
|
+
|
540
|
+
return resource;
|
541
|
+
}
|
542
|
+
|
543
|
+
BaseCreator.prototype.resource = function(current, $http, localHttpConfig, callHeaders, callParams, what, etag,operation) {
|
544
|
+
|
545
|
+
var params = _.defaults(callParams || {}, this.config.defaultRequestParams.common);
|
546
|
+
var headers = _.defaults(callHeaders || {}, this.config.defaultHeaders);
|
547
|
+
|
548
|
+
if (etag) {
|
549
|
+
if (!config.isSafe(operation)) {
|
550
|
+
headers['If-Match'] = etag;
|
551
|
+
} else {
|
552
|
+
headers['If-None-Match'] = etag;
|
553
|
+
}
|
554
|
+
}
|
555
|
+
|
556
|
+
var url = this.base(current);
|
557
|
+
|
558
|
+
if (what) {
|
559
|
+
var add = '';
|
560
|
+
if (!/\/$/.test(url)) {
|
561
|
+
add += '/';
|
562
|
+
}
|
563
|
+
add += what;
|
564
|
+
url += add;
|
565
|
+
}
|
566
|
+
|
567
|
+
if (this.config.suffix &&
|
568
|
+
url.indexOf(this.config.suffix, url.length - this.config.suffix.length) === -1 &&
|
569
|
+
!this.config.getUrlFromElem(current)) {
|
570
|
+
url += this.config.suffix;
|
571
|
+
}
|
572
|
+
|
573
|
+
current[this.config.restangularFields.httpConfig] = undefined;
|
574
|
+
|
575
|
+
return RestangularResource(this.config, $http, url, {
|
576
|
+
getList: this.config.withHttpValues(localHttpConfig,
|
577
|
+
{method: 'GET',
|
578
|
+
params: params,
|
579
|
+
headers: headers}),
|
580
|
+
|
581
|
+
get: this.config.withHttpValues(localHttpConfig,
|
582
|
+
{method: 'GET',
|
583
|
+
params: params,
|
584
|
+
headers: headers}),
|
585
|
+
|
586
|
+
jsonp: this.config.withHttpValues(localHttpConfig,
|
587
|
+
{method: 'jsonp',
|
588
|
+
params: params,
|
589
|
+
headers: headers}),
|
590
|
+
|
591
|
+
put: this.config.withHttpValues(localHttpConfig,
|
592
|
+
{method: 'PUT',
|
593
|
+
params: params,
|
594
|
+
headers: headers}),
|
595
|
+
|
596
|
+
post: this.config.withHttpValues(localHttpConfig,
|
597
|
+
{method: 'POST',
|
598
|
+
params: params,
|
599
|
+
headers: headers}),
|
600
|
+
|
601
|
+
remove: this.config.withHttpValues(localHttpConfig,
|
602
|
+
{method: 'DELETE',
|
603
|
+
params: params,
|
604
|
+
headers: headers}),
|
605
|
+
|
606
|
+
head: this.config.withHttpValues(localHttpConfig,
|
607
|
+
{method: 'HEAD',
|
608
|
+
params: params,
|
609
|
+
headers: headers}),
|
610
|
+
|
611
|
+
trace: this.config.withHttpValues(localHttpConfig,
|
612
|
+
{method: 'TRACE',
|
613
|
+
params: params,
|
614
|
+
headers: headers}),
|
615
|
+
|
616
|
+
options: this.config.withHttpValues(localHttpConfig,
|
617
|
+
{method: 'OPTIONS',
|
618
|
+
params: params,
|
619
|
+
headers: headers}),
|
620
|
+
|
621
|
+
patch: this.config.withHttpValues(localHttpConfig,
|
622
|
+
{method: 'PATCH',
|
623
|
+
params: params,
|
624
|
+
headers: headers})
|
625
|
+
});
|
626
|
+
};
|
627
|
+
|
628
|
+
/**
|
629
|
+
* This is the Path URL creator. It uses Path to show Hierarchy in the Rest API.
|
630
|
+
* This means that if you have an Account that then has a set of Buildings, a URL to a building
|
631
|
+
* would be /accounts/123/buildings/456
|
632
|
+
**/
|
633
|
+
var Path = function() {
|
634
|
+
};
|
635
|
+
|
636
|
+
Path.prototype = new BaseCreator();
|
637
|
+
|
638
|
+
Path.prototype.normalizeUrl = function (url){
|
639
|
+
var parts = /(http[s]?:\/\/)?(.*)?/.exec(url);
|
640
|
+
parts[2] = parts[2].replace(/[\\\/]+/g, '/');
|
641
|
+
return (typeof parts[1] !== 'undefined')? parts[1] + parts[2] : parts[2];
|
642
|
+
};
|
643
|
+
|
644
|
+
Path.prototype.base = function(current) {
|
645
|
+
var __this = this;
|
646
|
+
return _.reduce(this.parentsArray(current), function(acum, elem) {
|
647
|
+
var elemUrl;
|
648
|
+
var elemSelfLink = __this.config.getUrlFromElem(elem);
|
649
|
+
if (elemSelfLink) {
|
650
|
+
if (__this.config.isAbsoluteUrl(elemSelfLink)) {
|
651
|
+
return elemSelfLink;
|
652
|
+
} else {
|
653
|
+
elemUrl = elemSelfLink;
|
654
|
+
}
|
655
|
+
} else {
|
656
|
+
elemUrl = elem[__this.config.restangularFields.route];
|
657
|
+
|
658
|
+
if (elem[__this.config.restangularFields.restangularCollection]) {
|
659
|
+
var ids = elem[__this.config.restangularFields.ids];
|
660
|
+
if (ids) {
|
661
|
+
elemUrl += '/' + ids.join(',');
|
662
|
+
}
|
663
|
+
} else {
|
664
|
+
var elemId;
|
665
|
+
if (__this.config.useCannonicalId) {
|
666
|
+
elemId = __this.config.getCannonicalIdFromElem(elem);
|
667
|
+
} else {
|
668
|
+
elemId = __this.config.getIdFromElem(elem);
|
669
|
+
}
|
670
|
+
|
671
|
+
if (config.isValidId(elemId) && !elem.singleOne) {
|
672
|
+
elemUrl += '/' + (__this.config.encodeIds ? encodeURIComponent(elemId) : elemId);
|
673
|
+
}
|
674
|
+
}
|
675
|
+
}
|
676
|
+
acum = acum.replace(/\/$/, '') + '/' + elemUrl;
|
677
|
+
return __this.normalizeUrl(acum);
|
678
|
+
|
679
|
+
}, this.config.baseUrl);
|
680
|
+
};
|
681
|
+
|
682
|
+
|
683
|
+
|
684
|
+
Path.prototype.fetchUrl = function(current, what) {
|
685
|
+
var baseUrl = this.base(current);
|
686
|
+
if (what) {
|
687
|
+
baseUrl += '/' + what;
|
688
|
+
}
|
689
|
+
return baseUrl;
|
690
|
+
};
|
691
|
+
|
692
|
+
Path.prototype.fetchRequestedUrl = function(current, what) {
|
693
|
+
var url = this.fetchUrl(current, what);
|
694
|
+
var params = current[config.restangularFields.reqParams];
|
695
|
+
|
696
|
+
// From here on and until the end of fetchRequestedUrl,
|
697
|
+
// the code has been kindly borrowed from angular.js
|
698
|
+
// The reason for such code bloating is coherence:
|
699
|
+
// If the user were to use this for cache management, the
|
700
|
+
// serialization of parameters would need to be identical
|
701
|
+
// to the one done by angular for cache keys to match.
|
702
|
+
function sortedKeys(obj) {
|
703
|
+
var keys = [];
|
704
|
+
for (var key in obj) {
|
705
|
+
if (obj.hasOwnProperty(key)) {
|
706
|
+
keys.push(key);
|
707
|
+
}
|
708
|
+
}
|
709
|
+
return keys.sort();
|
710
|
+
}
|
711
|
+
|
712
|
+
function forEachSorted(obj, iterator, context) {
|
713
|
+
var keys = sortedKeys(obj);
|
714
|
+
for ( var i = 0; i < keys.length; i++) {
|
715
|
+
iterator.call(context, obj[keys[i]], keys[i]);
|
716
|
+
}
|
717
|
+
return keys;
|
718
|
+
}
|
719
|
+
|
720
|
+
function encodeUriQuery(val, pctEncodeSpaces) {
|
721
|
+
return encodeURIComponent(val).
|
722
|
+
replace(/%40/gi, '@').
|
723
|
+
replace(/%3A/gi, ':').
|
724
|
+
replace(/%24/g, '$').
|
725
|
+
replace(/%2C/gi, ',').
|
726
|
+
replace(/%20/g, (pctEncodeSpaces ? '%20' : '+'));
|
727
|
+
}
|
728
|
+
|
729
|
+
if (!params) { return url + (this.config.suffix || ''); }
|
730
|
+
|
731
|
+
var parts = [];
|
732
|
+
forEachSorted(params, function(value, key) {
|
733
|
+
if (value === null || value === undefined) { return; }
|
734
|
+
if (!angular.isArray(value)) { value = [value]; }
|
735
|
+
|
736
|
+
angular.forEach(value, function(v) {
|
737
|
+
if (angular.isObject(v)) {
|
738
|
+
v = angular.toJson(v);
|
739
|
+
}
|
740
|
+
parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(v));
|
741
|
+
});
|
742
|
+
});
|
743
|
+
|
744
|
+
return url + (this.config.suffix || '') + ((url.indexOf('?') === -1) ? '?' : '&') + parts.join('&');
|
745
|
+
};
|
746
|
+
|
747
|
+
config.urlCreatorFactory.path = Path;
|
748
|
+
};
|
749
|
+
|
750
|
+
var globalConfiguration = {};
|
751
|
+
|
752
|
+
Configurer.init(this, globalConfiguration);
|
753
|
+
|
754
|
+
|
755
|
+
|
756
|
+
this.$get = ['$http', '$q', function($http, $q) {
|
757
|
+
|
758
|
+
function createServiceForConfiguration(config) {
|
759
|
+
var service = {};
|
760
|
+
|
761
|
+
var urlHandler = new config.urlCreatorFactory[config.urlCreator]();
|
762
|
+
urlHandler.setConfig(config);
|
763
|
+
|
764
|
+
function restangularizeBase(parent, elem, route, reqParams, fromServer) {
|
765
|
+
elem[config.restangularFields.route] = route;
|
766
|
+
elem[config.restangularFields.getRestangularUrl] = _.bind(urlHandler.fetchUrl, urlHandler, elem);
|
767
|
+
elem[config.restangularFields.getRequestedUrl] = _.bind(urlHandler.fetchRequestedUrl, urlHandler, elem);
|
768
|
+
elem[config.restangularFields.addRestangularMethod] = _.bind(addRestangularMethodFunction, elem);
|
769
|
+
elem[config.restangularFields.clone] = _.bind(copyRestangularizedElement, elem, elem);
|
770
|
+
elem[config.restangularFields.reqParams] = _.isEmpty(reqParams) ? null : reqParams;
|
771
|
+
elem[config.restangularFields.withHttpConfig] = _.bind(withHttpConfig, elem);
|
772
|
+
elem[config.restangularFields.plain] = _.bind(stripRestangular, elem, elem);
|
773
|
+
|
774
|
+
// Tag element as restangularized
|
775
|
+
elem[config.restangularFields.restangularized] = true;
|
776
|
+
|
777
|
+
// RequestLess connection
|
778
|
+
elem[config.restangularFields.one] = _.bind(one, elem, elem);
|
779
|
+
elem[config.restangularFields.all] = _.bind(all, elem, elem);
|
780
|
+
elem[config.restangularFields.several] = _.bind(several, elem, elem);
|
781
|
+
elem[config.restangularFields.oneUrl] = _.bind(oneUrl, elem, elem);
|
782
|
+
elem[config.restangularFields.allUrl] = _.bind(allUrl, elem, elem);
|
783
|
+
|
784
|
+
elem[config.restangularFields.fromServer] = !!fromServer;
|
785
|
+
|
786
|
+
if (parent && config.shouldSaveParent(route)) {
|
787
|
+
var parentId = config.getIdFromElem(parent);
|
788
|
+
var parentUrl = config.getUrlFromElem(parent);
|
789
|
+
|
790
|
+
var restangularFieldsForParent = _.union(
|
791
|
+
_.values( _.pick(config.restangularFields, ['route', 'singleOne', 'parentResource']) ),
|
792
|
+
config.extraFields
|
793
|
+
);
|
794
|
+
var parentResource = _.pick(parent, restangularFieldsForParent);
|
795
|
+
|
796
|
+
if (config.isValidId(parentId)) {
|
797
|
+
config.setIdToElem(parentResource, parentId, route);
|
798
|
+
}
|
799
|
+
if (config.isValidId(parentUrl)) {
|
800
|
+
config.setUrlToElem(parentResource, parentUrl, route);
|
801
|
+
}
|
802
|
+
|
803
|
+
elem[config.restangularFields.parentResource] = parentResource;
|
804
|
+
} else {
|
805
|
+
elem[config.restangularFields.parentResource] = null;
|
806
|
+
}
|
807
|
+
return elem;
|
808
|
+
}
|
809
|
+
|
810
|
+
function one(parent, route, id, singleOne) {
|
811
|
+
var error;
|
812
|
+
if (_.isNumber(route) || _.isNumber(parent)) {
|
813
|
+
error = 'You\'re creating a Restangular entity with the number ';
|
814
|
+
error += 'instead of the route or the parent. For example, you can\'t call .one(12).';
|
815
|
+
throw new Error(error);
|
816
|
+
}
|
817
|
+
if (_.isUndefined(route)) {
|
818
|
+
error = 'You\'re creating a Restangular entity either without the path. ';
|
819
|
+
error += 'For example you can\'t call .one(). Please check if your arguments are valid.';
|
820
|
+
throw new Error(error);
|
821
|
+
}
|
822
|
+
var elem = {};
|
823
|
+
config.setIdToElem(elem, id, route);
|
824
|
+
config.setFieldToElem(config.restangularFields.singleOne, elem, singleOne);
|
825
|
+
return restangularizeElem(parent, elem , route, false);
|
826
|
+
}
|
827
|
+
|
828
|
+
|
829
|
+
function all(parent, route) {
|
830
|
+
return restangularizeCollection(parent, [] , route, false);
|
831
|
+
}
|
832
|
+
|
833
|
+
function several(parent, route /*, ids */) {
|
834
|
+
var collection = [];
|
835
|
+
collection[config.restangularFields.ids] = Array.prototype.splice.call(arguments, 2);
|
836
|
+
return restangularizeCollection(parent, collection , route, false);
|
837
|
+
}
|
838
|
+
|
839
|
+
function oneUrl(parent, route, url) {
|
840
|
+
if (!route) {
|
841
|
+
throw new Error('Route is mandatory when creating new Restangular objects.');
|
842
|
+
}
|
843
|
+
var elem = {};
|
844
|
+
config.setUrlToElem(elem, url, route);
|
845
|
+
return restangularizeElem(parent, elem , route, false);
|
846
|
+
}
|
847
|
+
|
848
|
+
|
849
|
+
function allUrl(parent, route, url) {
|
850
|
+
if (!route) {
|
851
|
+
throw new Error('Route is mandatory when creating new Restangular objects.');
|
852
|
+
}
|
853
|
+
var elem = {};
|
854
|
+
config.setUrlToElem(elem, url, route);
|
855
|
+
return restangularizeCollection(parent, elem , route, false);
|
856
|
+
}
|
857
|
+
// Promises
|
858
|
+
function restangularizePromise(promise, isCollection, valueToFill) {
|
859
|
+
promise.call = _.bind(promiseCall, promise);
|
860
|
+
promise.get = _.bind(promiseGet, promise);
|
861
|
+
promise[config.restangularFields.restangularCollection] = isCollection;
|
862
|
+
if (isCollection) {
|
863
|
+
promise.push = _.bind(promiseCall, promise, 'push');
|
864
|
+
}
|
865
|
+
promise.$object = valueToFill;
|
866
|
+
if (config.restangularizePromiseInterceptor) {
|
867
|
+
config.restangularizePromiseInterceptor(promise);
|
868
|
+
}
|
869
|
+
return promise;
|
870
|
+
}
|
871
|
+
|
872
|
+
function promiseCall(method) {
|
873
|
+
var deferred = $q.defer();
|
874
|
+
var callArgs = arguments;
|
875
|
+
var filledValue = {};
|
876
|
+
this.then(function(val) {
|
877
|
+
var params = Array.prototype.slice.call(callArgs, 1);
|
878
|
+
var func = val[method];
|
879
|
+
func.apply(val, params);
|
880
|
+
filledValue = val;
|
881
|
+
deferred.resolve(val);
|
882
|
+
});
|
883
|
+
return restangularizePromise(deferred.promise, this[config.restangularFields.restangularCollection], filledValue);
|
884
|
+
}
|
885
|
+
|
886
|
+
function promiseGet(what) {
|
887
|
+
var deferred = $q.defer();
|
888
|
+
var filledValue = {};
|
889
|
+
this.then(function(val) {
|
890
|
+
filledValue = val[what];
|
891
|
+
deferred.resolve(filledValue);
|
892
|
+
});
|
893
|
+
return restangularizePromise(deferred.promise, this[config.restangularFields.restangularCollection], filledValue);
|
894
|
+
}
|
895
|
+
|
896
|
+
function resolvePromise(deferred, response, data, filledValue) {
|
897
|
+
_.extend(filledValue, data);
|
898
|
+
|
899
|
+
// Trigger the full response interceptor.
|
900
|
+
if (config.fullResponse) {
|
901
|
+
return deferred.resolve(_.extend(response, {
|
902
|
+
data: data
|
903
|
+
}));
|
904
|
+
} else {
|
905
|
+
deferred.resolve(data);
|
906
|
+
}
|
907
|
+
}
|
908
|
+
|
909
|
+
|
910
|
+
// Elements
|
911
|
+
function stripRestangular(elem) {
|
912
|
+
if (_.isArray(elem)) {
|
913
|
+
var array = [];
|
914
|
+
_.each(elem, function(value) {
|
915
|
+
array.push(config.isRestangularized(value) ? stripRestangular(value) : value);
|
916
|
+
});
|
917
|
+
return array;
|
918
|
+
} else {
|
919
|
+
return _.omit(elem, _.values(_.omit(config.restangularFields, 'id')));
|
920
|
+
}
|
921
|
+
}
|
922
|
+
|
923
|
+
function addCustomOperation(elem) {
|
924
|
+
elem[config.restangularFields.customOperation] = _.bind(customFunction, elem);
|
925
|
+
_.each(['put', 'post', 'get', 'delete'], function(oper) {
|
926
|
+
_.each(['do', 'custom'], function(alias) {
|
927
|
+
var callOperation = oper === 'delete' ? 'remove' : oper;
|
928
|
+
var name = alias + oper.toUpperCase();
|
929
|
+
var callFunction;
|
930
|
+
|
931
|
+
if (callOperation !== 'put' && callOperation !== 'post') {
|
932
|
+
callFunction = customFunction;
|
933
|
+
} else {
|
934
|
+
callFunction = function(operation, elem, path, params, headers) {
|
935
|
+
return _.bind(customFunction, this)(operation, path, params, headers, elem);
|
936
|
+
};
|
937
|
+
}
|
938
|
+
elem[name] = _.bind(callFunction, elem, callOperation);
|
939
|
+
});
|
940
|
+
});
|
941
|
+
elem[config.restangularFields.customGETLIST] = _.bind(fetchFunction, elem);
|
942
|
+
elem[config.restangularFields.doGETLIST] = elem[config.restangularFields.customGETLIST];
|
943
|
+
}
|
944
|
+
|
945
|
+
function copyRestangularizedElement(fromElement, toElement) {
|
946
|
+
var copiedElement = angular.copy(fromElement, toElement);
|
947
|
+
return restangularizeElem(copiedElement[config.restangularFields.parentResource],
|
948
|
+
copiedElement, copiedElement[config.restangularFields.route], true);
|
949
|
+
}
|
950
|
+
|
951
|
+
function restangularizeElem(parent, element, route, fromServer, collection, reqParams) {
|
952
|
+
var elem = config.onBeforeElemRestangularized(element, false, route);
|
953
|
+
|
954
|
+
var localElem = restangularizeBase(parent, elem, route, reqParams, fromServer);
|
955
|
+
|
956
|
+
if (config.useCannonicalId) {
|
957
|
+
localElem[config.restangularFields.cannonicalId] = config.getIdFromElem(localElem);
|
958
|
+
}
|
959
|
+
|
960
|
+
if (collection) {
|
961
|
+
localElem[config.restangularFields.getParentList] = function() {
|
962
|
+
return collection;
|
963
|
+
};
|
964
|
+
}
|
965
|
+
|
966
|
+
localElem[config.restangularFields.restangularCollection] = false;
|
967
|
+
localElem[config.restangularFields.get] = _.bind(getFunction, localElem);
|
968
|
+
localElem[config.restangularFields.getList] = _.bind(fetchFunction, localElem);
|
969
|
+
localElem[config.restangularFields.put] = _.bind(putFunction, localElem);
|
970
|
+
localElem[config.restangularFields.post] = _.bind(postFunction, localElem);
|
971
|
+
localElem[config.restangularFields.remove] = _.bind(deleteFunction, localElem);
|
972
|
+
localElem[config.restangularFields.head] = _.bind(headFunction, localElem);
|
973
|
+
localElem[config.restangularFields.trace] = _.bind(traceFunction, localElem);
|
974
|
+
localElem[config.restangularFields.options] = _.bind(optionsFunction, localElem);
|
975
|
+
localElem[config.restangularFields.patch] = _.bind(patchFunction, localElem);
|
976
|
+
localElem[config.restangularFields.save] = _.bind(save, localElem);
|
977
|
+
|
978
|
+
addCustomOperation(localElem);
|
979
|
+
return config.transformElem(localElem, false, route, service, true);
|
980
|
+
}
|
981
|
+
|
982
|
+
function restangularizeCollection(parent, element, route, fromServer, reqParams) {
|
983
|
+
var elem = config.onBeforeElemRestangularized(element, true, route);
|
984
|
+
|
985
|
+
var localElem = restangularizeBase(parent, elem, route, reqParams, fromServer);
|
986
|
+
localElem[config.restangularFields.restangularCollection] = true;
|
987
|
+
localElem[config.restangularFields.post] = _.bind(postFunction, localElem, null);
|
988
|
+
localElem[config.restangularFields.remove] = _.bind(deleteFunction, localElem);
|
989
|
+
localElem[config.restangularFields.head] = _.bind(headFunction, localElem);
|
990
|
+
localElem[config.restangularFields.trace] = _.bind(traceFunction, localElem);
|
991
|
+
localElem[config.restangularFields.putElement] = _.bind(putElementFunction, localElem);
|
992
|
+
localElem[config.restangularFields.options] = _.bind(optionsFunction, localElem);
|
993
|
+
localElem[config.restangularFields.patch] = _.bind(patchFunction, localElem);
|
994
|
+
localElem[config.restangularFields.get] = _.bind(getById, localElem);
|
995
|
+
localElem[config.restangularFields.getList] = _.bind(fetchFunction, localElem, null);
|
996
|
+
|
997
|
+
addCustomOperation(localElem);
|
998
|
+
return config.transformElem(localElem, true, route, service, true);
|
999
|
+
}
|
1000
|
+
|
1001
|
+
function restangularizeCollectionAndElements(parent, element, route) {
|
1002
|
+
var collection = restangularizeCollection(parent, element, route, false);
|
1003
|
+
_.each(collection, function(elem) {
|
1004
|
+
restangularizeElem(parent, elem, route, false);
|
1005
|
+
});
|
1006
|
+
return collection;
|
1007
|
+
}
|
1008
|
+
|
1009
|
+
function getById(id, reqParams, headers){
|
1010
|
+
return this.customGET(id.toString(), reqParams, headers);
|
1011
|
+
}
|
1012
|
+
|
1013
|
+
function putElementFunction(idx, params, headers) {
|
1014
|
+
var __this = this;
|
1015
|
+
var elemToPut = this[idx];
|
1016
|
+
var deferred = $q.defer();
|
1017
|
+
var filledArray = [];
|
1018
|
+
filledArray = config.transformElem(filledArray, true, elemToPut[config.restangularFields.route], service);
|
1019
|
+
elemToPut.put(params, headers).then(function(serverElem) {
|
1020
|
+
var newArray = copyRestangularizedElement(__this);
|
1021
|
+
newArray[idx] = serverElem;
|
1022
|
+
filledArray = newArray;
|
1023
|
+
deferred.resolve(newArray);
|
1024
|
+
}, function(response) {
|
1025
|
+
deferred.reject(response);
|
1026
|
+
});
|
1027
|
+
|
1028
|
+
return restangularizePromise(deferred.promise, true, filledArray);
|
1029
|
+
}
|
1030
|
+
|
1031
|
+
function parseResponse(resData, operation, route, fetchUrl, response, deferred) {
|
1032
|
+
var data = config.responseExtractor(resData, operation, route, fetchUrl, response, deferred);
|
1033
|
+
var etag = response.headers('ETag');
|
1034
|
+
if (data && etag) {
|
1035
|
+
data[config.restangularFields.etag] = etag;
|
1036
|
+
}
|
1037
|
+
return data;
|
1038
|
+
}
|
1039
|
+
|
1040
|
+
|
1041
|
+
function fetchFunction(what, reqParams, headers) {
|
1042
|
+
var __this = this;
|
1043
|
+
var deferred = $q.defer();
|
1044
|
+
var operation = 'getList';
|
1045
|
+
var url = urlHandler.fetchUrl(this, what);
|
1046
|
+
var whatFetched = what || __this[config.restangularFields.route];
|
1047
|
+
|
1048
|
+
var request = config.fullRequestInterceptor(null, operation,
|
1049
|
+
whatFetched, url, headers || {}, reqParams || {}, this[config.restangularFields.httpConfig] || {});
|
1050
|
+
|
1051
|
+
var filledArray = [];
|
1052
|
+
filledArray = config.transformElem(filledArray, true, whatFetched, service);
|
1053
|
+
|
1054
|
+
var method = 'getList';
|
1055
|
+
|
1056
|
+
if (config.jsonp) {
|
1057
|
+
method = 'jsonp';
|
1058
|
+
}
|
1059
|
+
|
1060
|
+
var okCallback = function(response) {
|
1061
|
+
var resData = response.data;
|
1062
|
+
var fullParams = response.config.params;
|
1063
|
+
var data = parseResponse(resData, operation, whatFetched, url, response, deferred);
|
1064
|
+
|
1065
|
+
// support empty response for getList() calls (some APIs respond with 204 and empty body)
|
1066
|
+
if (_.isUndefined(data) || '' === data) {
|
1067
|
+
data = [];
|
1068
|
+
}
|
1069
|
+
if (!_.isArray(data)) {
|
1070
|
+
throw new Error('Response for getList SHOULD be an array and not an object or something else');
|
1071
|
+
}
|
1072
|
+
var processedData = _.map(data, function(elem) {
|
1073
|
+
if (!__this[config.restangularFields.restangularCollection]) {
|
1074
|
+
return restangularizeElem(__this, elem, what, true, data);
|
1075
|
+
} else {
|
1076
|
+
return restangularizeElem(__this[config.restangularFields.parentResource],
|
1077
|
+
elem, __this[config.restangularFields.route], true, data);
|
1078
|
+
}
|
1079
|
+
});
|
1080
|
+
|
1081
|
+
processedData = _.extend(data, processedData);
|
1082
|
+
|
1083
|
+
if (!__this[config.restangularFields.restangularCollection]) {
|
1084
|
+
resolvePromise(
|
1085
|
+
deferred,
|
1086
|
+
response,
|
1087
|
+
restangularizeCollection(
|
1088
|
+
__this,
|
1089
|
+
processedData,
|
1090
|
+
what,
|
1091
|
+
true,
|
1092
|
+
fullParams
|
1093
|
+
),
|
1094
|
+
filledArray
|
1095
|
+
);
|
1096
|
+
} else {
|
1097
|
+
resolvePromise(
|
1098
|
+
deferred,
|
1099
|
+
response,
|
1100
|
+
restangularizeCollection(
|
1101
|
+
__this[config.restangularFields.parentResource],
|
1102
|
+
processedData,
|
1103
|
+
__this[config.restangularFields.route],
|
1104
|
+
true,
|
1105
|
+
fullParams
|
1106
|
+
),
|
1107
|
+
filledArray
|
1108
|
+
);
|
1109
|
+
}
|
1110
|
+
};
|
1111
|
+
|
1112
|
+
urlHandler.resource(this, $http, request.httpConfig, request.headers, request.params, what,
|
1113
|
+
this[config.restangularFields.etag], operation)[method]().then(okCallback, function error(response) {
|
1114
|
+
if (response.status === 304 && __this[config.restangularFields.restangularCollection]) {
|
1115
|
+
resolvePromise(deferred, response, __this, filledArray);
|
1116
|
+
} else if ( _.every(config.errorInterceptors, function(cb) { return cb(response, deferred, okCallback) !== false; }) ) {
|
1117
|
+
// triggered if no callback returns false
|
1118
|
+
deferred.reject(response);
|
1119
|
+
}
|
1120
|
+
});
|
1121
|
+
|
1122
|
+
return restangularizePromise(deferred.promise, true, filledArray);
|
1123
|
+
}
|
1124
|
+
|
1125
|
+
function withHttpConfig(httpConfig) {
|
1126
|
+
this[config.restangularFields.httpConfig] = httpConfig;
|
1127
|
+
return this;
|
1128
|
+
}
|
1129
|
+
|
1130
|
+
function save(params, headers) {
|
1131
|
+
if (this[config.restangularFields.fromServer]) {
|
1132
|
+
return this[config.restangularFields.put](params, headers);
|
1133
|
+
} else {
|
1134
|
+
return _.bind(elemFunction, this)('post', undefined, params, undefined, headers);
|
1135
|
+
}
|
1136
|
+
}
|
1137
|
+
|
1138
|
+
function elemFunction(operation, what, params, obj, headers) {
|
1139
|
+
var __this = this;
|
1140
|
+
var deferred = $q.defer();
|
1141
|
+
var resParams = params || {};
|
1142
|
+
var route = what || this[config.restangularFields.route];
|
1143
|
+
var fetchUrl = urlHandler.fetchUrl(this, what);
|
1144
|
+
|
1145
|
+
var callObj = obj || this;
|
1146
|
+
// fallback to etag on restangular object (since for custom methods we probably don't explicitly specify the etag field)
|
1147
|
+
var etag = callObj[config.restangularFields.etag] || (operation !== 'post' ? this[config.restangularFields.etag] : null);
|
1148
|
+
|
1149
|
+
if (_.isObject(callObj) && config.isRestangularized(callObj)) {
|
1150
|
+
callObj = stripRestangular(callObj);
|
1151
|
+
}
|
1152
|
+
var request = config.fullRequestInterceptor(callObj, operation, route, fetchUrl,
|
1153
|
+
headers || {}, resParams || {}, this[config.restangularFields.httpConfig] || {});
|
1154
|
+
|
1155
|
+
var filledObject = {};
|
1156
|
+
filledObject = config.transformElem(filledObject, false, route, service);
|
1157
|
+
|
1158
|
+
var okCallback = function(response) {
|
1159
|
+
var resData = response.data;
|
1160
|
+
var fullParams = response.config.params;
|
1161
|
+
var elem = parseResponse(resData, operation, route, fetchUrl, response, deferred);
|
1162
|
+
if (elem) {
|
1163
|
+
|
1164
|
+
if (operation === 'post' && !__this[config.restangularFields.restangularCollection]) {
|
1165
|
+
var data = restangularizeElem(
|
1166
|
+
__this[config.restangularFields.parentResource],
|
1167
|
+
elem,
|
1168
|
+
route,
|
1169
|
+
true,
|
1170
|
+
null,
|
1171
|
+
fullParams
|
1172
|
+
);
|
1173
|
+
resolvePromise(deferred, response, data, filledObject);
|
1174
|
+
} else {
|
1175
|
+
var data = restangularizeElem(
|
1176
|
+
__this[config.restangularFields.parentResource],
|
1177
|
+
elem,
|
1178
|
+
__this[config.restangularFields.route],
|
1179
|
+
true,
|
1180
|
+
null,
|
1181
|
+
fullParams
|
1182
|
+
);
|
1183
|
+
|
1184
|
+
data[config.restangularFields.singleOne] = __this[config.restangularFields.singleOne];
|
1185
|
+
resolvePromise(deferred, response, data, filledObject);
|
1186
|
+
}
|
1187
|
+
|
1188
|
+
} else {
|
1189
|
+
resolvePromise(deferred, response, undefined, filledObject);
|
1190
|
+
}
|
1191
|
+
};
|
1192
|
+
|
1193
|
+
var errorCallback = function(response) {
|
1194
|
+
if (response.status === 304 && config.isSafe(operation)) {
|
1195
|
+
resolvePromise(deferred, response, __this, filledObject);
|
1196
|
+
} else if ( _.every(config.errorInterceptors, function(cb) { return cb(response, deferred, okCallback) !== false; }) ) {
|
1197
|
+
// triggered if no callback returns false
|
1198
|
+
deferred.reject(response);
|
1199
|
+
}
|
1200
|
+
};
|
1201
|
+
// Overriding HTTP Method
|
1202
|
+
var callOperation = operation;
|
1203
|
+
var callHeaders = _.extend({}, request.headers);
|
1204
|
+
var isOverrideOperation = config.isOverridenMethod(operation);
|
1205
|
+
if (isOverrideOperation) {
|
1206
|
+
callOperation = 'post';
|
1207
|
+
callHeaders = _.extend(callHeaders, {'X-HTTP-Method-Override': operation === 'remove' ? 'DELETE' : operation.toUpperCase()});
|
1208
|
+
} else if (config.jsonp && callOperation === 'get') {
|
1209
|
+
callOperation = 'jsonp';
|
1210
|
+
}
|
1211
|
+
|
1212
|
+
if (config.isSafe(operation)) {
|
1213
|
+
if (isOverrideOperation) {
|
1214
|
+
urlHandler.resource(this, $http, request.httpConfig, callHeaders, request.params,
|
1215
|
+
what, etag, callOperation)[callOperation]({}).then(okCallback, errorCallback);
|
1216
|
+
} else {
|
1217
|
+
urlHandler.resource(this, $http, request.httpConfig, callHeaders, request.params,
|
1218
|
+
what, etag, callOperation)[callOperation]().then(okCallback, errorCallback);
|
1219
|
+
}
|
1220
|
+
} else {
|
1221
|
+
urlHandler.resource(this, $http, request.httpConfig, callHeaders, request.params,
|
1222
|
+
what, etag, callOperation)[callOperation](request.element).then(okCallback, errorCallback);
|
1223
|
+
}
|
1224
|
+
|
1225
|
+
return restangularizePromise(deferred.promise, false, filledObject);
|
1226
|
+
}
|
1227
|
+
|
1228
|
+
function getFunction(params, headers) {
|
1229
|
+
return _.bind(elemFunction, this)('get', undefined, params, undefined, headers);
|
1230
|
+
}
|
1231
|
+
|
1232
|
+
function deleteFunction(params, headers) {
|
1233
|
+
return _.bind(elemFunction, this)('remove', undefined, params, undefined, headers);
|
1234
|
+
}
|
1235
|
+
|
1236
|
+
function putFunction(params, headers) {
|
1237
|
+
return _.bind(elemFunction, this)('put', undefined, params, undefined, headers);
|
1238
|
+
}
|
1239
|
+
|
1240
|
+
function postFunction(what, elem, params, headers) {
|
1241
|
+
return _.bind(elemFunction, this)('post', what, params, elem, headers);
|
1242
|
+
}
|
1243
|
+
|
1244
|
+
function headFunction(params, headers) {
|
1245
|
+
return _.bind(elemFunction, this)('head', undefined, params, undefined, headers);
|
1246
|
+
}
|
1247
|
+
|
1248
|
+
function traceFunction(params, headers) {
|
1249
|
+
return _.bind(elemFunction, this)('trace', undefined, params, undefined, headers);
|
1250
|
+
}
|
1251
|
+
|
1252
|
+
function optionsFunction(params, headers) {
|
1253
|
+
return _.bind(elemFunction, this)('options', undefined, params, undefined, headers);
|
1254
|
+
}
|
1255
|
+
|
1256
|
+
function patchFunction(elem, params, headers) {
|
1257
|
+
return _.bind(elemFunction, this)('patch', undefined, params, elem, headers);
|
1258
|
+
}
|
1259
|
+
|
1260
|
+
function customFunction(operation, path, params, headers, elem) {
|
1261
|
+
return _.bind(elemFunction, this)(operation, path, params, elem, headers);
|
1262
|
+
}
|
1263
|
+
|
1264
|
+
function addRestangularMethodFunction(name, operation, path, defaultParams, defaultHeaders, defaultElem) {
|
1265
|
+
var bindedFunction;
|
1266
|
+
if (operation === 'getList') {
|
1267
|
+
bindedFunction = _.bind(fetchFunction, this, path);
|
1268
|
+
} else {
|
1269
|
+
bindedFunction = _.bind(customFunction, this, operation, path);
|
1270
|
+
}
|
1271
|
+
|
1272
|
+
var createdFunction = function(params, headers, elem) {
|
1273
|
+
var callParams = _.defaults({
|
1274
|
+
params: params,
|
1275
|
+
headers: headers,
|
1276
|
+
elem: elem
|
1277
|
+
}, {
|
1278
|
+
params: defaultParams,
|
1279
|
+
headers: defaultHeaders,
|
1280
|
+
elem: defaultElem
|
1281
|
+
});
|
1282
|
+
return bindedFunction(callParams.params, callParams.headers, callParams.elem);
|
1283
|
+
};
|
1284
|
+
|
1285
|
+
if (config.isSafe(operation)) {
|
1286
|
+
this[name] = createdFunction;
|
1287
|
+
} else {
|
1288
|
+
this[name] = function(elem, params, headers) {
|
1289
|
+
return createdFunction(params, headers, elem);
|
1290
|
+
};
|
1291
|
+
}
|
1292
|
+
}
|
1293
|
+
|
1294
|
+
function withConfigurationFunction(configurer) {
|
1295
|
+
var newConfig = angular.copy(_.omit(config, 'configuration'));
|
1296
|
+
Configurer.init(newConfig, newConfig);
|
1297
|
+
configurer(newConfig);
|
1298
|
+
return createServiceForConfiguration(newConfig);
|
1299
|
+
}
|
1300
|
+
|
1301
|
+
function toService(route, parent) {
|
1302
|
+
var knownCollectionMethods = _.values(config.restangularFields);
|
1303
|
+
var serv = {};
|
1304
|
+
var collection = (parent || service).all(route);
|
1305
|
+
serv.one = _.bind(one, (parent || service), parent, route);
|
1306
|
+
serv.post = _.bind(collection.post, collection);
|
1307
|
+
serv.getList = _.bind(collection.getList, collection);
|
1308
|
+
|
1309
|
+
for (var prop in collection) {
|
1310
|
+
if (collection.hasOwnProperty(prop) && _.isFunction(collection[prop]) && !_.contains(knownCollectionMethods, prop)) {
|
1311
|
+
serv[prop] = _.bind(collection[prop], collection);
|
1312
|
+
}
|
1313
|
+
}
|
1314
|
+
|
1315
|
+
return serv;
|
1316
|
+
}
|
1317
|
+
|
1318
|
+
|
1319
|
+
Configurer.init(service, config);
|
1320
|
+
|
1321
|
+
service.copy = _.bind(copyRestangularizedElement, service);
|
1322
|
+
|
1323
|
+
service.service = _.bind(toService, service);
|
1324
|
+
|
1325
|
+
service.withConfig = _.bind(withConfigurationFunction, service);
|
1326
|
+
|
1327
|
+
service.one = _.bind(one, service, null);
|
1328
|
+
|
1329
|
+
service.all = _.bind(all, service, null);
|
1330
|
+
|
1331
|
+
service.several = _.bind(several, service, null);
|
1332
|
+
|
1333
|
+
service.oneUrl = _.bind(oneUrl, service, null);
|
1334
|
+
|
1335
|
+
service.allUrl = _.bind(allUrl, service, null);
|
1336
|
+
|
1337
|
+
service.stripRestangular = _.bind(stripRestangular, service);
|
1338
|
+
|
1339
|
+
service.restangularizeElement = _.bind(restangularizeElem, service);
|
1340
|
+
|
1341
|
+
service.restangularizeCollection = _.bind(restangularizeCollectionAndElements, service);
|
1342
|
+
|
1343
|
+
return service;
|
1344
|
+
}
|
1345
|
+
|
1346
|
+
return createServiceForConfiguration(globalConfiguration);
|
1347
|
+
}];
|
1348
|
+
});
|
1349
|
+
|
1350
|
+
})();
|