faastruby-rpc 0.2.6 → 0.2.7

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
  SHA256:
3
- metadata.gz: 295c933a6bbc3937f2576f936df3f052c8fb11c3065b8c77b4f4ce5e9652ccf5
4
- data.tar.gz: 6d0a18c426e98c39ec890053574066930089fb0cbd4603a72f12c39e093830b5
3
+ metadata.gz: f0c3418f7df2adeeb036da90edb276f35dfdbb219e590eb7b75ceb0e3495f7df
4
+ data.tar.gz: e17da63372be23f2c4b2aebce1fe3eb8c2cebae4a1443dd3d4c3e2915133dead
5
5
  SHA512:
6
- metadata.gz: b58a4026b6e45cb6a1f9df768df9e9809b0b97134af4a8a5e1ed7f4ea2c2a25048fe128560c2819b9e16c1dc9aa3c00f20c55338cee2295c166ffb792d86e881
7
- data.tar.gz: ffc3a95906dcf78dc25bfc58220edafe9ce46e53f3172ce35d1e9bc28163b58e15cec0057b0d0167de38de04a5a38cc56a1185ac2c93c8ee342254fb6062d3d4
6
+ metadata.gz: 246c0d3311733f50d9fcd667c840ca6078308e3aa70c3820e211c74d05485a103291cbc3e24e41b710a24e461dc9ea9233d013cc94d85346c1a8526aa3c43052
7
+ data.tar.gz: a398d8633f992f561b1e8637f7b2d4b185b9b90f9994d5f82524b607b4c0f490b898fbfd6cc3af4c2f2319faacbf233b9b93619d86371963c1bc16683e96bf49
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.7 - Apr 7 2019
4
+ - Make env vars match the ones on faastruby-cli
5
+
3
6
  ## 0.2.6 - Mar 18 2019
4
7
  - Multiple calls to the same function no longer overwrite each other.
5
8
  - Use Oj mode :compat when converting keyword arguments to JSON.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- faastruby-rpc (0.2.4)
4
+ faastruby-rpc (0.2.7)
5
5
  oj (~> 3.6)
6
6
 
7
7
  GEM
@@ -13,7 +13,7 @@ GEM
13
13
  safe_yaml (~> 1.0.0)
14
14
  diff-lcs (1.3)
15
15
  hashdiff (0.3.7)
16
- oj (3.7.10)
16
+ oj (3.7.11)
17
17
  public_suffix (3.0.3)
18
18
  rake (10.5.0)
19
19
  rspec (3.8.0)
data/README.md CHANGED
@@ -41,13 +41,14 @@ If at any point you need to know if the external function call already returned
41
41
  Say you have the following function named `echo`:
42
42
 
43
43
  ```ruby
44
- # Note the required keyword argument 'name:'
45
- def handler(event, name:)
46
- render text: name
44
+ require 'json'
45
+ def handler(event)
46
+ arguments = JSON.parse event.body
47
+ render text: arguments['name']
47
48
  end
48
49
  ```
49
50
 
50
- If you want to call this function in another function, you can simply pass the argument within `call`:
51
+ If you want to call this function from another function, you can simply pass the argument within `call`:
51
52
 
52
53
  ```ruby
53
54
  require_function 'echo', as: 'Echo'
@@ -56,9 +57,9 @@ def handler(event)
56
57
  render text: "Hello, #{name}!" # calling 'name' will block until Echo returns
57
58
  end
58
59
  ```
59
- You can use positional or keyword arguments when calling external functions, as long as the external function's `handler` method is defined with matching arguments.
60
+ You can use positional or keyword arguments when calling external functions, and have the called function's `handler` method parse the `event.body` as JSON.
60
61
 
61
- This gem is already required when you run your functions in faastRuby, or using `faastruby server`.
62
+ This gem is already required when you run your functions in faastRuby, or using `faastruby local`.
62
63
 
63
64
  ## Running code when the invoked function responds
64
65
  If you pass a block when you call another function, the block will execute as soon as the response arrives. For example:
@@ -84,7 +85,7 @@ By default, an exception is raised if the invoked function HTTP status code is g
84
85
  To disable this behaviour, pass `raise_errors: false` when requiring the function. For example:
85
86
 
86
87
  ```ruby
87
- require_function 'paulo/hello-world', as: 'HelloWorld', raise_errors: false
88
+ require_function 'hello-world', as: 'HelloWorld', raise_errors: false
88
89
  ```
89
90
 
90
91
  ## Stubbing RPC calls in your function tests
@@ -15,8 +15,9 @@ module FaaStRuby
15
15
  end
16
16
  end
17
17
  class Function
18
- @@region = ENV['REGION']
19
- @@endpoint_base_host = ENV['ENDPOINT_BASE_HOST']
18
+ @@region = ENV['FAASTRUBY_REGION']
19
+ @@endpoint_base_host = ENV['FAASTRUBY_WORKSPACE_BASE_HOST']
20
+ @@endpoint_base_protocol = ENV['FAASTRUBY_URL_PROTOCOL'] || 'https'
20
21
  def self.workspace=(workspace)
21
22
  @@workspace = workspace
22
23
  end
@@ -42,7 +43,7 @@ module FaaStRuby
42
43
  end
43
44
 
44
45
  def get_endpoint(query_params)
45
- return "https://#{@@workspace}.#{@@region}.#{@@endpoint_base_host}/#{@path}#{query_params}" if @@endpoint_base_host && @@region && @@workspace
46
+ return "#{@@endpoint_base_protocol}://#{@@workspace}.#{@@region}.#{@@endpoint_base_host}/#{@path}#{query_params}" if @@endpoint_base_host && @@region && @@workspace
46
47
  return "http://localhost:3000/#{@path}#{query_params}"
47
48
  end
48
49
 
@@ -1,5 +1,5 @@
1
1
  module FaaStRuby
2
2
  module RPC
3
- VERSION = '0.2.6'
3
+ VERSION = '0.2.7'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faastruby-rpc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paulo Arruda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-19 00:00:00.000000000 Z
11
+ date: 2019-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj