arena 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/arena/block.rb +13 -6
- data/lib/arena/entities/image.rb +1 -1
- data/lib/arena/entities/source.rb +1 -1
- data/lib/arena/results.rb +1 -1
- data/lib/arena/search_results.rb +1 -1
- data/lib/arena/user.rb +1 -1
- data/lib/arena/version.rb +1 -1
- metadata +2 -2
data/lib/arena/block.rb
CHANGED
@@ -14,33 +14,40 @@ module Arena
|
|
14
14
|
:connection_id, :connected_at, :connected_by_user_id, :connected_by_username
|
15
15
|
|
16
16
|
def user
|
17
|
-
@user ||= Arena::User.new(@attrs
|
17
|
+
@user ||= Arena::User.new(@attrs['user'])
|
18
18
|
end
|
19
19
|
|
20
20
|
def _class
|
21
|
-
@_class ||= @attrs
|
21
|
+
@_class ||= @attrs['class']
|
22
22
|
end
|
23
23
|
|
24
24
|
def _base_class
|
25
|
-
@_base_class ||= @attrs
|
25
|
+
@_base_class ||= @attrs['base_class']
|
26
26
|
end
|
27
27
|
|
28
28
|
def source
|
29
|
-
@source ||= Arena::Entity::Source.new(@attrs
|
29
|
+
@source ||= Arena::Entity::Source.new(@attrs['source'])
|
30
30
|
end
|
31
31
|
|
32
32
|
def image
|
33
|
-
@image ||= Arena::Entity::Image.new(@attrs
|
33
|
+
@image ||= Arena::Entity::Image.new(@attrs['image']) if has_image?
|
34
34
|
end
|
35
35
|
|
36
36
|
def attachment
|
37
|
-
@attachment ||= Arena::Entity::Attachment.new(@attrs
|
37
|
+
@attachment ||= Arena::Entity::Attachment.new(@attrs['attachment']) if has_attachment?
|
38
38
|
end
|
39
39
|
|
40
40
|
def connections
|
41
41
|
@connections ||= @attrs['connections'].collect { |channel| Arena::Channel.new(channel) }
|
42
42
|
end
|
43
43
|
|
44
|
+
# Detect optional portions of the response
|
45
|
+
[:image, :attachment].each do |kind|
|
46
|
+
define_method "has_#{kind}?" do
|
47
|
+
!@attrs[kind.to_s].nil?
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
44
51
|
end
|
45
52
|
|
46
53
|
class Text < Block; end
|
data/lib/arena/entities/image.rb
CHANGED
@@ -11,7 +11,7 @@ module Arena
|
|
11
11
|
|
12
12
|
%w(thumb display original).each do |method|
|
13
13
|
define_method method do
|
14
|
-
instance_variable_set("@#{method}", Arena::Entity::Version.new(@attrs
|
14
|
+
instance_variable_set("@#{method}", Arena::Entity::Version.new(@attrs[method])) unless instance_variable_get "@#{method}"
|
15
15
|
instance_variable_get "@#{method}"
|
16
16
|
end
|
17
17
|
end
|
data/lib/arena/results.rb
CHANGED
data/lib/arena/search_results.rb
CHANGED
@@ -13,7 +13,7 @@ module Arena
|
|
13
13
|
%w(user channel block).each do |method|
|
14
14
|
define_method "#{method}s" do
|
15
15
|
instance_variable_set("@#{method}s",
|
16
|
-
@attrs
|
16
|
+
@attrs["#{method}s"].collect { |element| "Arena::#{method.capitalize}".constantize.new(element) }
|
17
17
|
) unless instance_variable_get "@#{method}s"
|
18
18
|
instance_variable_get "@#{method}s"
|
19
19
|
end
|
data/lib/arena/user.rb
CHANGED
data/lib/arena/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arena
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|