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
Instance Method Summary collapse
-
#initialize(key) ⇒ Product
constructor
A new instance of Product.
- #list(params = {}) ⇒ Object
- #pub(params = {}) ⇒ 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.
35 36 37 |
# File 'lib/aliyun_iot/product.rb', line 35 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
30 31 32 |
# File 'lib/aliyun_iot/product.rb', line 30 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) params = { ApplyId: apply_id, PageSize: page_size, CurrentPage: current_page } execute params, 'QueryPageByApplyId' end |
Instance Method Details
#list(params = {}) ⇒ Object
43 44 45 |
# File 'lib/aliyun_iot/product.rb', line 43 def list(params = {}) execute params, 'QueryDevice' end |
#pub(params = {}) ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/aliyun_iot/product.rb', line 55 def pub(params = {}) raise RequestException.new(Exception.new("message MessageContent is empty!")) if params[:MessageContent].nil? default_params = { Qos: '0' } default_params.merge!({ Qos: '0' }) if params[:Qos].nil? params[:MessageContent] = Base64.urlsafe_encode64(params[:MessageContent]).chomp execute params.merge(default_params), 'Pub' end |
#regist_device(params = {}) ⇒ Object
47 48 49 |
# File 'lib/aliyun_iot/product.rb', line 47 def regist_device(params = {}) execute params, 'RegistDevice' end |
#regist_devices(params = {}) ⇒ Object
51 52 53 |
# File 'lib/aliyun_iot/product.rb', line 51 def regist_devices(params = {}) execute params, 'ApplyDeviceWithNames' end |
#rrpc(params = {}) ⇒ Object
67 68 69 |
# File 'lib/aliyun_iot/product.rb', line 67 def rrpc(params = {}) execute params, 'RRpc' end |
#sub(params = {}) ⇒ Object
63 64 65 |
# File 'lib/aliyun_iot/product.rb', line 63 def sub(params = {}) execute params, 'Sub' end |
#update(params = {}) ⇒ Object
39 40 41 |
# File 'lib/aliyun_iot/product.rb', line 39 def update(params = {}) execute params, 'UpdateProduct' end |