Sha256: e61afb48954aa831705a9664eb4f6bf3c40c825d6b1f28cea1403c6eb605b8c8

Contents?: true

Size: 733 Bytes

Versions: 1

Compression:

Stored size: 733 Bytes

Contents

# -*- encoding : utf-8 -*-
module AV
  module Cloud

    class Function
      attr_accessor :function_name

      def initialize(function_name)
        @function_name = function_name
      end

      def uri
        Protocol.cloud_function_uri(@function_name)
      end

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

    def self.request_sms(params)
      AV.client.post("/#{Protocol::VERSION}/requestSmsCode", params.to_json)
    end

    def self.verify_sms_code(phone, code)
      params = { mobilePhoneNumber: phone}
      AV.client.post("/#{Protocol::VERSION}/verifySmsCode/#{code}", params.to_json)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
leancloud-ruby-client-0.1.1 lib/leancloud/cloud.rb