iremix-ruby 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/iremix.rb +1 -0
- data/lib/iremix/user.rb +8 -1
- data/lib/iremix/version.rb +1 -1
- data/lib/iremix/video.rb +23 -0
- data/spec/iremix/user_spec.rb +3 -3
- data/spec/iremix/video_spec.rb +21 -0
- metadata +7 -4
data/lib/iremix.rb
CHANGED
data/lib/iremix/user.rb
CHANGED
@@ -1,11 +1,18 @@
|
|
1
1
|
module Iremix
|
2
2
|
class User
|
3
|
+
attr_accessor :id, :first_name, :last_name, :name, :email,
|
4
|
+
:profile_photo, :created_at, :updated_at, :status
|
5
|
+
|
6
|
+
def initialize(attrs = {})
|
7
|
+
attrs.each do |k, v| send("#{k}=", v) end
|
8
|
+
end
|
9
|
+
|
3
10
|
class << self
|
4
11
|
def current(token)
|
5
12
|
response = token.get('/api/v1/people/current.json',
|
6
13
|
:params => { :access_token => token.token })
|
7
14
|
|
8
|
-
response.parsed
|
15
|
+
new(response.parsed)
|
9
16
|
end
|
10
17
|
end
|
11
18
|
end
|
data/lib/iremix/version.rb
CHANGED
data/lib/iremix/video.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
module Iremix
|
2
|
+
class Video
|
3
|
+
attr_accessor :id, :title, :video_url, :person_id, :screenshot_url,
|
4
|
+
:description, :tags, :group_id, :created_at, :updated_at
|
5
|
+
|
6
|
+
def initialize(attrs = {})
|
7
|
+
attrs.each do |k, v| send("#{k}=", v) end
|
8
|
+
end
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def all(token)
|
12
|
+
response = token.get('/api/v1/videos.json', :params => { :access_token => token.token })
|
13
|
+
videos = []
|
14
|
+
|
15
|
+
response.parsed['videos'].each do |video_attrs|
|
16
|
+
videos << new(video_attrs)
|
17
|
+
end
|
18
|
+
|
19
|
+
videos
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/spec/iremix/user_spec.rb
CHANGED
@@ -4,16 +4,16 @@ require 'iremix/user'
|
|
4
4
|
module Iremix
|
5
5
|
describe User do
|
6
6
|
describe ".current" do
|
7
|
-
it "returns the
|
7
|
+
it "returns the user" do
|
8
8
|
token = OpenStruct.new(:token => '123abc')
|
9
|
-
response = OpenStruct.new(:parsed =>
|
9
|
+
response = OpenStruct.new(:parsed => {"id"=>31637, "first_name"=>"nick", "last_name"=>"nick", "name"=>"nick", "email"=>"nick@neotericdesign.com", "profile_photo"=>nil, "created_at"=>"2012-04-23T14:41:20-05:00", "updated_at"=>"2012-05-04T09:28:56-05:00", "status"=>200})
|
10
10
|
|
11
11
|
token.should_receive(:get)
|
12
12
|
.with('/api/v1/people/current.json',
|
13
13
|
:params => { :access_token => '123abc' })
|
14
14
|
.and_return(response)
|
15
15
|
|
16
|
-
Iremix::User.current(token).should ==
|
16
|
+
Iremix::User.current(token).id.should == 31637
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
require 'iremix/video'
|
3
|
+
|
4
|
+
module Iremix
|
5
|
+
describe Video do
|
6
|
+
it "returns videos" do
|
7
|
+
token = OpenStruct.new(:token => '123abc')
|
8
|
+
response = OpenStruct.new(:parsed => {"videos"=>[{"id"=>7820, "title"=>"Mouse Mantis", "video_url"=>"http://remix-development.s3.amazonaws.com/a0f0bdf33073704d18553f5af88555ff.mp4", "person_id"=>28294, "screenshot_url"=>"http://remix-development.s3.amazonaws.com/a0f0bdf33073704d18553f5af88555ff_2.jpg", "description"=>"
|
9
|
+
mouse mantis
|
10
|
+
|
11
|
+
", "tags"=>["mouse mantis"], "group_id"=>nil, "created_at"=>"2012-04-03T15:53:31-05:00", "updated_at"=>"2012-04-03T15:54:12-05:00"}]})
|
12
|
+
token.should_receive(:get)
|
13
|
+
.with('/api/v1/videos.json',
|
14
|
+
:params => { :access_token => '123abc' })
|
15
|
+
.and_return(response)
|
16
|
+
|
17
|
+
videos = Video.all(token)
|
18
|
+
videos.first.id.should == 7820
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iremix-ruby
|
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:
|
@@ -16,7 +16,7 @@ date: 2012-05-04 00:00:00.000000000 Z
|
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rspec
|
19
|
-
requirement: &
|
19
|
+
requirement: &2163293940 !ruby/object:Gem::Requirement
|
20
20
|
none: false
|
21
21
|
requirements:
|
22
22
|
- - ! '>='
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
version: '0'
|
25
25
|
type: :development
|
26
26
|
prerelease: false
|
27
|
-
version_requirements: *
|
27
|
+
version_requirements: *2163293940
|
28
28
|
description: A ruby wrapper for the iRemix API
|
29
29
|
email:
|
30
30
|
- joe@neotericdesign.com
|
@@ -47,9 +47,11 @@ files:
|
|
47
47
|
- lib/iremix/token.rb
|
48
48
|
- lib/iremix/user.rb
|
49
49
|
- lib/iremix/version.rb
|
50
|
+
- lib/iremix/video.rb
|
50
51
|
- spec/iremix/iremix_spec.rb
|
51
52
|
- spec/iremix/token_spec.rb
|
52
53
|
- spec/iremix/user_spec.rb
|
54
|
+
- spec/iremix/video_spec.rb
|
53
55
|
homepage: http://github.com/neotericdesign/iremix-ruby
|
54
56
|
licenses: []
|
55
57
|
post_install_message:
|
@@ -70,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
72
|
version: '0'
|
71
73
|
requirements: []
|
72
74
|
rubyforge_project:
|
73
|
-
rubygems_version: 1.8.
|
75
|
+
rubygems_version: 1.8.16
|
74
76
|
signing_key:
|
75
77
|
specification_version: 3
|
76
78
|
summary: What the desc. said
|
@@ -78,3 +80,4 @@ test_files:
|
|
78
80
|
- spec/iremix/iremix_spec.rb
|
79
81
|
- spec/iremix/token_spec.rb
|
80
82
|
- spec/iremix/user_spec.rb
|
83
|
+
- spec/iremix/video_spec.rb
|