pinkman 1.3.7 → 1.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 77969e0086edd331ff68a4ab02d1a3fae64117c1aa0b6801cb9f49e8c6ca7235
|
|
4
|
+
data.tar.gz: 1b102738539bdec1878260ec63a9183b4ae22dfc217686c8c3c7a2616c55e0c2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e74eb5d9bbc15701b0c378f2016a784066539d8f819ea516e518c06253f3cc46bddb22968c189f8a18dffefb44ee444cf0c87947a64e30dff8078316556971bb
|
|
7
|
+
data.tar.gz: de9f9cc1deefe6f1a07e1fcb402de22d0753ced97c954d74b2fa9cddfed648cb29221f9df042cb3a18f6b6d1eef7e452538eae7eb3d72d2f953c8991154dd9d0
|
|
@@ -519,10 +519,23 @@ class window.PinkmanCollection extends window.PinkmanCommon
|
|
|
519
519
|
|
|
520
520
|
# --- Cache Related --- #
|
|
521
521
|
|
|
522
|
+
@mangleKey: (key) ->
|
|
523
|
+
@startCaching() unless @_name_md5
|
|
524
|
+
@_name_md5 + key
|
|
525
|
+
|
|
526
|
+
@cache: (key, value) ->
|
|
527
|
+
$c.cache(@mangleKey(key), value)
|
|
528
|
+
|
|
529
|
+
@hasCache: (key) ->
|
|
530
|
+
$c.has(@mangleKey(key))
|
|
531
|
+
|
|
532
|
+
@getCache: (key, callback) ->
|
|
533
|
+
$c.get(@mangleKey(key), callback)
|
|
534
|
+
|
|
522
535
|
@startCaching: () ->
|
|
523
536
|
# cache structure
|
|
524
537
|
@_name_md5 = md5(if @name then @name else @toString()) unless @_name_md5?
|
|
525
|
-
$c.cache(@_name_md5, new this) unless $c.has(@_name_md5)
|
|
538
|
+
# $c.cache(@_name_md5, new this) unless $c.has(@_name_md5)
|
|
526
539
|
|
|
527
540
|
# --- Ajax related --- #
|
|
528
541
|
|
|
@@ -542,25 +555,23 @@ class window.PinkmanCollection extends window.PinkmanCommon
|
|
|
542
555
|
|
|
543
556
|
@get: (options) ->
|
|
544
557
|
if $p.isObject(options) and (options.query? or options.params?) and $p.isFunction(options.callback)
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
if options.cache and $c.has(query_md5)
|
|
550
|
-
$c.get(query_md5, options.callback)
|
|
558
|
+
options.cache = false unless options.cache?
|
|
559
|
+
query_md5 = $p.objHash(options)
|
|
560
|
+
if options.cache and @hasCache(query_md5)
|
|
561
|
+
@getCache(query_md5, options.callback)
|
|
551
562
|
else
|
|
552
563
|
col = new this
|
|
553
564
|
obj = new col.config.memberClass
|
|
554
565
|
params = new Object
|
|
555
566
|
params.scope = options.scope || Pinkman.scope(obj)
|
|
556
567
|
params.query = options.query
|
|
557
|
-
params =
|
|
558
|
-
|
|
568
|
+
params = $p.mergeObjects(params, options.params)
|
|
569
|
+
$p.ajax.get
|
|
559
570
|
url: options.url || obj.api('get')
|
|
560
571
|
data: params
|
|
561
572
|
complete: (response) =>
|
|
562
573
|
col.fetchFromArray(response)
|
|
563
|
-
|
|
574
|
+
@cache(query_md5, col)
|
|
564
575
|
options.callback(col)
|
|
565
576
|
else
|
|
566
577
|
throw "Pinkman Error: collection.get invalid options #{options.toString()}"
|
|
@@ -622,7 +633,6 @@ class window.PinkmanCollection extends window.PinkmanCommon
|
|
|
622
633
|
if options? and typeof options == 'object' and options.url?
|
|
623
634
|
options_md5 = md5(JSON.stringify(options) + @className())
|
|
624
635
|
options.params = new Object unless options.params?
|
|
625
|
-
options.cache = yes unless options.cache?
|
|
626
636
|
if options.scope?
|
|
627
637
|
options.params.scope = options.scope
|
|
628
638
|
else
|
|
@@ -633,12 +643,11 @@ class window.PinkmanCollection extends window.PinkmanCommon
|
|
|
633
643
|
Pinkman.ajax.get
|
|
634
644
|
url: Pinkman.json2url(options.url, options.params)
|
|
635
645
|
complete: (response) =>
|
|
636
|
-
$c.cache(options_md5, response) if options.cache
|
|
637
646
|
@handleFetchResponse(response, options)
|
|
638
647
|
return(this)
|
|
639
648
|
|
|
640
|
-
handleFetchResponse: (response,options) ->
|
|
641
|
-
@constructor.startCaching()
|
|
649
|
+
handleFetchResponse: (response, options) ->
|
|
650
|
+
# @constructor.startCaching()
|
|
642
651
|
if response?
|
|
643
652
|
[@errors, @error] = [response.errors, response.error] if response.errors? or response.error?
|
|
644
653
|
|
|
@@ -652,7 +661,7 @@ class window.PinkmanCollection extends window.PinkmanCommon
|
|
|
652
661
|
|
|
653
662
|
if response.length > 0
|
|
654
663
|
# CACHING INSTANCES
|
|
655
|
-
$c.get(@constructor._name_md5).fetchFromArray(response)
|
|
664
|
+
# $c.get(@constructor._name_md5).fetchFromArray(response)
|
|
656
665
|
|
|
657
666
|
@_recent.fetchFromArray(response)
|
|
658
667
|
@fetchFromArray(response)
|
data/lib/pinkman/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pinkman
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.
|
|
4
|
+
version: 1.3.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Agilso Oliveira
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-08-
|
|
11
|
+
date: 2019-08-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|