parse-stack 1.8.0 → 1.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.solargraph.yml +23 -0
  3. data/.travis.yml +0 -1
  4. data/Gemfile +13 -12
  5. data/Gemfile.lock +88 -51
  6. data/README.md +2 -4
  7. data/Rakefile +14 -14
  8. data/lib/parse/api/aggregate.rb +4 -7
  9. data/lib/parse/api/all.rb +1 -1
  10. data/lib/parse/api/analytics.rb +0 -3
  11. data/lib/parse/api/batch.rb +3 -5
  12. data/lib/parse/api/cloud_functions.rb +0 -3
  13. data/lib/parse/api/config.rb +0 -4
  14. data/lib/parse/api/files.rb +3 -7
  15. data/lib/parse/api/hooks.rb +4 -8
  16. data/lib/parse/api/objects.rb +7 -12
  17. data/lib/parse/api/push.rb +0 -4
  18. data/lib/parse/api/schema.rb +2 -6
  19. data/lib/parse/api/server.rb +4 -7
  20. data/lib/parse/api/sessions.rb +2 -5
  21. data/lib/parse/api/users.rb +9 -14
  22. data/lib/parse/client.rb +54 -50
  23. data/lib/parse/client/authentication.rb +29 -33
  24. data/lib/parse/client/batch.rb +8 -11
  25. data/lib/parse/client/body_builder.rb +19 -20
  26. data/lib/parse/client/caching.rb +23 -28
  27. data/lib/parse/client/protocol.rb +11 -12
  28. data/lib/parse/client/request.rb +4 -6
  29. data/lib/parse/client/response.rb +5 -7
  30. data/lib/parse/model/acl.rb +14 -12
  31. data/lib/parse/model/associations/belongs_to.rb +14 -21
  32. data/lib/parse/model/associations/collection_proxy.rb +328 -329
  33. data/lib/parse/model/associations/has_many.rb +18 -25
  34. data/lib/parse/model/associations/has_one.rb +6 -11
  35. data/lib/parse/model/associations/pointer_collection_proxy.rb +5 -8
  36. data/lib/parse/model/associations/relation_collection_proxy.rb +5 -9
  37. data/lib/parse/model/bytes.rb +8 -10
  38. data/lib/parse/model/classes/installation.rb +2 -4
  39. data/lib/parse/model/classes/product.rb +2 -5
  40. data/lib/parse/model/classes/role.rb +3 -5
  41. data/lib/parse/model/classes/session.rb +2 -5
  42. data/lib/parse/model/classes/user.rb +20 -16
  43. data/lib/parse/model/core/actions.rb +31 -46
  44. data/lib/parse/model/core/builder.rb +6 -6
  45. data/lib/parse/model/core/errors.rb +0 -1
  46. data/lib/parse/model/core/fetching.rb +45 -50
  47. data/lib/parse/model/core/properties.rb +51 -66
  48. data/lib/parse/model/core/querying.rb +291 -294
  49. data/lib/parse/model/core/schema.rb +89 -92
  50. data/lib/parse/model/date.rb +16 -17
  51. data/lib/parse/model/file.rb +171 -174
  52. data/lib/parse/model/geopoint.rb +12 -16
  53. data/lib/parse/model/model.rb +31 -37
  54. data/lib/parse/model/object.rb +47 -53
  55. data/lib/parse/model/pointer.rb +177 -176
  56. data/lib/parse/model/push.rb +8 -10
  57. data/lib/parse/model/shortnames.rb +1 -2
  58. data/lib/parse/model/time_zone.rb +3 -5
  59. data/lib/parse/query.rb +34 -35
  60. data/lib/parse/query/constraint.rb +4 -6
  61. data/lib/parse/query/constraints.rb +21 -29
  62. data/lib/parse/query/operation.rb +8 -11
  63. data/lib/parse/query/ordering.rb +45 -49
  64. data/lib/parse/stack.rb +11 -12
  65. data/lib/parse/stack/generators/rails.rb +28 -30
  66. data/lib/parse/stack/generators/templates/model.erb +5 -6
  67. data/lib/parse/stack/generators/templates/model_installation.rb +0 -1
  68. data/lib/parse/stack/generators/templates/model_role.rb +0 -1
  69. data/lib/parse/stack/generators/templates/model_session.rb +0 -1
  70. data/lib/parse/stack/generators/templates/model_user.rb +0 -1
  71. data/lib/parse/stack/generators/templates/parse.rb +9 -9
  72. data/lib/parse/stack/generators/templates/webhooks.rb +1 -2
  73. data/lib/parse/stack/railtie.rb +2 -4
  74. data/lib/parse/stack/tasks.rb +70 -86
  75. data/lib/parse/stack/version.rb +1 -1
  76. data/lib/parse/webhooks.rb +19 -26
  77. data/lib/parse/webhooks/payload.rb +26 -28
  78. data/lib/parse/webhooks/registration.rb +23 -31
  79. data/parse-stack.gemspec +25 -25
  80. data/parse-stack.png +0 -0
  81. metadata +13 -7
  82. data/.github/parse-ruby-sdk.png +0 -0
@@ -1,15 +1,14 @@
1
1
  # encoding: UTF-8
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'faraday'
5
- require 'faraday_middleware'
6
- require 'active_support'
7
- require 'active_support/core_ext'
4
+ require "faraday"
5
+ require "faraday_middleware"
6
+ require "active_support"
7
+ require "active_support/core_ext"
8
8
 
9
- require_relative 'protocol'
9
+ require_relative "protocol"
10
10
 
11
11
  module Parse
12
-
13
12
  module Middleware
14
13
  # This middleware handles sending the proper authentication headers to the
15
14
  # Parse REST API endpoint.
@@ -53,38 +52,35 @@ module Parse
53
52
 
54
53
  # @!visibility private
55
54
  def call!(env)
56
- # We add the main Parse protocol headers
57
- headers = {}
58
- raise ArgumentError, "No Parse Application Id specified for authentication." unless @application_id.present?
59
- headers[APP_ID] = @application_id
60
- headers[API_KEY] = @api_key unless @api_key.blank?
61
- unless @master_key.blank? || env[:request_headers][DISABLE_MASTER_KEY].present?
62
- headers[MASTER_KEY] = @master_key
63
- end
55
+ # We add the main Parse protocol headers
56
+ headers = {}
57
+ raise ArgumentError, "No Parse Application Id specified for authentication." unless @application_id.present?
58
+ headers[APP_ID] = @application_id
59
+ headers[API_KEY] = @api_key unless @api_key.blank?
60
+ unless @master_key.blank? || env[:request_headers][DISABLE_MASTER_KEY].present?
61
+ headers[MASTER_KEY] = @master_key
62
+ end
64
63
 
65
- env[:request_headers].delete(DISABLE_MASTER_KEY)
64
+ env[:request_headers].delete(DISABLE_MASTER_KEY)
66
65
 
67
- # delete the use of master key if we are using session token.
68
- if env[:request_headers].key?(Parse::Protocol::SESSION_TOKEN)
69
- headers.delete(MASTER_KEY)
70
- end
71
- # merge the headers with the current provided headers
72
- env[:request_headers].merge! headers
73
- # set the content type of the request if it was not provided already.
74
- env[:request_headers][CONTENT_TYPE] ||= @content_type
75
- # only modify header
66
+ # delete the use of master key if we are using session token.
67
+ if env[:request_headers].key?(Parse::Protocol::SESSION_TOKEN)
68
+ headers.delete(MASTER_KEY)
69
+ end
70
+ # merge the headers with the current provided headers
71
+ env[:request_headers].merge! headers
72
+ # set the content type of the request if it was not provided already.
73
+ env[:request_headers][CONTENT_TYPE] ||= @content_type
74
+ # only modify header
76
75
 
77
- @app.call(env).on_complete do |response_env|
78
- # check for return code raise an error when authentication was a failure
79
- # if response_env[:status] == 401
80
- # warn "Unauthorized Parse API Credentials for Application Id: #{@application_id}"
81
- # end
76
+ @app.call(env).on_complete do |response_env|
77
+ # check for return code raise an error when authentication was a failure
78
+ # if response_env[:status] == 401
79
+ # warn "Unauthorized Parse API Credentials for Application Id: #{@application_id}"
80
+ # end
82
81
 
83
- end
82
+ end
84
83
  end
85
-
86
84
  end # Authenticator
87
-
88
85
  end
89
-
90
86
  end
@@ -1,9 +1,8 @@
1
1
  # encoding: UTF-8
2
2
  # frozen_string_literal: true
3
3
 
4
- require_relative 'request'
5
- require_relative 'response'
6
-
4
+ require_relative "request"
5
+ require_relative "response"
7
6
 
8
7
  module Parse
9
8
  # Create a new batch operation.
@@ -44,7 +43,6 @@ module Parse
44
43
  # @return [Array] the set of responses from this batch.
45
44
  attr_accessor :requests, :responses
46
45
 
47
-
48
46
  # @return [Parse::Client] the client to be used for the request.
49
47
  def client
50
48
  @client ||= Parse::Client.client
@@ -94,7 +92,7 @@ module Parse
94
92
 
95
93
  # @return [Hash] a formatted payload for the batch request.
96
94
  def as_json(*args)
97
- { requests: requests }.as_json
95
+ { requests: requests }.as_json
98
96
  end
99
97
 
100
98
  # @return [Integer] the number of requests in the batch.
@@ -117,7 +115,7 @@ module Parse
117
115
  # @return [Boolean] true if the request had an error.
118
116
  def error?
119
117
  return false if @responses.empty?
120
- ! success?
118
+ !success?
121
119
  end
122
120
 
123
121
  # Submit the batch operation in chunks until they are all complete. In general,
@@ -131,16 +129,15 @@ module Parse
131
129
  @responses = []
132
130
  @requests.uniq!(&:signature)
133
131
  @responses = @requests.each_slice(segment).to_a.threaded_map(2) do |slice|
134
- client.batch_request( BatchOperation.new(slice) )
132
+ client.batch_request(BatchOperation.new(slice))
135
133
  end
136
134
  @responses.flatten!
137
135
  #puts "Requests: #{@requests.count} == Response: #{@responses.count}"
138
136
  @requests.zip(@responses).each(&Proc.new) if block_given?
139
137
  @responses
140
138
  end
141
- alias_method :save, :submit
142
-
143
139
 
140
+ alias_method :save, :submit
144
141
  end
145
142
  end
146
143
 
@@ -164,6 +161,7 @@ class Array
164
161
  batch.submit
165
162
  batch
166
163
  end
164
+
167
165
  # Do not alias method as :delete is already part of array.
168
166
  # alias_method :delete, :destroy
169
167
 
@@ -204,11 +202,10 @@ class Array
204
202
  o = objects[request.tag]
205
203
  next unless o.is_a?(Parse::Object)
206
204
  result = response.result
207
- o.id = result['objectId'] if o.id.blank?
205
+ o.id = result["objectId"] if o.id.blank?
208
206
  o.set_attributes!(result)
209
207
  o.clear_changes!
210
208
  end
211
209
  batch
212
210
  end #save!
213
-
214
211
  end
@@ -1,13 +1,13 @@
1
1
  # encoding: UTF-8
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'faraday'
5
- require 'faraday_middleware'
6
- require_relative 'response'
7
- require_relative 'protocol'
8
- require 'active_support'
9
- require 'active_support/core_ext'
10
- require 'active_model_serializers'
4
+ require "faraday"
5
+ require "faraday_middleware"
6
+ require_relative "response"
7
+ require_relative "protocol"
8
+ require "active_support"
9
+ require "active_support/core_ext"
10
+ require "active_model_serializers"
11
11
 
12
12
  module Parse
13
13
 
@@ -30,7 +30,7 @@ module Parse
30
30
  class BodyBuilder < Faraday::Middleware
31
31
  include Parse::Protocol
32
32
  # Header sent when a GET requests exceeds the limit.
33
- HTTP_METHOD_OVERRIDE = 'X-Http-Method-Override'
33
+ HTTP_METHOD_OVERRIDE = "X-Http-Method-Override"
34
34
  # Maximum url length for most server requests before HTTP Method Override is used.
35
35
  MAX_URL_LENGTH = 2_000.freeze
36
36
  class << self
@@ -53,28 +53,28 @@ module Parse
53
53
  # to be POST instead of GET and send the query parameters in the body of the POST request.
54
54
  # The standard maximum POST request (which is a server setting), is usually set to 20MBs
55
55
  if env[:method] == :get && env[:url].to_s.length >= MAX_URL_LENGTH
56
- env[:request_headers][HTTP_METHOD_OVERRIDE] = 'GET'
57
- env[:request_headers][CONTENT_TYPE] = 'application/x-www-form-urlencoded'
56
+ env[:request_headers][HTTP_METHOD_OVERRIDE] = "GET"
57
+ env[:request_headers][CONTENT_TYPE] = "application/x-www-form-urlencoded"
58
58
  # parse-sever looks for method overrides in the body under the `_method` param.
59
59
  # so we will add it to the query string, which will now go into the body.
60
60
  env[:body] = "_method=GET&" + env[:url].query
61
61
  env[:url].query = nil
62
62
  #override
63
63
  env[:method] = :post
64
- # else if not a get, always make sure the request is JSON encoded if the content type matches
64
+ # else if not a get, always make sure the request is JSON encoded if the content type matches
65
65
  elsif env[:request_headers][CONTENT_TYPE] == CONTENT_TYPE_FORMAT &&
66
- (env[:body].is_a?(Hash) || env[:body].is_a?(Array))
67
- env[:body] = env[:body].to_json
66
+ (env[:body].is_a?(Hash) || env[:body].is_a?(Array))
67
+ env[:body] = env[:body].to_json
68
68
  end
69
69
 
70
70
  if self.class.logging
71
- puts "[Request #{env.method.upcase}] #{env[:url]}"
72
- env[:request_headers].each do |k,v|
73
- next if k == Parse::Protocol::MASTER_KEY
74
- puts "[Header] #{k} : #{v}"
75
- end
71
+ puts "[Request #{env.method.upcase}] #{env[:url]}"
72
+ env[:request_headers].each do |k, v|
73
+ next if k == Parse::Protocol::MASTER_KEY
74
+ puts "[Header] #{k} : #{v}"
75
+ end
76
76
 
77
- puts "[Request Body] #{env[:body]}"
77
+ puts "[Request Body] #{env[:body]}"
78
78
  end
79
79
  @app.call(env).on_complete do |response_env|
80
80
  # on a response, create a new Parse::Response and replace the :body
@@ -98,7 +98,6 @@ module Parse
98
98
  response_env[:body] = r
99
99
  end
100
100
  end
101
-
102
101
  end
103
102
  end #Middleware
104
103
  end
@@ -1,10 +1,10 @@
1
1
  # encoding: UTF-8
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'faraday'
5
- require 'faraday_middleware'
6
- require 'moneta'
7
- require_relative 'protocol'
4
+ require "faraday"
5
+ require "faraday_middleware"
6
+ require "moneta"
7
+ require_relative "protocol"
8
8
 
9
9
  module Parse
10
10
  module Middleware
@@ -28,13 +28,13 @@ module Parse
28
28
  # * 410 - 'Gone' - removed
29
29
  CACHEABLE_HTTP_CODES = [200, 203, 300, 301, 302].freeze
30
30
  # Cache control header
31
- CACHE_CONTROL = 'Cache-Control'
31
+ CACHE_CONTROL = "Cache-Control"
32
32
  # Request env key for the content length
33
- CONTENT_LENGTH_KEY = 'content-length'
33
+ CONTENT_LENGTH_KEY = "content-length"
34
34
  # Header in response that is sent if this is a cached result
35
- CACHE_RESPONSE_HEADER = 'X-Cache-Response'
35
+ CACHE_RESPONSE_HEADER = "X-Cache-Response"
36
36
  # Header in request to set caching information for the middleware.
37
- CACHE_EXPIRES_DURATION = 'X-Parse-Stack-Cache-Expires'
37
+ CACHE_EXPIRES_DURATION = "X-Parse-Stack-Cache-Expires"
38
38
 
39
39
  class << self
40
40
  # @!attribute enabled
@@ -46,15 +46,14 @@ module Parse
46
46
  attr_accessor :logging
47
47
 
48
48
  def enabled
49
- @enabled = true if @enabled.nil?
50
- @enabled
49
+ @enabled = true if @enabled.nil?
50
+ @enabled
51
51
  end
52
52
 
53
53
  # @return [Boolean] whether caching is enabled.
54
54
  def caching?
55
55
  @enabled
56
56
  end
57
-
58
57
  end
59
58
 
60
59
  # @!attribute [rw] store
@@ -77,14 +76,13 @@ module Parse
77
76
  def initialize(adapter, store, opts = {})
78
77
  super(adapter)
79
78
  @store = store
80
- @opts = {expires: 0}
79
+ @opts = { expires: 0 }
81
80
  @opts.merge!(opts) if opts.is_a?(Hash)
82
81
  @expires = @opts[:expires]
83
82
 
84
83
  unless [:key?, :[], :delete, :store].all? { |method| @store.respond_to?(method) }
85
84
  raise ArgumentError, "Caching store object must a Moneta key/value store."
86
85
  end
87
-
88
86
  end
89
87
 
90
88
  # Thread-safety
@@ -95,7 +93,7 @@ module Parse
95
93
 
96
94
  # @!visibility private
97
95
  def call!(env)
98
- @request_headers = env[:request_headers]
96
+ @request_headers = env[:request_headers]
99
97
 
100
98
  # get default caching state
101
99
  @enabled = self.class.enabled
@@ -151,8 +149,8 @@ module Parse
151
149
  end
152
150
 
153
151
  if cache_data.present? && body.present?
154
- response_headers[CACHE_RESPONSE_HEADER] = 'true'
155
- response.finish({status: 200, response_headers: response_headers, body: body })
152
+ response_headers[CACHE_RESPONSE_HEADER] = "true"
153
+ response.finish({ status: 200, response_headers: response_headers, body: body })
156
154
  return response
157
155
  else
158
156
  @store.delete @cache_key
@@ -177,23 +175,20 @@ module Parse
177
175
  # Only cache GET requests with valid HTTP status codes whose content-length
178
176
  # is between 20 bytes and 1MB. Otherwise they could be errors, successes and empty result sets.
179
177
 
180
- if @enabled && method == :get && CACHEABLE_HTTP_CODES.include?(response_env.status) &&
181
- response_env.body.present? && response_env.response_headers[CONTENT_LENGTH_KEY].to_i.between?(20,1_250_000)
182
- begin
183
- @store.store(@cache_key,
184
- { headers: response_env.response_headers, body: response_env.body },
185
- expires: @expires)
186
- rescue => e
187
- puts "[Parse::Cache] Store Error: #{e}"
188
- end
178
+ if @enabled && method == :get && CACHEABLE_HTTP_CODES.include?(response_env.status) &&
179
+ response_env.body.present? && response_env.response_headers[CONTENT_LENGTH_KEY].to_i.between?(20, 1_250_000)
180
+ begin
181
+ @store.store(@cache_key,
182
+ { headers: response_env.response_headers, body: response_env.body },
183
+ expires: @expires)
184
+ rescue => e
185
+ puts "[Parse::Cache] Store Error: #{e}"
186
+ end
189
187
  end # if
190
188
  # do something with the response
191
189
  # response_env[:response_headers].merge!(...)
192
190
  end
193
191
  end
194
-
195
192
  end #Caching
196
-
197
193
  end #Middleware
198
-
199
194
  end
@@ -1,32 +1,31 @@
1
1
  # encoding: UTF-8
2
2
  # frozen_string_literal: true
3
3
 
4
-
5
4
  module Parse
6
5
  # Set of Parse protocol constants.
7
6
  module Protocol
8
7
  # The default server url, based on the hosted Parse platform.
9
- SERVER_URL = 'http://localhost:1337/parse'.freeze
8
+ SERVER_URL = "http://localhost:1337/parse".freeze
10
9
  # The request header field to send the application Id.
11
- APP_ID = 'X-Parse-Application-Id'
10
+ APP_ID = "X-Parse-Application-Id"
12
11
  # The request header field to send the REST API key.
13
- API_KEY = 'X-Parse-REST-API-Key'
12
+ API_KEY = "X-Parse-REST-API-Key"
14
13
  # The request header field to send the Master key.
15
- MASTER_KEY = 'X-Parse-Master-Key'
14
+ MASTER_KEY = "X-Parse-Master-Key"
16
15
  # The request header field to send the revocable Session key.
17
- SESSION_TOKEN = 'X-Parse-Session-Token'
16
+ SESSION_TOKEN = "X-Parse-Session-Token"
18
17
  # The request header field to request a revocable session token.
19
- REVOCABLE_SESSION = 'X-Parse-Revocable-Session'
18
+ REVOCABLE_SESSION = "X-Parse-Revocable-Session"
20
19
  # The request header field to send the installation id.
21
- INSTALLATION_ID = 'Parse-Installation-Id'
20
+ INSTALLATION_ID = "Parse-Installation-Id"
22
21
  # The request header field to send an email when authenticating with Parse hosted platform.
23
- EMAIL = 'X-Parse-Email'
22
+ EMAIL = "X-Parse-Email"
24
23
  # The request header field to send the password when authenticating with the Parse hosted platform.
25
- PASSWORD = 'X-Parse-Password'
24
+ PASSWORD = "X-Parse-Password"
26
25
  # The request header field for the Content type.
27
- CONTENT_TYPE = 'Content-Type'
26
+ CONTENT_TYPE = "Content-Type"
28
27
  # The default content type format for sending API requests.
29
- CONTENT_TYPE_FORMAT = 'application/json; charset=utf-8'
28
+ CONTENT_TYPE_FORMAT = "application/json; charset=utf-8"
30
29
  end
31
30
 
32
31
  # All Parse error codes.
@@ -1,8 +1,8 @@
1
1
  # encoding: UTF-8
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'active_support'
5
- require 'active_support/json'
4
+ require "active_support"
5
+ require "active_support/json"
6
6
 
7
7
  module Parse
8
8
  #This class represents a Parse request.
@@ -68,19 +68,17 @@ module Parse
68
68
  # Two requests objects are the same if they have the same signature.
69
69
  # @return [Hash] A hash representing this request.
70
70
  def signature
71
- {method: @method.upcase, path: @path, body: @body}
71
+ { method: @method.upcase, path: @path, body: @body }
72
72
  end
73
73
 
74
74
  # @!visibility private
75
75
  def inspect
76
- "#<#{self.class} @method=#{@method} @path='#{@path}'>"
76
+ "#<#{self.class} @method=#{@method} @path='#{@path}'>"
77
77
  end
78
78
 
79
79
  # @return [String]
80
80
  def to_s
81
81
  "#{@method.to_s.upcase} #{@path}"
82
82
  end
83
-
84
83
  end
85
-
86
84
  end
@@ -1,8 +1,8 @@
1
1
  # encoding: UTF-8
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'active_support'
5
- require 'active_support/json'
4
+ require "active_support"
5
+ require "active_support/json"
6
6
 
7
7
  module Parse
8
8
 
@@ -86,7 +86,6 @@ module Parse
86
86
  end
87
87
  #if none match, set pure result
88
88
  @result = res if @result.nil?
89
-
90
89
  end
91
90
 
92
91
  # true if this was a batch response.
@@ -98,7 +97,6 @@ module Parse
98
97
  # of the ones in the batch.
99
98
  # @return [Array] an array of Response objects.
100
99
  def batch_responses
101
-
102
100
  return [@result] unless @batch_response
103
101
  # if batch response, generate array based on the response hash.
104
102
  @result.map do |r|
@@ -123,8 +121,8 @@ module Parse
123
121
  @result = h
124
122
  @count = 1
125
123
  end
126
-
127
124
  end
125
+
128
126
  alias_method :parse_results!, :parse_result!
129
127
 
130
128
  # true if the response is successful.
@@ -136,7 +134,7 @@ module Parse
136
134
  # true if the response has an error code.
137
135
  # @see #success?
138
136
  def error?
139
- ! success?
137
+ !success?
140
138
  end
141
139
 
142
140
  # true if the response has an error code of 'object not found'
@@ -155,6 +153,7 @@ module Parse
155
153
  def first
156
154
  @result.is_a?(Array) ? @result.first : @result
157
155
  end
156
+
158
157
  # Iterate through each result item.
159
158
  # @yieldparam [Object] a result entry.
160
159
  def each
@@ -177,6 +176,5 @@ module Parse
177
176
  return "[E-#{@code}] #{@request} : #{@error} (#{@http_status})" if error?
178
177
  @result.to_json
179
178
  end
180
-
181
179
  end
182
180
  end