Class: Parse::Cloud::Function

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

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(function_name, client = nil) ⇒ Function

Returns a new instance of Function.



10
11
12
13
# File 'lib/parse/cloud.rb', line 10

def initialize(function_name, client = nil)
  @function_name = function_name
  @client = client || Parse.client
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



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

def client
  @client
end

#function_nameObject

Returns the value of attribute function_name.



7
8
9
# File 'lib/parse/cloud.rb', line 7

def function_name
  @function_name
end

Instance Method Details

#call(params = {}) ⇒ Object



19
20
21
22
23
# File 'lib/parse/cloud.rb', line 19

def call(params = {})
  response = @client.post(uri, params.to_json)
  result = response['result']
  result
end

#uriObject



15
16
17
# File 'lib/parse/cloud.rb', line 15

def uri
  Protocol.cloud_function_uri(@function_name)
end