Class: Fadada::Signature

Inherits:
Object
  • Object
show all
Defined in:
lib/fadada/signature.rb

Class Method Summary collapse

Class Method Details

.custom(customer_id:, content:) ⇒ Object

自定义印章 获取用户自定义签章图片

customer_id => 客户编号
content => 印章展示的内容,可以是企业名称或者客户名称


27
28
29
30
31
32
33
34
# File 'lib/fadada/signature.rb', line 27

def self.custom(customer_id:, content:)
  options = {
    content: content,
    customer_id: customer_id
  }
  response = Fadada::HttpClient.request(:post, 'custom_signature.api', options)
  response['data']['signature_img_base64']
end

.upload(customer_id:, type: 'base64', image:) ⇒ Object

签章上传 新增用户签章图片

customer_id => 客户编号
image => 签章图片地址或者base64图片数据
type => image 类型,base64 或者 path

返回签章图片ID


13
14
15
16
17
18
19
20
# File 'lib/fadada/signature.rb', line 13

def self.upload(customer_id:, type: 'base64', image:)
  options = {
    customer_id: customer_id,
    signature_img_base64: type == 'base64' ? image : image_to_base64(image)
  }
  response = Fadada::HttpClient.request(:post, 'add_signature.api', options)
  response['data']
end