boxspring 0.0.3 → 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.
- checksums.yaml +4 -4
- data/lib/boxspring/attribution.rb +2 -0
- data/lib/boxspring/property.rb +14 -1
- data/lib/boxspring/request.rb +14 -27
- data/lib/boxspring/show.rb +2 -0
- data/lib/boxspring/tag_collection.rb +2 -10
- data/lib/boxspring/taggable.rb +17 -0
- data/lib/boxspring/version.rb +1 -1
- data/lib/boxspring/video.rb +10 -0
- data/lib/boxspring.rb +2 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 679f26a51cb69b455bd097b1fcfbdd32f0dfe9e7
|
4
|
+
data.tar.gz: 5d89c2bb387be76e3a71a1747cd2b29d7b16df39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0110905ac756256abfd2b2e25a08c5cf34fc2b2991056f47ce26495f6cb247f92c962e97ce93da9a2fab0334fdc780d998f98f8f93e6fbe41d60fe450db66fd5
|
7
|
+
data.tar.gz: f9ff213556dc2ebdb9748d5ec02b989e5e5b5ab7f37f9a4104f6f9617e462e53932b7311ee80459431a56565f88550f79433e0d3273622772f0905873a6b748f
|
data/lib/boxspring/property.rb
CHANGED
@@ -99,7 +99,7 @@ module Boxspring
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
|
-
def videos( parameters )
|
102
|
+
def videos( parameters = {} )
|
103
103
|
response = @api_interface.get( "/videos", parameters )
|
104
104
|
if ( response.success? )
|
105
105
|
response.content.map do | video |
|
@@ -112,6 +112,19 @@ module Boxspring
|
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
|
+
def shows_videos( parameters = {} )
|
116
|
+
response = @api_interface.get( "/shows/videos", parameters )
|
117
|
+
if ( response.success? )
|
118
|
+
response.content.map do | video |
|
119
|
+
Video.new( video )
|
120
|
+
end
|
121
|
+
elsif ( response.code == '404' )
|
122
|
+
nil
|
123
|
+
else
|
124
|
+
raise response.error
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
115
128
|
def video_by_id( id )
|
116
129
|
response = @api_interface.get( "/videos/#{id}" )
|
117
130
|
if ( response.success? )
|
data/lib/boxspring/request.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'net/https'
|
2
|
+
require 'addressable/uri'
|
2
3
|
|
3
4
|
module Boxspring
|
4
5
|
|
@@ -31,9 +32,7 @@ module Boxspring
|
|
31
32
|
Response.new( @http.get( compose_request_path( path, parameters ) ) )
|
32
33
|
|
33
34
|
rescue Timeout::Error
|
34
|
-
|
35
35
|
response = nil
|
36
|
-
|
37
36
|
end
|
38
37
|
|
39
38
|
response
|
@@ -53,13 +52,15 @@ module Boxspring
|
|
53
52
|
end
|
54
53
|
|
55
54
|
response =
|
56
|
-
Response.new(
|
57
|
-
|
55
|
+
Response.new(
|
56
|
+
@http.post(
|
57
|
+
compose_request_path( path ),
|
58
|
+
data.join( '&' )
|
59
|
+
)
|
60
|
+
)
|
58
61
|
|
59
62
|
rescue Timeout::Error
|
60
|
-
|
61
63
|
response = nil
|
62
|
-
|
63
64
|
end
|
64
65
|
|
65
66
|
response
|
@@ -67,29 +68,15 @@ module Boxspring
|
|
67
68
|
end
|
68
69
|
|
69
70
|
protected; def compose_request_path( path, parameters = {} )
|
70
|
-
|
71
|
-
# the query
|
72
|
-
query = ""
|
73
71
|
|
74
|
-
|
75
|
-
( @default_parameters.merge( parameters.stringify_keys ) ).each do | key, value |
|
76
|
-
query << "#{key}=#{value}&"
|
77
|
-
end
|
78
|
-
|
79
|
-
# chop the trailing '&'
|
80
|
-
query.chop!
|
81
|
-
|
82
|
-
# does path include parameters?
|
83
|
-
unless path.include?( '?' )
|
84
|
-
# if not, append the query to the url
|
85
|
-
path = path + '?' + query
|
86
|
-
else
|
87
|
-
# if so, append the query to the existing query
|
88
|
-
path = path + '&' + query
|
89
|
-
end
|
72
|
+
addressable = Addressable::URI.new
|
90
73
|
|
91
|
-
path
|
92
|
-
|
74
|
+
addressable.path = path
|
75
|
+
addressable.query =
|
76
|
+
@default_parameters.merge( parameters.stringify_keys ).to_param
|
77
|
+
|
78
|
+
addressable.to_s
|
79
|
+
|
93
80
|
end
|
94
81
|
|
95
82
|
end
|
data/lib/boxspring/show.rb
CHANGED
@@ -2,6 +2,8 @@ module Boxspring
|
|
2
2
|
|
3
3
|
class TagCollection < Base
|
4
4
|
|
5
|
+
include Taggable
|
6
|
+
|
5
7
|
field :created_at
|
6
8
|
field :updated_at
|
7
9
|
|
@@ -9,16 +11,6 @@ module Boxspring
|
|
9
11
|
field :code_name
|
10
12
|
field :name
|
11
13
|
|
12
|
-
def tags
|
13
|
-
@_tags ||= begin
|
14
|
-
self.attributes.include?( :tags ) ?
|
15
|
-
self.attributes[ :tags ].map do | tag |
|
16
|
-
Tag.new( tag )
|
17
|
-
end :
|
18
|
-
nil
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
14
|
end
|
23
15
|
|
24
16
|
end
|
data/lib/boxspring/version.rb
CHANGED
data/lib/boxspring/video.rb
CHANGED
@@ -2,6 +2,8 @@ module Boxspring
|
|
2
2
|
|
3
3
|
class Video < Base
|
4
4
|
|
5
|
+
include Taggable
|
6
|
+
|
5
7
|
field :created_at
|
6
8
|
field :updated_at
|
7
9
|
field :uploaded_at
|
@@ -40,6 +42,14 @@ module Boxspring
|
|
40
42
|
field :react_actions_counts
|
41
43
|
field :views_count
|
42
44
|
|
45
|
+
def show
|
46
|
+
@_show ||= begin
|
47
|
+
self.attributes.include?( :show ) ?
|
48
|
+
Show.new( show ) :
|
49
|
+
nil
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
43
53
|
end
|
44
54
|
|
45
55
|
end
|
data/lib/boxspring.rb
CHANGED
@@ -7,9 +7,10 @@ require 'boxspring/response'
|
|
7
7
|
require 'boxspring/request'
|
8
8
|
|
9
9
|
require 'boxspring/base'
|
10
|
+
require 'boxspring/tag'
|
11
|
+
require 'boxspring/taggable'
|
10
12
|
require 'boxspring/attribution'
|
11
13
|
require 'boxspring/show'
|
12
|
-
require 'boxspring/tag'
|
13
14
|
require 'boxspring/tag_collection'
|
14
15
|
require 'boxspring/user_agent'
|
15
16
|
require 'boxspring/theme_environment'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boxspring
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kristoph Cichocki-Romanov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -84,6 +84,7 @@ files:
|
|
84
84
|
- lib/boxspring/show.rb
|
85
85
|
- lib/boxspring/tag.rb
|
86
86
|
- lib/boxspring/tag_collection.rb
|
87
|
+
- lib/boxspring/taggable.rb
|
87
88
|
- lib/boxspring/theme.rb
|
88
89
|
- lib/boxspring/theme_environment.rb
|
89
90
|
- lib/boxspring/user_agent.rb
|