parse-stack 1.7.2 → 1.7.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '0267822a7e96425e847f7218ad98a11115b511b4'
4
- data.tar.gz: 5f942b6458ba0f0de2f5e9657fe9e135ea46fcc7
3
+ metadata.gz: 9eafb62ac7cb6896948ce8f820df6972b054a901
4
+ data.tar.gz: 1ed13fb80a1efb0ccece5f3dc905aec0af11244e
5
5
  SHA512:
6
- metadata.gz: 7978c0a43c5f46217e7fcc3f0ff600c548571f9094f91b7716bf8ce8881e47edd49bc579d803853213c2890ee3e1f8aec6b23453f9f396b17bedfae7b173f9fa
7
- data.tar.gz: 3a29aac5e5c251424023426498cd4e98a6751189e752a932f011becfb3f1f1806e1988088c97e4f21b7d1b2bd235d32e5bd912478da45919928439b20dd33c0e
6
+ metadata.gz: e7c98a274cba051812c56d61fa260fee596021f9386819745a05a9d7b3f55ee64e6445c53d8b23ad0c7f26664d27193febb1b46c4511212224db4e0d2408c170
7
+ data.tar.gz: ef6bbde1f02b58e2e48a56fbd6fb73b332822f5b69c019c27351a50343a1d563ac7cd2671558da707881e59850edd59f27edfc43be23728fe6ad52ccaa3504fc
data/Changes.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## Parse-Stack Changelog
2
2
 
3
+ ### 1.7.3
4
+ - CHANGED: Moved to using preferred ENV variable names based on parse-server cli.
5
+ - CHANGED: Default url is now http://localhost:1337/parse
6
+ - NEW: Added method `hyperdrive_config!` to apply remote ENV from remote JSON url.
7
+
3
8
  ### 1.7.2
4
9
  - NEW: `Parse::Model.autosave_on_create` has been removed in favor of `first_or_create!`.
5
10
  - NEW: Webhook Triggers and Functions now have a `wlog` method, similar to `puts`, but allows easier tracing of
data/Gemfile CHANGED
@@ -12,7 +12,7 @@ group :test, :development do
12
12
  gem 'pry'
13
13
  gem 'pry-stack_explorer'
14
14
  gem 'pry-nav'
15
- gem 'yard'
15
+ gem 'yard', '>= 0.9.11'
16
16
  gem 'redcarpet'
17
17
  gem 'thin' # for yard server
18
18
  end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- parse-stack (1.7.2)
4
+ parse-stack (1.7.3)
5
5
  active_model_serializers (>= 0.9, < 1)
6
6
  activemodel (>= 4.2.1, < 6)
7
7
  activesupport (>= 4.2.1, < 6)
@@ -14,60 +14,63 @@ PATH
14
14
  GEM
15
15
  remote: https://rubygems.org/
16
16
  specs:
17
- actionpack (5.1.2)
18
- actionview (= 5.1.2)
19
- activesupport (= 5.1.2)
17
+ actionpack (5.1.5)
18
+ actionview (= 5.1.5)
19
+ activesupport (= 5.1.5)
20
20
  rack (~> 2.0)
21
- rack-test (~> 0.6.3)
21
+ rack-test (>= 0.6.3)
22
22
  rails-dom-testing (~> 2.0)
23
23
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
24
- actionview (5.1.2)
25
- activesupport (= 5.1.2)
24
+ actionview (5.1.5)
25
+ activesupport (= 5.1.5)
26
26
  builder (~> 3.1)
27
27
  erubi (~> 1.4)
28
28
  rails-dom-testing (~> 2.0)
29
29
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
30
- active_model_serializers (0.10.6)
30
+ active_model_serializers (0.10.7)
31
31
  actionpack (>= 4.1, < 6)
32
32
  activemodel (>= 4.1, < 6)
33
33
  case_transform (>= 0.2)
34
- jsonapi-renderer (>= 0.1.1.beta1, < 0.2)
35
- activemodel (5.1.2)
36
- activesupport (= 5.1.2)
37
- activesupport (5.1.2)
34
+ jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
35
+ activemodel (5.1.5)
36
+ activesupport (= 5.1.5)
37
+ activesupport (5.1.5)
38
38
  concurrent-ruby (~> 1.0, >= 1.0.2)
39
39
  i18n (~> 0.7)
40
40
  minitest (~> 5.1)
41
41
  tzinfo (~> 1.1)
42
- binding_of_caller (0.7.2)
42
+ binding_of_caller (0.8.0)
43
43
  debug_inspector (>= 0.0.1)
44
44
  builder (3.2.3)
45
- byebug (9.0.6)
45
+ byebug (10.0.0)
46
46
  case_transform (0.2)
47
47
  activesupport
48
- coderay (1.1.1)
48
+ coderay (1.1.2)
49
49
  concurrent-ruby (1.0.5)
50
- daemons (1.2.4)
50
+ crass (1.0.3)
51
+ daemons (1.2.6)
51
52
  debug_inspector (0.0.3)
52
53
  dotenv (2.2.1)
53
- erubi (1.6.1)
54
- eventmachine (1.2.3)
55
- faraday (0.12.1)
54
+ erubi (1.7.0)
55
+ eventmachine (1.2.5)
56
+ faraday (0.14.0)
56
57
  multipart-post (>= 1.2, < 3)
57
- faraday_middleware (0.11.0.1)
58
+ faraday_middleware (0.12.2)
58
59
  faraday (>= 0.7.4, < 1.0)
59
- i18n (0.8.6)
60
- jsonapi-renderer (0.1.3)
61
- loofah (2.0.3)
60
+ i18n (0.9.5)
61
+ concurrent-ruby (~> 1.0)
62
+ jsonapi-renderer (0.2.0)
63
+ loofah (2.2.0)
64
+ crass (~> 1.0.2)
62
65
  nokogiri (>= 1.5.9)
63
66
  method_source (0.8.2)
64
- mini_portile2 (2.2.0)
65
- minitest (5.10.2)
67
+ mini_portile2 (2.3.0)
68
+ minitest (5.11.3)
66
69
  moneta (1.0.0)
67
70
  multipart-post (2.0.0)
68
- nokogiri (1.8.0)
69
- mini_portile2 (~> 2.2.0)
70
- parallel (1.11.2)
71
+ nokogiri (1.8.2)
72
+ mini_portile2 (~> 2.3.0)
73
+ parallel (1.12.1)
71
74
  pry (0.10.4)
72
75
  coderay (~> 1.1.0)
73
76
  method_source (~> 0.8.1)
@@ -77,26 +80,26 @@ GEM
77
80
  pry-stack_explorer (0.4.9.2)
78
81
  binding_of_caller (>= 0.7)
79
82
  pry (>= 0.9.11)
80
- rack (2.0.3)
81
- rack-test (0.6.3)
82
- rack (>= 1.0)
83
+ rack (2.0.4)
84
+ rack-test (0.8.3)
85
+ rack (>= 1.0, < 3)
83
86
  rails-dom-testing (2.0.3)
84
87
  activesupport (>= 4.2.0)
85
88
  nokogiri (>= 1.6)
86
89
  rails-html-sanitizer (1.0.3)
87
90
  loofah (~> 2.0)
88
- rake (12.0.0)
91
+ rake (12.3.0)
89
92
  redcarpet (3.4.0)
90
- redis (3.3.3)
93
+ redis (4.0.1)
91
94
  slop (3.6.0)
92
- thin (1.7.1)
95
+ thin (1.7.2)
93
96
  daemons (~> 1.0, >= 1.0.9)
94
97
  eventmachine (~> 1.0, >= 1.0.4)
95
98
  rack (>= 1, < 3)
96
99
  thread_safe (0.3.6)
97
- tzinfo (1.2.3)
100
+ tzinfo (1.2.5)
98
101
  thread_safe (~> 0.1)
99
- yard (0.9.9)
102
+ yard (0.9.12)
100
103
 
101
104
  PLATFORMS
102
105
  ruby
@@ -113,7 +116,7 @@ DEPENDENCIES
113
116
  redcarpet
114
117
  redis
115
118
  thin
116
- yard
119
+ yard (>= 0.9.11)
117
120
 
118
121
  BUNDLED WITH
119
- 1.15.1
122
+ 1.16.1
data/README.md CHANGED
@@ -299,7 +299,7 @@ To connect to a Parse server, you will need a minimum of an `application_id`, an
299
299
  Parse.setup app_id: "YOUR_APP_ID",
300
300
  api_key: "YOUR_API_KEY",
301
301
  master_key: "YOUR_MASTER_KEY", # optional
302
- server_url: 'https://api.parse.com/1/' #default
302
+ server_url: 'https://localhost:1337/parse' #default
303
303
  ```
304
304
 
305
305
  If you wish to add additional connection middleware to the stack, you may do so by utilizing passing a block to the setup method.
@@ -324,16 +324,16 @@ Calling `setup` will create the default `Parse::Client` session object that will
324
324
  There are additional connection options that you may pass the setup method when creating a `Parse::Client`.
325
325
 
326
326
  #### `:server_url`
327
- The server url of your Parse Server if you are not using the hosted Parse service. By default it will use `PARSE_SERVER_URL` environment variable available or fall back to `https://api.parse.com/1/` if not specified.
327
+ The server url of your Parse Server if you are not using the hosted Parse service. By default it will use `PARSE_SERVER_URL` environment variable available or fall back to `https://localhost:1337/parse` if not specified.
328
328
 
329
329
  #### `:app_id`
330
- The Parse application id. By default it will use `PARSE_APP_ID` environment variable if not specified.
330
+ The Parse application id. By default it will use `PARSE_SERVER_APPLICATION_ID` environment variable if not specified.
331
331
 
332
332
  #### `:api_key`
333
- The Parse REST API Key. By default it will use `PARSE_API_KEY` environment variable if not specified.
333
+ The Parse REST API Key. By default it will use `PARSE_SERVER_REST_API_KEY` environment variable if not specified.
334
334
 
335
335
  #### `:master_key` _(optional)_
336
- The Parse application master key. If this key is set, it will be sent on every request sent by the client and your models. By default it will use `PARSE_MASTER_KEY` environment variable if not specified.
336
+ The Parse application master key. If this key is set, it will be sent on every request sent by the client and your models. By default it will use `PARSE_SERVER_MASTER_KEY` environment variable if not specified.
337
337
 
338
338
  #### `:logging`
339
339
  A true or false value. It provides you additional logging information of requests and responses. If set to the special symbol of `:debug`, it will provide additional payload data in the log messages.
@@ -2384,7 +2384,7 @@ curl -X POST \
2384
2384
  -H "X-Parse-REST-API-Key: ${REST_API_KEY}" \
2385
2385
  -H "Content-Type: application/json" \
2386
2386
  -d '{}' \
2387
- https://api.parse.com/1/functions/helloWorld
2387
+ https://localhost:1337/parse/functions/helloWorld
2388
2388
  ```
2389
2389
 
2390
2390
  If you are creating `Parse::Object` subclasses, you may also register them there to keep common code and functionality centralized.
data/bin/parse-console CHANGED
@@ -79,9 +79,9 @@ opt_parser = OptionParser.new do |o|
79
79
  raise "Contents not a JSON hash." unless json.is_a?(Hash)
80
80
  json.each { |k,v| ENV[k.upcase] = v }
81
81
  opts[:server_url] ||= ENV['PARSE_SERVER_URL']
82
- opts[:app_id] ||= ENV['PARSE_APP_ID'] || ENV['PARSE_APPLICATION_ID']
83
- opts[:api_key] ||= ENV['PARSE_REST_API_KEY'] || ENV['PARSE_API_KEY']
84
- opts[:master_key] ||= ENV['PARSE_MASTER_KEY']
82
+ opts[:app_id] ||= ENV['PARSE_SERVER_APPLICATION_ID'] || ENV['PARSE_APP_ID']
83
+ opts[:api_key] ||= ENV['PARSE_SERVER_REST_API_KEY'] || ENV['PARSE_API_KEY']
84
+ opts[:master_key] ||= ENV['PARSE_SERVER_MASTER_KEY'] || ENV['PARSE_MASTER_KEY']
85
85
  rescue Exception => e
86
86
  $stderr.puts "Error: Invalid JSON format for #{url} (#{e})"
87
87
  exit 1
data/lib/parse/client.rb CHANGED
@@ -185,7 +185,7 @@ module Parse
185
185
  # Parse.setup app_id: "YOUR_APP_ID",
186
186
  # api_key: "YOUR_REST_API_KEY",
187
187
  # master_key: "YOUR_MASTER_KEY", # optional
188
- # server_url: 'https://api.parse.com/1/' #default
188
+ # server_url: 'https://localhost:1337/parse' #default
189
189
  # @param opts (see Parse::Client#initialize)
190
190
  # @option opts (see Parse::Client#initialize)
191
191
  # @yield the block for additional configuration with Faraday middleware.
@@ -206,11 +206,11 @@ module Parse
206
206
  # are not using the hosted Parse service. By default it will use
207
207
  # ENV["PARSE_SERVER_URL"] if available, otherwise fallback to {Parse::Protocol::SERVER_URL}.
208
208
  # @option opts [String] :app_id The Parse application id. Defaults to
209
- # ENV['PARSE_APP_ID'] or ENV['PARSE_APPLICATION_ID'].
210
- # @option opts [String] :api_key Your Parse REST API Key. Defaults to ENV['PARSE_REST_API_KEY'].
209
+ # ENV['PARSE_SERVER_APPLICATION_ID'].
210
+ # @option opts [String] :api_key Your Parse REST API Key. Defaults to ENV['PARSE_SERVER_REST_API_KEY'].
211
211
  # @option opts [String] :master_key The Parse application master key (optional).
212
212
  # If this key is set, it will be sent on every request sent by the client
213
- # and your models. Defaults to ENV['PARSE_MASTER_KEY'].
213
+ # and your models. Defaults to ENV['PARSE_SERVER_MASTER_KEY'].
214
214
  # @option opts [Boolean] :logging It provides you additional logging information
215
215
  # of requests and responses. If set to the special symbol of *:debug*, it
216
216
  # will provide additional payload data in the log messages. This option affects
@@ -242,9 +242,9 @@ module Parse
242
242
  # @see Parse::Protocol
243
243
  def initialize(opts = {})
244
244
  @server_url = opts[:server_url] || ENV["PARSE_SERVER_URL"] || Parse::Protocol::SERVER_URL
245
- @application_id = opts[:application_id] || opts[:app_id] || ENV["PARSE_APP_ID"] || ENV['PARSE_APPLICATION_ID']
246
- @api_key = opts[:api_key] || opts[:rest_api_key] || ENV["PARSE_REST_API_KEY"] || ENV["PARSE_API_KEY"]
247
- @master_key = opts[:master_key] || ENV["PARSE_MASTER_KEY"]
245
+ @application_id = opts[:application_id] || opts[:app_id] || ENV["PARSE_SERVER_APPLICATION_ID"] || ENV['PARSE_APP_ID']
246
+ @api_key = opts[:api_key] || opts[:rest_api_key] || ENV["PARSE_SERVER_REST_API_KEY"] || ENV["PARSE_API_KEY"]
247
+ @master_key = opts[:master_key] || ENV['PARSE_SERVER_MASTER_KEY'] || ENV["PARSE_MASTER_KEY"]
248
248
  opts[:adapter] ||= Faraday.default_adapter
249
249
  opts[:expires] ||= 3
250
250
  if @server_url.nil? || @application_id.nil? || ( @api_key.nil? && @master_key.nil? )
data/lib/parse/stack.rb CHANGED
@@ -11,7 +11,29 @@ require_relative 'webhooks'
11
11
  module Parse
12
12
  class Error < StandardError; end;
13
13
  module Stack
14
-
14
+ # Applies a remote JSON hash containing the ENV keys and values from a remote
15
+ # URL. Values from the JSON hash are only applied to the current ENV hash ONLY if
16
+ # it does not already have a value. Therefore local ENV values will take precedence
17
+ # over remote ones. By default, it uses the url in environment value in 'CONFIG_URL' or 'HYPERDRIVE_URL'.
18
+ # @param url [String] the remote url that responds with the JSON body.
19
+ # @return [Boolean] true if the JSON hash was found and applied successfully.
20
+ def self.hyperdrive_config!(url = nil)
21
+ url ||= ENV["HYPERDRIVE_URL"] || ENV['CONFIG_URL']
22
+ if url.present?
23
+ begin
24
+ remote_config = JSON.load open( url )
25
+ remote_config.each do |key,value|
26
+ k = key.upcase
27
+ next unless ENV[k].nil?
28
+ ENV[k] ||= value.to_s
29
+ end
30
+ return true
31
+ rescue => e
32
+ warn "[Parse::Stack] Error loading config: #{url} (#{e})"
33
+ end
34
+ end
35
+ false
36
+ end
15
37
  end
16
38
  end
17
39
 
@@ -2,10 +2,10 @@ require 'parse/stack'
2
2
 
3
3
  # Set your specific Parse keys in your ENV. For all connection options, see
4
4
  # https://github.com/modernistik/parse-stack#connection-setup
5
- Parse.setup app_id: ENV['PARSE_APP_ID'],
6
- api_key: ENV['PARSE_API_KEY'],
7
- master_key: ENV['PARSE_MASTER_KEY'],
8
- server_url: 'https://api.parse.com/1/'
5
+ Parse.setup app_id: ENV['PARSE_SERVER_APPLICATION_ID'],
6
+ api_key: ENV['PARSE_SERVER_REST_API_KEY'],
7
+ master_key: ENV['PARSE_SERVER_MASTER_KEY'], # optional
8
+ server_url: 'https://localhost:1337/parse'
9
9
  # optional
10
10
  # logging: false,
11
11
  # cache: Moneta.new(:File, dir: 'tmp/cache'),
@@ -6,6 +6,6 @@ module Parse
6
6
  # The Parse Server SDK for Ruby
7
7
  module Stack
8
8
  # The current version.
9
- VERSION = "1.7.2"
9
+ VERSION = "1.7.3"
10
10
  end
11
11
  end
@@ -216,11 +216,11 @@ module Parse
216
216
 
217
217
  # @!attribute key
218
218
  # Returns the configured webhook key if available. By default it will use
219
- # the value of ENV['PARSE_WEBHOOK_KEY'] if not configured.
219
+ # the value of ENV['PARSE_SERVER_WEBHOOK_KEY'] if not configured.
220
220
  # @return [String]
221
221
  attr_accessor :key
222
222
  def key
223
- @key ||= ENV['PARSE_WEBHOOK_KEY']
223
+ @key ||= ENV['PARSE_SERVER_WEBHOOK_KEY'] || ENV['PARSE_WEBHOOK_KEY']
224
224
  end
225
225
 
226
226
  # Standard Rack call method. This method processes an incoming cloud code
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parse-stack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.2
4
+ version: 1.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Persaud
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-18 00:00:00.000000000 Z
11
+ date: 2018-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -275,7 +275,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
275
275
  version: '0'
276
276
  requirements: []
277
277
  rubyforge_project:
278
- rubygems_version: 2.5.2
278
+ rubygems_version: 2.6.12
279
279
  signing_key:
280
280
  specification_version: 4
281
281
  summary: Parse Server Ruby Client SDK