Class: AliyunIot::Product
- Inherits:
-
Object
- Object
- AliyunIot::Product
- Defined in:
- lib/aliyun_iot/product.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Class Method Summary collapse
- .[](key) ⇒ Object
- .check_regist_state(apply_id) ⇒ Object
- .create(name) ⇒ Object
- .execute(params = {}, actiont) ⇒ Object
- .list_regist_info(apply_id, page_size, current_page) ⇒ Object
- .query_page_by_apply_id(apply_id, page_size, current_page) ⇒ Object
Instance Method Summary collapse
- #batch_check_device_names(params = {}) ⇒ Object
- #batch_get_device_state(params = {}) ⇒ Object
- #batch_register_device_with_apply_id(apply_id) ⇒ Object
-
#initialize(key) ⇒ Product
constructor
A new instance of Product.
- #list(params = {}) ⇒ Object
- #pub(params = {}) ⇒ Object
- #query_batch_register_status(apply_id) ⇒ Object
- #query_device_detail_by_name(device_name) ⇒ Object
- #regist_device(params = {}) ⇒ Object
- #regist_devices(params = {}) ⇒ Object
- #rrpc(params = {}) ⇒ Object
- #sub(params = {}) ⇒ Object
- #update(params = {}) ⇒ Object
Constructor Details
#initialize(key) ⇒ Product
Returns a new instance of Product.
40 41 42 |
# File 'lib/aliyun_iot/product.rb', line 40 def initialize(key) @key = key end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
7 8 9 |
# File 'lib/aliyun_iot/product.rb', line 7 def key @key end |
Class Method Details
.[](key) ⇒ Object
11 12 13 |
# File 'lib/aliyun_iot/product.rb', line 11 def [](key) Product.new(key) end |
.check_regist_state(apply_id) ⇒ Object
20 21 22 23 |
# File 'lib/aliyun_iot/product.rb', line 20 def check_regist_state(apply_id) params = { ApplyId: apply_id } execute params, 'QueryApplyStatus' end |
.create(name) ⇒ Object
15 16 17 18 |
# File 'lib/aliyun_iot/product.rb', line 15 def create(name) params = { Name: name } execute params, 'CreateProduct' end |
.execute(params = {}, actiont) ⇒ Object
35 36 37 |
# 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) ⇒ Object
25 26 27 28 |
# 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 |
.query_page_by_apply_id(apply_id, page_size, current_page) ⇒ Object
30 31 32 33 |
# 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 |
Instance Method Details
#batch_check_device_names(params = {}) ⇒ Object
65 66 67 |
# File 'lib/aliyun_iot/product.rb', line 65 def batch_check_device_names(params = {}) execute params, 'BatchCheckDeviceNames' end |
#batch_get_device_state(params = {}) ⇒ Object
77 78 79 |
# 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) ⇒ Object
69 70 71 |
# 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 = {}) ⇒ Object
48 49 50 |
# File 'lib/aliyun_iot/product.rb', line 48 def list(params = {}) execute params, 'QueryDevice' end |
#pub(params = {}) ⇒ Object
81 82 83 84 85 |
# 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) ⇒ Object
73 74 75 |
# 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) ⇒ Object
56 57 58 |
# 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 = {}) ⇒ Object
52 53 54 |
# File 'lib/aliyun_iot/product.rb', line 52 def regist_device(params = {}) execute params, 'RegisterDevice' end |
#regist_devices(params = {}) ⇒ Object
60 61 62 63 |
# 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 = {}) ⇒ Object
91 92 93 |
# File 'lib/aliyun_iot/product.rb', line 91 def rrpc(params = {}) execute params, 'RRpc' end |
#sub(params = {}) ⇒ Object
87 88 89 |
# File 'lib/aliyun_iot/product.rb', line 87 def sub(params = {}) execute params, 'Sub' end |
#update(params = {}) ⇒ Object
44 45 46 |
# File 'lib/aliyun_iot/product.rb', line 44 def update(params = {}) execute params, 'UpdateProduct' end |