pinkman 0.9.3.6 → 0.9.3.7

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
  SHA1:
3
- metadata.gz: 63025f24163cd79085a8e308096e7dbb59cb22b2
4
- data.tar.gz: a641d4f33cdd87b939dee9d81fbc0452c1ebf6c4
3
+ metadata.gz: 4776976b67e1c7879b2b8d51fe34ad58c153bf2d
4
+ data.tar.gz: b03e22a6384a89439da1202dccc136311e329ab7
5
5
  SHA512:
6
- metadata.gz: 04f51be10fa4480329805094048e9d62d58114c6318477af2aa294631d9801fde17538ecfc67c9c592f46a844fd3e4323f319436eeb1bef3151a076c59069b59
7
- data.tar.gz: f0b9404662c7e6fe004c157ea4b5c7121d6a946b86a1b47a823cbaaf563e7b4085dbbf8fad71a9de006f228d40f75f34d787d37603adc0ea3201384e3e7553bc
6
+ metadata.gz: 3ebbf417cbc561dddb3514be70e008de4d8eb2029a5aeb216eed1dfc43f301ce4f17a92c0ae191e27643f490ad990f854c340ec203b43bd7da66b8f5bf74be31
7
+ data.tar.gz: 97422fba084dd7c8b6c20d633d11f776c22da3074541c3f136b4a65a901146a8f7fbfbb188b75b1d60a5cf6b6f664feeda92924f1f315871b946b9b817e6e97f
@@ -4,7 +4,7 @@ class window.PinkmanCommon
4
4
  @initialize(attributesObject) if attributesObject?
5
5
 
6
6
  @privateAttributes = ['isPink','isObject','isCollection','pinkey','config','pinkmanType','collections','renderQueue']
7
-
7
+
8
8
  @mixin: (args...) ->
9
9
  Pinkman.mixin(args...)
10
10
 
@@ -23,10 +23,10 @@ class window.PinkmanCommon
23
23
  api: () ->
24
24
  if @config? and @config.api?
25
25
  if @config.api.charAt(0) == '/'
26
- @config.api + '/'
26
+ @config.api + '/'
27
27
  else
28
- '/' + @config.api + '/'
29
-
28
+ '/' + @config.api + '/'
29
+
30
30
  isInstanceOf: (prot) ->
31
31
  this.constructor is prot
32
32
 
@@ -37,7 +37,7 @@ class window.PinkmanCommon
37
37
  @config.className
38
38
  else
39
39
  @constructor.name
40
-
40
+
41
41
  # Desc: set a pair of key/value for this object. Triggers reRender if watch is active.
42
42
  # Usage:
43
43
  # a.set 'a', 'b', (a) ->
@@ -68,7 +68,7 @@ class window.PinkmanCommon
68
68
  @reRender()
69
69
 
70
70
  reRender: (callback='') ->
71
- Pinkman.reRender(this)
71
+ Pinkman.reRender(this)
72
72
  callback(this) if typeof callback == 'function'
73
73
  return this
74
74
 
@@ -118,4 +118,8 @@ class window.PinkmanCommon
118
118
  @hasErrorOn(args...)
119
119
 
120
120
  anyErrorsOn: (args...) ->
121
- @hasErrorOn(args...)
121
+ @hasErrorOn(args...)
122
+
123
+
124
+ _data: ->
125
+ { pink_obj: @json(), scope: Pinkman.scope(this) }
@@ -22,7 +22,7 @@ class window.PinkmanObject extends window.PinkmanCommon
22
22
  if typeof v == 'object' and v? and this[k]? and this[k].isPink and not v.isPink
23
23
  this[k].assign(v)
24
24
  else
25
- this.set(k,v)
25
+ this.set(k,v)
26
26
  return true
27
27
  else
28
28
  return false
@@ -51,7 +51,7 @@ class window.PinkmanObject extends window.PinkmanCommon
51
51
  else
52
52
  a[k] = v
53
53
  return a
54
-
54
+
55
55
  # Desc: returns a array of attributes keys
56
56
  # Usage:
57
57
  # a.set('a','b'); a.set('x',value)
@@ -70,7 +70,7 @@ class window.PinkmanObject extends window.PinkmanCommon
70
70
  array.push "#{a}: #{this[a]};"
71
71
  array.join(" ")
72
72
 
73
- # --- Collection related functions --- #
73
+ # --- Collection related functions --- #
74
74
 
75
75
  # Desc: return the next obj (after this) in a collection
76
76
  # Try to guess the collection if not provided
@@ -125,22 +125,22 @@ class window.PinkmanObject extends window.PinkmanCommon
125
125
  params = new Object
126
126
  params.scope = Pinkman.scope(this)
127
127
 
128
- Pinkman.ajax.get
128
+ Pinkman.ajax.get
129
129
  url: Pinkman.json2url(obj.api() + id,params)
130
130
  complete: (response) ->
131
131
  obj.assign(response)
132
- if obj.error? or obj.errors?
132
+ if obj.error? or obj.errors?
133
133
  throw new Error(obj.firstError())
134
134
  return false
135
135
  else
136
136
  callback(obj) if callback? and typeof callback == 'function'
137
137
  return(obj)
138
-
138
+
139
139
  create: (callback='') ->
140
140
  unless @id?
141
141
  Pinkman.ajax.post
142
142
  url: @api()
143
- data: { pink_obj: @json(), scope: Pinkman.scope(this) }
143
+ data: @_data()
144
144
  complete: (response) =>
145
145
  @assign(response)
146
146
  delete @errors unless response.errors?
@@ -151,7 +151,7 @@ class window.PinkmanObject extends window.PinkmanCommon
151
151
  if @id?
152
152
  Pinkman.ajax.patch
153
153
  url: @api() + @id
154
- data: { pink_obj: @json(), scope: Pinkman.scope(this) }
154
+ data: @_data()
155
155
  complete: (response) =>
156
156
  @assign(response)
157
157
  delete @errors unless response.errors?
@@ -161,17 +161,17 @@ class window.PinkmanObject extends window.PinkmanCommon
161
161
  reload: (callback) ->
162
162
  params = new Object
163
163
  params.scope = Pinkman.scope(this)
164
- Pinkman.ajax.get
164
+ Pinkman.ajax.get
165
165
  url: Pinkman.json2url(@api() + @id,params)
166
166
  complete: (response) =>
167
167
  @assign(response)
168
- if @error? or @errors?
168
+ if @error? or @errors?
169
169
  throw new Error(@firstError())
170
170
  return false
171
171
  else
172
172
  callback(this) if callback? and typeof callback == 'function'
173
173
  return(this)
174
-
174
+
175
175
  updateAttributes: (obj) ->
176
176
  if this.assign(obj)
177
177
  this.save (obj) ->
@@ -181,7 +181,7 @@ class window.PinkmanObject extends window.PinkmanCommon
181
181
 
182
182
  save: (callback='') ->
183
183
  if @id? and @id!='' then @update(callback) else @create(callback)
184
-
184
+
185
185
  destroy: (callback='') ->
186
186
  if @id?
187
187
  @removeFromAllCollections()
@@ -211,4 +211,4 @@ class window.PinkmanObject extends window.PinkmanCommon
211
211
  else
212
212
  return(false)
213
213
 
214
- window.Pinkman.object = window.PinkmanObject
214
+ window.Pinkman.object = window.PinkmanObject
@@ -1,3 +1,3 @@
1
1
  module Pinkman
2
- VERSION = "0.9.3.6"
2
+ VERSION = "0.9.3.7"
3
3
  end
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: 0.9.3.6
4
+ version: 0.9.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Agilso Oliveira
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-07 00:00:00.000000000 Z
11
+ date: 2017-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler