class AliyunIot::Product

Attributes

key[R]

Public Class Methods

[](key) click to toggle source
# File lib/aliyun_iot/product.rb, line 11
def [](key)
  Product.new(key)
end
check_regist_state(apply_id) click to toggle source
# File lib/aliyun_iot/product.rb, line 20
def check_regist_state(apply_id)
  params = { ApplyId: apply_id }
  execute params, 'QueryApplyStatus'
end
create(name) click to toggle source
# File lib/aliyun_iot/product.rb, line 15
def create(name)
  params = { Name: name }
  execute params, 'CreateProduct'
end
execute(params = {}, actiont) click to toggle source
# File lib/aliyun_iot/product.rb, line 35
def execute(params = {}, actiont)
  Request::Json.post(params.merge({ Action: actiont }))
end
list_regist_info(apply_id, page_size, current_page) click to toggle source
# File lib/aliyun_iot/product.rb, line 25
def list_regist_info(apply_id, page_size, current_page)
  warn "WARNING: Product.list_regist_info is deprecated. Please, use Product.query_page_by_apply_id instead"
  query_page_by_apply_id(apply_id, page_size, current_page)
end
new(key) click to toggle source
# File lib/aliyun_iot/product.rb, line 40
def initialize(key)
  @key = key
end
query_page_by_apply_id(apply_id, page_size, current_page) click to toggle source
# File lib/aliyun_iot/product.rb, line 30
def query_page_by_apply_id(apply_id, page_size, current_page)
  params = { ApplyId: apply_id, PageSize: page_size, CurrentPage: current_page }
  execute params, 'QueryPageByApplyId'
end

Public Instance Methods

batch_check_device_names(params = {}) click to toggle source
# File lib/aliyun_iot/product.rb, line 65
def batch_check_device_names(params = {})
  execute params, 'BatchCheckDeviceNames'
end
batch_get_device_state(params = {}) click to toggle source
# File lib/aliyun_iot/product.rb, line 77
def batch_get_device_state(params = {})
  execute params, 'BatchGetDeviceState'
end
batch_register_device_with_apply_id(apply_id) click to toggle source
# File lib/aliyun_iot/product.rb, line 69
def batch_register_device_with_apply_id(apply_id)
  execute({ApplyId: apply_id}, 'BatchRegisterDeviceWithApplyId')
end
list(params = {}) click to toggle source
# File lib/aliyun_iot/product.rb, line 48
def list(params = {})
  execute params, 'QueryDevice'
end
pub(params = {}) click to toggle source
# File lib/aliyun_iot/product.rb, line 81
def pub(params = {})
  raise ParamsError, "message MessageContent is empty!" if params[:MessageContent].nil?
  params[:MessageContent] = Base64.encode64(params[:MessageContent]).chomp
  execute params, 'Pub'
end
query_batch_register_status(apply_id) click to toggle source
# File lib/aliyun_iot/product.rb, line 73
def query_batch_register_status(apply_id)
  execute({ApplyId: apply_id}, 'QueryBatchRegisterDeviceStatus')
end
query_device_detail_by_name(device_name) click to toggle source
# File lib/aliyun_iot/product.rb, line 56
def query_device_detail_by_name(device_name)
  execute({DeviceName: device_name}, 'QueryDeviceDetail')
end
regist_device(params = {}) click to toggle source
# File lib/aliyun_iot/product.rb, line 52
def regist_device(params = {})
  execute params, 'RegisterDevice'
end
regist_devices(params = {}) click to toggle source
# File lib/aliyun_iot/product.rb, line 60
def regist_devices(params = {})
  warn "WARNING: Product#regist_devices is deprecated. Please, use Product#batch_check_device_names instead"
  batch_check_device_names params
end
rrpc(params = {}) click to toggle source
# File lib/aliyun_iot/product.rb, line 91
def rrpc(params = {})
  execute params, 'RRpc'
end
sub(params = {}) click to toggle source
# File lib/aliyun_iot/product.rb, line 87
def sub(params = {})
  execute params, 'Sub'
end
update(params = {}) click to toggle source
# File lib/aliyun_iot/product.rb, line 44
def update(params = {})
  execute params, 'UpdateProduct'
end

Private Instance Methods

execute(res_params, action) click to toggle source
# File lib/aliyun_iot/product.rb, line 97
def execute(res_params, action)
  Request::Json.post(res_params.merge({ ProductKey: @key, Action: action }))
end