chute 0.0.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +16 -2
- data/Gemfile.lock +52 -0
- data/LICENSE.txt +20 -0
- data/README.md +46 -0
- data/Rakefile +48 -6
- data/VERSION +1 -0
- data/chute.gemspec +120 -16
- data/lib/chute.rb +7 -20
- data/lib/chute/client.rb +42 -0
- data/lib/chute/configuration.rb +40 -0
- data/lib/chute/connection.rb +64 -0
- data/lib/chute/response.rb +22 -0
- data/lib/chute/v2/albums.rb +60 -0
- data/lib/chute/v2/assets.rb +55 -0
- data/lib/chute/v2/comments.rb +29 -0
- data/lib/chute/v2/flags.rb +21 -0
- data/lib/chute/v2/hearts.rb +21 -0
- data/lib/chute/v2/parcels.rb +21 -0
- data/lib/chute/v2/tags.rb +36 -0
- data/lib/chute/v2/triggers.rb +26 -0
- data/lib/chute/v2/users.rb +18 -0
- data/lib/chute/v2/votes.rb +21 -0
- data/lib/chute/version.rb +7 -1
- data/spec/chute/chute_spec.rb +64 -0
- data/spec/chute/client_spec.rb +82 -0
- data/spec/chute/connection_spec.rb +47 -0
- data/spec/chute/response_spec.rb +16 -0
- data/spec/chute/v2/albums_spec.rb +197 -0
- data/spec/chute/v2/assets_spec.rb +171 -0
- data/spec/chute/v2/comments_spec.rb +88 -0
- data/spec/chute/v2/flags_spec.rb +56 -0
- data/spec/chute/v2/hearts_spec.rb +57 -0
- data/spec/chute/v2/parcels_spec.rb +24 -0
- data/spec/chute/v2/tags_spec.rb +79 -0
- data/spec/chute/v2/trigger_spec.rb +127 -0
- data/spec/chute/v2/users_spec.rb +53 -0
- data/spec/chute/v2/votes_spec.rb +56 -0
- data/spec/fixtures/chute_cassettes/albums/album_create_with_permission_view.yml +69 -0
- data/spec/fixtures/chute_cassettes/albums/albums_add_remove_assets.yml +187 -0
- data/spec/fixtures/chute_cassettes/albums/albums_create.yml +69 -0
- data/spec/fixtures/chute_cassettes/albums/albums_delete.yml +128 -0
- data/spec/fixtures/chute_cassettes/albums/albums_get.yml +135 -0
- data/spec/fixtures/chute_cassettes/albums/albums_list.yml +89 -0
- data/spec/fixtures/chute_cassettes/albums/albums_stats.yml +128 -0
- data/spec/fixtures/chute_cassettes/albums/albums_update.yml +135 -0
- data/spec/fixtures/chute_cassettes/assets/assets_delete.yml +131 -0
- data/spec/fixtures/chute_cassettes/assets/assets_geo.yml +197 -0
- data/spec/fixtures/chute_cassettes/assets/assets_get.yml +138 -0
- data/spec/fixtures/chute_cassettes/assets/assets_import.yml +76 -0
- data/spec/fixtures/chute_cassettes/assets/assets_list.yml +77 -0
- data/spec/fixtures/chute_cassettes/assets/assets_update.yml +138 -0
- data/spec/fixtures/chute_cassettes/comments/comments_create.yml +196 -0
- data/spec/fixtures/chute_cassettes/comments/comments_list.yml +259 -0
- data/spec/fixtures/chute_cassettes/flags/flags_methods.yml +313 -0
- data/spec/fixtures/chute_cassettes/hearts/hearts_methods.yml +254 -0
- data/spec/fixtures/chute_cassettes/tags/tags_assets.yml +311 -0
- data/spec/fixtures/chute_cassettes/triggers/trigger_errors.yml +62 -0
- data/spec/fixtures/chute_cassettes/triggers/triggers_cleanup.yml +184 -0
- data/spec/fixtures/chute_cassettes/triggers/triggers_create.yml +65 -0
- data/spec/fixtures/chute_cassettes/triggers/triggers_delete.yml +124 -0
- data/spec/fixtures/chute_cassettes/triggers/triggers_list.yml +66 -0
- data/spec/fixtures/chute_cassettes/triggers/triggers_update.yml +127 -0
- data/spec/fixtures/chute_cassettes/users/users_get.yml +128 -0
- data/spec/fixtures/chute_cassettes/users/users_me.yml +66 -0
- data/spec/fixtures/chute_cassettes/votes/votes_methods.yml +313 -0
- data/spec/spec_helper.rb +27 -0
- metadata +210 -33
- data/.gitignore +0 -5
- data/README +0 -125
- data/config/chute.rb +0 -0
- data/lib/chute/account.rb +0 -58
- data/lib/chute/app.rb +0 -32
- data/lib/chute/asset.rb +0 -124
- data/lib/chute/bundle.rb +0 -72
- data/lib/chute/chute.rb +0 -203
- data/lib/chute/collection.rb +0 -47
- data/lib/chute/comment.rb +0 -32
- data/lib/chute/exception.rb +0 -7
- data/lib/chute/http_service.rb +0 -114
- data/lib/chute/inbox.rb +0 -41
- data/lib/chute/parcel.rb +0 -45
- data/lib/chute/resource.rb +0 -354
- data/lib/chute/user.rb +0 -113
- data/lib/chute/util.rb +0 -14
- data/test/test_sudoku.rb +0 -7
@@ -0,0 +1,88 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Chute::V2::Comments do
|
4
|
+
include_context "init credentials"
|
5
|
+
|
6
|
+
let(:album_id) do
|
7
|
+
Chute::V2::Albums.create({:name => "Album for Comments"}).data.id
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:asset_id) do
|
11
|
+
Chute::V2::Albums.import(album_id,'http://farm9.staticflickr.com/8194/8141607138_bfaea3afd9.jpg').data[0].id
|
12
|
+
end
|
13
|
+
|
14
|
+
describe ".all" do
|
15
|
+
it { Chute::V2::Comments.should respond_to(:all).with(2).arguments }
|
16
|
+
it { Chute::V2::Comments.should_not respond_to(:all).with(1).arguments }
|
17
|
+
end
|
18
|
+
|
19
|
+
describe ".create" do
|
20
|
+
it { Chute::V2::Comments.should respond_to(:create).with(3).arguments }
|
21
|
+
it { Chute::V2::Comments.should_not respond_to(:create).with(1).arguments }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe ".delete" do
|
25
|
+
it { Chute::V2::Comments.should respond_to(:delete).with(1).arguments }
|
26
|
+
it { Chute::V2::Comments.should_not respond_to(:delete).with(0).arguments }
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
describe "POST Comment Create" do
|
31
|
+
|
32
|
+
before do
|
33
|
+
VCR.insert_cassette 'comments/comments_create', :record => :new_episodes
|
34
|
+
end
|
35
|
+
after do
|
36
|
+
VCR.eject_cassette
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should be able to create new comments" do
|
40
|
+
email = "random@someemail.com"
|
41
|
+
name = "Darko"
|
42
|
+
comment = "Some random comment"
|
43
|
+
|
44
|
+
response = Chute::V2::Comments.create(album_id,asset_id, :comment_text => comment, :name => name , :email => email )
|
45
|
+
response.data.comment_text.should == comment
|
46
|
+
response.data.name.should == name
|
47
|
+
response.data.email.should == email
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
describe "GET List all comments" do
|
53
|
+
|
54
|
+
before do
|
55
|
+
VCR.insert_cassette 'comments/comments_list', :record => :new_episodes
|
56
|
+
end
|
57
|
+
after do
|
58
|
+
VCR.eject_cassette
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should list all comments" do
|
62
|
+
response = Chute::V2::Comments.create(album_id,asset_id, :comment_text => "My Test Comment for listing")
|
63
|
+
comment_id = response.data.id
|
64
|
+
response = Chute::V2::Comments.all(album_id,asset_id)
|
65
|
+
response.success?.should == true
|
66
|
+
response.data.empty?.should == false
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe "DELETE comment" do
|
71
|
+
|
72
|
+
before do
|
73
|
+
VCR.insert_cassette 'comments/comments_delete', :record => :new_episodes
|
74
|
+
end
|
75
|
+
after do
|
76
|
+
VCR.eject_cassette
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should delete comment by id" do
|
80
|
+
pending "FIX Needs to be deployed to server"
|
81
|
+
response = Chute::V2::Comments.create(album_id,asset_id, :comment_text => "My Test Comment for delete")
|
82
|
+
comment_id = response.data.id
|
83
|
+
response = Chute::V2::Comments.delete(comment_id)
|
84
|
+
response.success?.should == true
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Chute::V2::Flags do
|
4
|
+
include_context "init credentials"
|
5
|
+
|
6
|
+
let(:album_id) do
|
7
|
+
Chute::V2::Albums.create({:name => "Album for Flags"}).data.id
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:asset_id) do
|
11
|
+
Chute::V2::Albums.import(album_id,'http://sphotos-f.ak.fbcdn.net/hphotos-ak-snc6/6393_451942991531262_1464781412_n.jpg').data[0].id
|
12
|
+
end
|
13
|
+
|
14
|
+
describe ".all" do
|
15
|
+
it { Chute::V2::Flags.should respond_to(:count).with(2).arguments }
|
16
|
+
it { Chute::V2::Flags.should_not respond_to(:count).with(1).arguments }
|
17
|
+
end
|
18
|
+
|
19
|
+
describe ".create" do
|
20
|
+
it { Chute::V2::Flags.should respond_to(:flag).with(2).arguments }
|
21
|
+
it { Chute::V2::Flags.should_not respond_to(:flag).with(1).arguments }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe ".delete" do
|
25
|
+
it { Chute::V2::Flags.should respond_to(:unflag).with(2).arguments }
|
26
|
+
it { Chute::V2::Flags.should_not respond_to(:unflag).with(1).arguments }
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
describe "flag methods" do
|
31
|
+
|
32
|
+
before do
|
33
|
+
VCR.insert_cassette 'flags/flags_methods', :record => :new_episodes
|
34
|
+
end
|
35
|
+
after do
|
36
|
+
VCR.eject_cassette
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should be able to flag an asset" do
|
40
|
+
response = Chute::V2::Flags.flag(album_id,asset_id)
|
41
|
+
response.success?.should == true
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should be able list all flags" do
|
45
|
+
response = Chute::V2::Flags.count(album_id,asset_id)
|
46
|
+
response.success?.should == true
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should be able delete a flag" do
|
50
|
+
response = Chute::V2::Flags.flag(album_id,asset_id)
|
51
|
+
response = Chute::V2::Flags.unflag(album_id,asset_id)
|
52
|
+
response.success?.should == true
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Chute::V2::Hearts do
|
4
|
+
include_context "init credentials"
|
5
|
+
|
6
|
+
let(:album_id) do
|
7
|
+
Chute::V2::Albums.create({:name => "Album for Hearts"}).data.id
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:asset_id) do
|
11
|
+
Chute::V2::Albums.import(album_id,'http://sphotos-f.ak.fbcdn.net/hphotos-ak-snc6/6393_451942991531262_1464781412_n.jpg').data[0].id
|
12
|
+
end
|
13
|
+
|
14
|
+
describe ".all" do
|
15
|
+
it { Chute::V2::Hearts.should respond_to(:count).with(2).arguments }
|
16
|
+
it { Chute::V2::Hearts.should_not respond_to(:count).with(1).arguments }
|
17
|
+
end
|
18
|
+
|
19
|
+
describe ".create" do
|
20
|
+
it { Chute::V2::Hearts.should respond_to(:heart).with(2).arguments }
|
21
|
+
it { Chute::V2::Hearts.should_not respond_to(:heart).with(1).arguments }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe ".delete" do
|
25
|
+
it { Chute::V2::Hearts.should respond_to(:unheart).with(3).arguments }
|
26
|
+
it { Chute::V2::Hearts.should_not respond_to(:unheart).with(2).arguments }
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
describe "heart methods" do
|
31
|
+
|
32
|
+
before do
|
33
|
+
VCR.insert_cassette 'hearts/hearts_methods', :record => :new_episodes
|
34
|
+
end
|
35
|
+
after do
|
36
|
+
VCR.eject_cassette
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should be able to heart an asset" do
|
40
|
+
response = Chute::V2::Hearts.heart(album_id,asset_id)
|
41
|
+
response.success?.should == true
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should be able list all hearts" do
|
45
|
+
response = Chute::V2::Hearts.count(album_id,asset_id)
|
46
|
+
response.success?.should == true
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should be able delete a heart" do
|
50
|
+
pending "Not working"
|
51
|
+
response = Chute::V2::Hearts.heart(album_id,asset_id)
|
52
|
+
response = Chute::V2::Hearts.unheart(album_id,asset_id,response.data.id)
|
53
|
+
response.success?.should == true
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Chute::V2::Albums do
|
4
|
+
include_context "init credentials"
|
5
|
+
|
6
|
+
describe "methods" do
|
7
|
+
|
8
|
+
describe ".all_parcel_assets" do
|
9
|
+
it { Chute::V2::Parcels.should respond_to(:all_parcel_assets).with(1).arguments }
|
10
|
+
it { Chute::V2::Parcels.should_not respond_to(:all_parcel_assets).with(0).arguments }
|
11
|
+
end
|
12
|
+
|
13
|
+
describe ".find" do
|
14
|
+
it { Chute::V2::Parcels.should respond_to(:find).with(1).arguments }
|
15
|
+
it { Chute::V2::Parcels.should_not respond_to(:find).with(0).arguments }
|
16
|
+
end
|
17
|
+
|
18
|
+
describe ".all_album_parcels" do
|
19
|
+
it { Chute::V2::Parcels.should respond_to(:all_album_parcels).with(1).arguments }
|
20
|
+
it { Chute::V2::Parcels.should_not respond_to(:all_album_parcels).with(0).arguments }
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Chute::V2::Tags do
|
4
|
+
include_context "init credentials"
|
5
|
+
|
6
|
+
let(:album_id) do
|
7
|
+
Chute::V2::Albums.create({:name => "Album for Tags"}).data.id
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:asset_id) do
|
11
|
+
Chute::V2::Albums.import(album_id,'http://farm9.staticflickr.com/8194/8141607138_bfaea3afd9.jpg').data[0].id
|
12
|
+
end
|
13
|
+
|
14
|
+
describe ".all_asset_tags" do
|
15
|
+
it { Chute::V2::Tags.should respond_to(:all_asset_tags).with(2).arguments }
|
16
|
+
it { Chute::V2::Tags.should_not respond_to(:all_asset_tags).with(1).arguments }
|
17
|
+
end
|
18
|
+
|
19
|
+
describe ".update_asset_tags" do
|
20
|
+
it { Chute::V2::Tags.should respond_to(:update_asset_tags).with(3).arguments }
|
21
|
+
it { Chute::V2::Tags.should_not respond_to(:update_asset_tags).with(0).arguments }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe ".add_asset_tags" do
|
25
|
+
it { Chute::V2::Tags.should respond_to(:add_asset_tags).with(3).arguments }
|
26
|
+
it { Chute::V2::Tags.should_not respond_to(:add_asset_tags).with(0).arguments }
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "asset tags" do
|
30
|
+
|
31
|
+
before do
|
32
|
+
VCR.insert_cassette 'tags/tags_assets', :record => :new_episodes
|
33
|
+
end
|
34
|
+
after do
|
35
|
+
VCR.eject_cassette
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should be able to add asset tags" do
|
39
|
+
response = Chute::V2::Tags.add_asset_tags(album_id,asset_id,"TAG","AnotherTag")
|
40
|
+
response.success?.should == true
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should list all asset tags" do
|
44
|
+
response = Chute::V2::Tags.all_asset_tags(album_id,asset_id)
|
45
|
+
response.success?.should == true
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should replace all existing asset tags" do
|
49
|
+
response = Chute::V2::Tags.update_asset_tags(album_id,asset_id,"Replaced TAG1","Replaced Tag2" )
|
50
|
+
response.success?.should == true
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should delete tags by name" do
|
54
|
+
pending "Not deployed on server yet. check soon"
|
55
|
+
response = Chute::V2::Tags.delete_asset_tags(album_id,asset_id,"Replaced TAG1")
|
56
|
+
response.success?.should == true
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
describe ".process_array" do
|
62
|
+
|
63
|
+
it "should be able to produce a single flat array of unique tags" do
|
64
|
+
Chute::V2::Tags.send(:process_array, ["TAG", "AnotherTag", ["TAG", "AnotherTag"]]).should == ["TAG", "AnotherTag"]
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should not remain unmodified" do
|
68
|
+
Chute::V2::Tags.send(:process_array, ["TAG", "AnotherTag", ["TAG", "AnotherTag"]]).should_not == ["TAG", "AnotherTag", ["TAG", "AnotherTag"]]
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should not modify the array if its simple" do
|
72
|
+
Chute::V2::Tags.send(:process_array, ["TAG", "AnotherTag"]).should == ["TAG", "AnotherTag"]
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Chute::V2::Triggers do
|
4
|
+
include_context "init credentials"
|
5
|
+
|
6
|
+
RANDOM_POST_RESPONDING_URL = "http://www.opencalais.com/HTTPexamples"
|
7
|
+
RANDOM_NOT_CORRECT_RESPONSE_URL = "http://www.google.com"
|
8
|
+
|
9
|
+
|
10
|
+
after(:all) do
|
11
|
+
VCR.insert_cassette 'triggers/triggers_cleanup', :record => :new_episodes
|
12
|
+
# Delete all triggers for reuse
|
13
|
+
response = Chute::V2::Triggers.all
|
14
|
+
response.data.each do |item|
|
15
|
+
Chute::V2::Triggers.delete(item.id)
|
16
|
+
end
|
17
|
+
VCR.eject_cassette
|
18
|
+
end
|
19
|
+
|
20
|
+
describe ".all" do
|
21
|
+
it { Chute::V2::Triggers.should respond_to(:all).with(0).arguments }
|
22
|
+
it { Chute::V2::Triggers.should_not respond_to(:all).with(1).arguments }
|
23
|
+
end
|
24
|
+
|
25
|
+
describe ".create" do
|
26
|
+
it { Chute::V2::Triggers.should respond_to(:create).with(2).arguments }
|
27
|
+
it { Chute::V2::Triggers.should_not respond_to(:create).with(1).arguments }
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
describe ".update" do
|
32
|
+
it { Chute::V2::Triggers.should respond_to(:update).with(3).arguments }
|
33
|
+
it { Chute::V2::Triggers.should_not respond_to(:update).with(2).arguments }
|
34
|
+
end
|
35
|
+
|
36
|
+
describe ".delete" do
|
37
|
+
it { Chute::V2::Triggers.should respond_to(:delete).with(1).arguments }
|
38
|
+
it { Chute::V2::Triggers.should_not respond_to(:delete).with(0).arguments }
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
describe "trigger errors" do
|
43
|
+
before do
|
44
|
+
VCR.insert_cassette 'triggers/trigger_errors', :record => :new_episodes
|
45
|
+
end
|
46
|
+
after do
|
47
|
+
VCR.eject_cassette
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should return error if event is non-existent" do
|
51
|
+
event = 'asset_created_once'
|
52
|
+
response = Chute::V2::Triggers.create(RANDOM_NOT_CORRECT_RESPONSE_URL, event)
|
53
|
+
response.response.error.nil?.should == false
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should return error if url doesn't respond to POST with 200 code" do
|
57
|
+
response = Chute::V2::Triggers.create(RANDOM_NOT_CORRECT_RESPONSE_URL, "comment_created")
|
58
|
+
response.response.error.nil?.should == false
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "trigger operations" do
|
64
|
+
|
65
|
+
describe "POST create a new trigger" do
|
66
|
+
|
67
|
+
before do
|
68
|
+
VCR.insert_cassette 'triggers/triggers_create', :record => :new_episodes
|
69
|
+
end
|
70
|
+
after do
|
71
|
+
VCR.eject_cassette
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should be able to create a new trigger" do
|
75
|
+
response = Chute::V2::Triggers.create(RANDOM_POST_RESPONDING_URL, "asset_created")
|
76
|
+
response.response.error.nil?.should == true
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe "PUT update existing trigger" do
|
81
|
+
|
82
|
+
before do
|
83
|
+
VCR.insert_cassette 'triggers/triggers_update', :record => :new_episodes
|
84
|
+
end
|
85
|
+
after do
|
86
|
+
VCR.eject_cassette
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should be able to update an existing trigger" do
|
90
|
+
response = Chute::V2::Triggers.create(RANDOM_POST_RESPONDING_URL, "asset_updated")
|
91
|
+
response = Chute::V2::Triggers.update(response.data.id,RANDOM_POST_RESPONDING_URL, "album_asset_moderated")
|
92
|
+
response.response.error.nil?.should == true
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
describe "GET all triggers" do
|
97
|
+
|
98
|
+
before do
|
99
|
+
VCR.insert_cassette 'triggers/triggers_list', :record => :new_episodes
|
100
|
+
end
|
101
|
+
after do
|
102
|
+
VCR.eject_cassette
|
103
|
+
end
|
104
|
+
|
105
|
+
it "should list all active triggers " do
|
106
|
+
response = Chute::V2::Triggers.all
|
107
|
+
response.success?.should == true
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
describe "DELETE trigger" do
|
112
|
+
|
113
|
+
before do
|
114
|
+
VCR.insert_cassette 'triggers/triggers_delete', :record => :new_episodes
|
115
|
+
end
|
116
|
+
after do
|
117
|
+
VCR.eject_cassette
|
118
|
+
end
|
119
|
+
|
120
|
+
it "should delete a trigger by its id " do
|
121
|
+
response = Chute::V2::Triggers.create(RANDOM_POST_RESPONDING_URL, "asset_deleted")
|
122
|
+
response = Chute::V2::Triggers.delete(response.data.id)
|
123
|
+
response.success?.should == true
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Chute::V2::Users do
|
4
|
+
include_context "init credentials"
|
5
|
+
|
6
|
+
describe "methods" do
|
7
|
+
|
8
|
+
describe ".find" do
|
9
|
+
it { Chute::V2::Users.should respond_to(:find).with(1).arguments }
|
10
|
+
it { Chute::V2::Users.should_not respond_to(:find).with(0).arguments }
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
describe ".me" do
|
15
|
+
it { Chute::V2::Users.should respond_to(:me).with(0).arguments }
|
16
|
+
it { Chute::V2::Users.should_not respond_to(:me).with(1).arguments }
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "requests" do
|
22
|
+
|
23
|
+
describe "GET Current user info" do
|
24
|
+
before do
|
25
|
+
VCR.insert_cassette 'users/users_me', :record => :new_episodes
|
26
|
+
end
|
27
|
+
after do
|
28
|
+
VCR.eject_cassette
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should get the current user info" do
|
32
|
+
response = Chute::V2::Users.me
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "GET User By Id" do
|
38
|
+
before do
|
39
|
+
VCR.insert_cassette 'users/users_get', :record => :new_episodes
|
40
|
+
end
|
41
|
+
after do
|
42
|
+
VCR.eject_cassette
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should be able to get user by id" do
|
46
|
+
response = Chute::V2::Users.me
|
47
|
+
response = Chute::V2::Users.find(response.data.id)
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|