aliyun_iot 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 45c97913444565a86a94b4a2fa7fc1361c880630
4
- data.tar.gz: b18bc77902e154bb695414f1d11d8c7a3b230ccb
3
+ metadata.gz: 2ebeec2f766094ecf24b6e91fb230ed0022906b9
4
+ data.tar.gz: e5e0aa813830728cd60084e2ee1943ed6c00b229
5
5
  SHA512:
6
- metadata.gz: 4e9f03e9e3621a6fc224ec4e0eb1564e4227fc9b33677c6379f4a5d3c40eec62b5a0e5e1f6226718980f75933bc053f147db99b55419f521f0ebe9c0a36ac434
7
- data.tar.gz: 51d42f05edd550cc952d06facff889b21b9c11cdc25f91e7003b7fea721812d24f78fbe41bba0005b2dd9812b3b73d4fbc31f556b43cf7faf4e8d5c9efda6c73
6
+ metadata.gz: a08a22504fd4cf4a4815f36d31d3fe15b54452e8cfb95d54cb970e6b7b420038b6364605567b95bf332d0cb4f88417193d1050ddadf7530eced4e6c0e1716f85
7
+ data.tar.gz: 5431a69469595b73e03aa21c22aac8f76153edcfcd4f9d872e173cebe40f58847146e7beb447fb75da3f20a8746d74cf11ddf4b309912aae45489aabd17f5f4f
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2018 TODO: Write your name
3
+ Copyright (c) 2018 garrus
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -11,13 +11,13 @@ AliyunIot gem 可以帮助开发者方便地在Rails环境中使用[阿里云物
11
11
  使用 `gem install`
12
12
 
13
13
  ```
14
- gem install "wechat"
14
+ gem install "aliyun_iot"
15
15
  ```
16
16
 
17
17
  或者添加下面这行到 `Gemfile`:
18
18
 
19
19
  ```
20
- gem 'wechat'
20
+ gem 'aliyun_iot'
21
21
  ```
22
22
 
23
23
  运行下面这行代码来安装:
@@ -37,9 +37,7 @@ rails g aliyun_iot:install
37
37
  #### Rails 全局配置
38
38
  Rails应用程序中,需要将配置文件放在`config/aliyun_iot.yml`,可以为不同environment创建不同的配置。
39
39
 
40
- 公众号配置示例:
41
-
42
- ```
40
+ ```yml
43
41
  development:
44
42
  access_key_id: access_key_id
45
43
  access_key_secret: access_key_secret
@@ -75,7 +73,8 @@ production:
75
73
  AliyunIot::Topic[TopicName].delete ## 删除主题
76
74
  AliyunIot::Topic[TopicName].get_topic_attributes ## 获取主题属性
77
75
  AliyunIot::Topic[TopicName].subscribe({Endpoint, FilterTag, NotifyStrategy, NotifyContentFormat}) ## 订阅主题
78
- AliyunMns::Topic[TopicName, SubscriptionName].unsubscribe ## 取消订阅
76
+ AliyunIot::Topic[TopicName, SubscriptionName].unsubscribe ## 取消订阅
77
+ AliyunIot::Topic[TopicName].publish_message({MessageBody, MessageTag, MessageAttributes}) ## 向指定主题发布消息
79
78
  ```
80
79
 
81
80
  #### Product
@@ -20,13 +20,15 @@ module AliyunIot
20
20
  #删除消息
21
21
  def delete
22
22
  check_receipt_handle
23
- Request::Xml.delete(queue.messages_path, end_point, params: {:ReceiptHandle => receipt_handle})
23
+ data = set_data {ReceiptHandle: receipt_handle}
24
+ Request::Xml.delete(queue.messages_path, data)
24
25
  end
25
26
 
26
27
  #修改消息可见时间
27
28
  def change_visibility(seconds)
28
29
  check_receipt_handle
29
- Request::Xml.put(queue.messages_path, end_point, params: {:ReceiptHandle => receipt_handle, :VisibilityTimeout => seconds})
30
+ data = set_data {ReceiptHandle: receipt_handle, VisibilityTimeout: seconds}
31
+ Request::Xml.put(queue.messages_path, data)
30
32
  end
31
33
 
32
34
  def get_data
@@ -54,6 +56,11 @@ module AliyunIot
54
56
  end
55
57
 
56
58
  private
59
+
60
+ def set_data(query)
61
+ {mqs_headers: {"x-mns-version" => "2015-06-06"}, query: query}
62
+ end
63
+
57
64
  def check_receipt_handle
58
65
  raise "No receipt handle for this operation" unless receipt_handle
59
66
  end
@@ -1,3 +1,3 @@
1
1
  module AliyunIot
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aliyun_iot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - CooCOccO
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-08 00:00:00.000000000 Z
11
+ date: 2018-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport