talkbird 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/talkbird/entity/channel.rb +20 -7
- data/lib/talkbird/entity/message.rb +0 -1
- data/lib/talkbird/version.rb +1 -1
- data/talkbird.gemspec +3 -3
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d93a43e42aa41cd106662b712006e9414180f4473c11355f392455d9fd5a602e
|
4
|
+
data.tar.gz: 819e32e30b8d6dee811b991780bc6c72442f38c9e50404caae79e97bf5eccddc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a895ad43282042215bab64affaed6f67fbc510b835cbd985a9fc79248020471e3034552ba0a293e78bd1ba9cfb664e0b9bcc3100cc40600e0229e1bd1cb51937
|
7
|
+
data.tar.gz: 54d51f59a3f22e5ed97f75a1b04472ca22be264aab0ea44010ccf7d6fc303705759f1f19a89efc2c294eb5f3c5cf02d9aed52d811fea5d24bce2c4b2c49c32b9
|
@@ -27,12 +27,19 @@ module Talkbird
|
|
27
27
|
)
|
28
28
|
|
29
29
|
if result.is_a?(Result::Success)
|
30
|
-
Channel.
|
30
|
+
Channel.build(result.body[:channels].first)
|
31
31
|
else
|
32
32
|
false
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
# Build a channel based on the current payload.
|
37
|
+
#
|
38
|
+
# @return [Channel, Boolean]
|
39
|
+
def build(payload)
|
40
|
+
!payload.empty? && Channel.new(payload)
|
41
|
+
end
|
42
|
+
|
36
43
|
def create(from, to, opts = {})
|
37
44
|
body = DEFAULTS.merge(opts)
|
38
45
|
|
@@ -66,6 +73,14 @@ module Talkbird
|
|
66
73
|
@data[:channel_url]
|
67
74
|
end
|
68
75
|
|
76
|
+
def name
|
77
|
+
@data[:name]
|
78
|
+
end
|
79
|
+
|
80
|
+
def members
|
81
|
+
@data[:members].map { |hsh| Entity::User.new(hsh) }
|
82
|
+
end
|
83
|
+
|
69
84
|
def update(message)
|
70
85
|
body = {
|
71
86
|
user_id: message.sender.id,
|
@@ -73,17 +88,15 @@ module Talkbird
|
|
73
88
|
message_type: 'MESG',
|
74
89
|
}
|
75
90
|
|
76
|
-
|
91
|
+
Client.request(
|
77
92
|
:post,
|
78
93
|
"group_channels/#{id}/messages",
|
79
94
|
body: body
|
80
95
|
)
|
96
|
+
end
|
81
97
|
|
82
|
-
|
83
|
-
|
84
|
-
else
|
85
|
-
false
|
86
|
-
end
|
98
|
+
def to_s
|
99
|
+
"#<Talkbird::Entity::Channel id=#{id}>"
|
87
100
|
end
|
88
101
|
|
89
102
|
end
|
data/lib/talkbird/version.rb
CHANGED
data/talkbird.gemspec
CHANGED
@@ -26,9 +26,9 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
27
|
spec.require_paths = ['lib']
|
28
28
|
|
29
|
-
spec.add_dependency 'activesupport'
|
30
|
-
spec.add_dependency 'multi_json'
|
31
|
-
spec.add_dependency 'http'
|
29
|
+
spec.add_dependency 'activesupport'
|
30
|
+
spec.add_dependency 'multi_json'
|
31
|
+
spec.add_dependency 'http'
|
32
32
|
|
33
33
|
spec.add_development_dependency 'bundler', '~> 1.17'
|
34
34
|
spec.add_development_dependency 'pry', '~> 0.12.2'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: talkbird
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrei Maxim
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: multi_json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: http
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|