parse-stack 1.1.0 → 1.2

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: a1138b12b68494580dd0ca427544dc4780a52ddd
4
- data.tar.gz: f077b1ab3767c747c2257ab5f35539fbab5aa7a7
3
+ metadata.gz: bf40f379f94d3898e1137ebea7234f26ac72ba83
4
+ data.tar.gz: 465a943525167ee9d4f817d5b0591d2c930f4099
5
5
  SHA512:
6
- metadata.gz: 0c21522c5712cc64b2d7ec0c7842fb42e5514ef86460a8aee92e61238a926bad5f2cc0e9b27545de98fda0f5dfb700a596fad6847fa6b981cdd0e7b49a55c5f0
7
- data.tar.gz: ab980694c184fb24ed72ad8a9440703d189e98f9cef6c8d6c0ca7dba6760fbc8fcddf5846ebe4aeac0915aa0743d0a95e6a527c5519d503236713db8c1a8b22f
6
+ metadata.gz: 69209f3b6b89af9f4f7f0f91f4848a76497359b47300b75d662261482deded101bff8b80f5ce230671c2459da2789a9af7e7473af54d8efd7ff6bd7dfc8b1a15
7
+ data.tar.gz: cfca41f8ff74a8f4b3df8374d3e0de9ef47ee4ff25cd39df288f6f33dc8a01e6946b6d78580b09d74b5771d79e14e8a258a48c5e51ad7c7c7e22a5960ac0b68f
data/Changes.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Parse-Stack Changes
2
2
 
3
+ 1.2
4
+ -----------
5
+ - Fixes issues with first_or_create.
6
+ - Fixes issue when singularizing :belongs_to and :has_many property names.
7
+ - Makes sure time is sent as UTC in queries.
8
+ - Allows for authData to be applied as an update to a before_save for a Parse::User.
9
+ - Webhooks allow for returning empty data sets and `false` from webhook functions.
10
+ - Minimum version for ActiveModel and ActiveSupport is now 4.2.1
11
+
3
12
  1.1
4
13
  -----------
5
14
  - In Query `join` has been renamed to `matches`.
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- parse-stack (1.1.0)
4
+ parse-stack (1.2)
5
5
  active_model_serializers (>= 0.9, < 1)
6
- activemodel (>= 4, < 5)
7
- activesupport (>= 4, < 5)
6
+ activemodel (>= 4.2.1, < 5)
7
+ activesupport (>= 4.2.1, < 5)
8
8
  faraday (>= 0.8, < 1)
9
9
  faraday_middleware (>= 0.9, < 1)
10
10
  moneta (>= 0.7, < 1)
@@ -47,7 +47,7 @@ module Parse
47
47
  end
48
48
 
49
49
  class BatchOperation
50
- MAX_REQ_SEC = 40
50
+ MAX_REQ_SEC = 30
51
51
 
52
52
  attr_accessor :requests, :responses
53
53
  include Enumerable
@@ -30,10 +30,10 @@ module Parse
30
30
  # These items are added as attributes with the special data type of :pointer
31
31
  def belongs_to(key, opts = {})
32
32
  opts = {as: key, field: key.to_s.camelize(:lower), required: false}.merge(opts)
33
- className = opts[:as].to_parse_class
33
+ klassName = opts[:as].to_parse_class
34
34
  parse_field = opts[:field].to_sym
35
35
  if self.fields[key].present? && Parse::Properties::BASE_FIELD_MAP[key].nil?
36
- raise Parse::Properties::DefinitionError, "Belongs relation #{self}##{key} already defined with type #{className}"
36
+ raise Parse::Properties::DefinitionError, "Belongs relation #{self}##{key} already defined with type #{klassName}"
37
37
  end
38
38
  if self.fields[parse_field].present?
39
39
  raise Parse::Properties::DefinitionError, "Alias belongs_to #{self}##{parse_field} conflicts with previously defined property."
@@ -42,7 +42,7 @@ module Parse
42
42
  # we know the type is pointer.
43
43
  self.attributes.merge!( parse_field => :pointer )
44
44
  # Add them to our list of pointer references
45
- self.references.merge!( parse_field => className )
45
+ self.references.merge!( parse_field => klassName )
46
46
  # Add them to the list of fields in our class model
47
47
  self.fields.merge!( key => :pointer, parse_field => :pointer )
48
48
  # Mapping between local attribute name and the remote column name
@@ -69,7 +69,7 @@ module Parse
69
69
  # hash, lets try to buid a Pointer of that type.
70
70
 
71
71
  if val.is_a?(Hash) && ( val["__type"].freeze == "Pointer".freeze || val["__type"].freeze == "Object".freeze )
72
- val = Parse::Object.build val, ( val["className"] || className )
72
+ val = Parse::Object.build val, ( val["className"] || klassName )
73
73
  instance_variable_set ivar, val
74
74
  end
75
75
  val
@@ -87,7 +87,7 @@ module Parse
87
87
  # We only support pointers, either by object or by transforming a hash.
88
88
  define_method("#{key}_set_attribute!") do |val, track = true|
89
89
  if val.is_a?(Hash) && ( val["__type"].freeze == "Pointer".freeze || val["__type"].freeze == "Object".freeze )
90
- val = Parse::Object.build val, ( val["className"] || className )
90
+ val = Parse::Object.build val, ( val["className"] || klassName )
91
91
  end
92
92
  if track == true
93
93
  send :"#{key}_will_change!" unless val == instance_variable_get( :"@#{key}" )
@@ -62,7 +62,7 @@ module Parse
62
62
  required: false,
63
63
  as: key}.merge(opts)
64
64
 
65
- klassName = opts[:as].to_parse_class
65
+ klassName = opts[:as].to_parse_class singularize: true
66
66
  parse_field = opts[:field].to_sym
67
67
  access_type = opts[:through].to_sym
68
68
  # verify that the user did not duplicate properties or defined different properties with the same name
@@ -91,8 +91,8 @@ class String
91
91
  end;
92
92
 
93
93
  #users for properties: ex. :users -> "_User" or :songs -> Song
94
- def to_parse_class
95
- final_class = self.singularize.camelize
94
+ def to_parse_class(singularize: false)
95
+ final_class = singularize ? self.singularize.camelize : self.camelize
96
96
  klass = Parse::Model.find_class(final_class) || Parse::Model.find_class(self)
97
97
  #handles the case that a class has a custom parse table
98
98
  final_class = klass.parse_class if klass.present?
@@ -114,7 +114,7 @@ class Symbol
114
114
  to_s.camelize
115
115
  end
116
116
 
117
- def to_parse_class
118
- to_s.to_parse_class
117
+ def to_parse_class(singularize: false)
118
+ to_s.to_parse_class(singularize: singularize)
119
119
  end
120
120
  end
data/lib/parse/query.rb CHANGED
@@ -270,7 +270,7 @@ module Parse
270
270
  def first(limit = 1)
271
271
  @results = nil
272
272
  @limit = limit
273
- results.first(limit)
273
+ limit == 1 ? results.first : results.first(limit)
274
274
  end
275
275
 
276
276
  def max_results(raw: false)
@@ -116,6 +116,7 @@ module Parse
116
116
  # This method formats the value based on some specific data types.
117
117
  def formatted_value
118
118
  d = @value
119
+ d = { __type: "Date", iso: d.utc.iso8601(3) } if d.respond_to?(:utc)
119
120
  d = { __type: "Date", iso: d.iso8601(3) } if d.respond_to?(:iso8601)
120
121
  d = d.pointer if d.respond_to?(:pointer) #simplified query object
121
122
  d = d.to_s if d.is_a?(Regexp)
@@ -1,5 +1,5 @@
1
1
  module Parse
2
2
  module Stack
3
- VERSION = "1.1.0"
3
+ VERSION = "1.2"
4
4
  end
5
5
  end
@@ -209,7 +209,7 @@ module Parse
209
209
  puts "[ParseWebhooks] --> Could not find mapping route for #{payload}"
210
210
  end
211
211
 
212
- result = true if result.blank?
212
+ result = true if result.nil?
213
213
  if self.logging.present?
214
214
  puts "[ParseWebhooks Response] ----------------------------"
215
215
  puts success(result)
@@ -27,7 +27,7 @@ module Parse
27
27
  @object = hash[:object]
28
28
  @trigger_name = hash[:trigger_name]
29
29
  @original = hash[:original]
30
- @update = hash[:update] #it comes as an update hash
30
+ @update = hash[:update] || {} #it comes as an update hash
31
31
  end
32
32
 
33
33
  def function?
@@ -93,6 +93,10 @@ module Parse
93
93
  if @original.present? && @original.is_a?(Hash)
94
94
  o = Parse::Object.build @original
95
95
  o.apply_attributes! @object, dirty_track: true
96
+
97
+ if o.is_a?(Parse::User) && @update.present? && @update["authData"].present?
98
+ o.auth_data = @update["authData"]
99
+ end
96
100
  return o
97
101
  else #else the object must be new
98
102
  klass = Parse::Object.find_class parse_class
data/parse-stack.gemspec CHANGED
@@ -26,8 +26,8 @@ Gem::Specification.new do |spec|
26
26
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
27
  spec.require_paths = ["lib"]
28
28
 
29
- spec.add_runtime_dependency "activemodel", [">= 4", "< 5"]
30
- spec.add_runtime_dependency "activesupport", [">= 4", "< 5"]
29
+ spec.add_runtime_dependency "activemodel", [">= 4.2.1", "< 5"]
30
+ spec.add_runtime_dependency "activesupport", [">= 4.2.1", "< 5"]
31
31
  spec.add_runtime_dependency "active_model_serializers", [">= 0.9", "< 1"]
32
32
  spec.add_runtime_dependency "parallel", [">= 1.6", "< 2"]
33
33
  spec.add_runtime_dependency "faraday", [">= 0.8", "< 1"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parse-stack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: '1.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Persaud
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-04-12 00:00:00.000000000 Z
12
+ date: 2016-06-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel
@@ -17,7 +17,7 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '4'
20
+ version: 4.2.1
21
21
  - - "<"
22
22
  - !ruby/object:Gem::Version
23
23
  version: '5'
@@ -27,7 +27,7 @@ dependencies:
27
27
  requirements:
28
28
  - - ">="
29
29
  - !ruby/object:Gem::Version
30
- version: '4'
30
+ version: 4.2.1
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '5'
@@ -37,7 +37,7 @@ dependencies:
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '4'
40
+ version: 4.2.1
41
41
  - - "<"
42
42
  - !ruby/object:Gem::Version
43
43
  version: '5'
@@ -47,7 +47,7 @@ dependencies:
47
47
  requirements:
48
48
  - - ">="
49
49
  - !ruby/object:Gem::Version
50
- version: '4'
50
+ version: 4.2.1
51
51
  - - "<"
52
52
  - !ruby/object:Gem::Version
53
53
  version: '5'