Class: LC::Cloud::Function

Inherits:
Object
  • Object
show all
Defined in:
lib/leancloud/cloud.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(function_name) ⇒ Function

Returns a new instance of Function.



8
9
10
# File 'lib/leancloud/cloud.rb', line 8

def initialize(function_name)
  @function_name = function_name
end

Instance Attribute Details

#function_nameObject

Returns the value of attribute function_name.



6
7
8
# File 'lib/leancloud/cloud.rb', line 6

def function_name
  @function_name
end

Instance Method Details

#call(params = {}) ⇒ Object



16
17
18
19
20
# File 'lib/leancloud/cloud.rb', line 16

def call(params={})
  response = LC.client.post(self.uri, params.to_json)
  result = response["result"]
  result
end

#uriObject



12
13
14
# File 'lib/leancloud/cloud.rb', line 12

def uri
  Protocol.cloud_function_uri(@function_name)
end