vermonster 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,117 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.cheddarapp.com/v1/me
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Authorization:
11
+ - Bearer 6e8c9e570805e75d683a963b1290116a
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - ! '*/*'
16
+ User-Agent:
17
+ - Ruby
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Access-Control-Allow-Headers:
24
+ - ! '*,X-Pusher-Socket-ID,Content-Type,Authorization'
25
+ Access-Control-Allow-Methods:
26
+ - GET, POST, PUT, OPTIONS
27
+ Access-Control-Allow-Origin:
28
+ - ! '*'
29
+ Access-Control-Max-Age:
30
+ - '86400'
31
+ Access-Control-Request-Method:
32
+ - ! '*'
33
+ Cache-Control:
34
+ - must-revalidate, private, max-age=0
35
+ Content-Type:
36
+ - application/json; charset=utf-8
37
+ Date:
38
+ - Thu, 19 Jul 2012 12:47:59 GMT
39
+ Etag:
40
+ - ! '"ef42e623e164e34871846180e276f9de"'
41
+ Server:
42
+ - thin 1.4.1 codename Chromeo
43
+ X-Rack-Cache:
44
+ - miss
45
+ X-Request-Id:
46
+ - 0bd7540cb7dcb5534975ffba3e5f9261
47
+ X-Runtime:
48
+ - '0.014167'
49
+ X-Ua-Compatible:
50
+ - IE=Edge,chrome=1
51
+ Content-Length:
52
+ - '354'
53
+ Connection:
54
+ - keep-alive
55
+ body:
56
+ encoding: US-ASCII
57
+ string: ! '{"created_at":"2012-07-18T19:33:13Z","first_name":null,"has_plus":false,"id":13055,"last_name":null,"updated_at":"2012-07-18T19:33:13Z","username":"vermonster","url":"https://api.cheddarapp.com/v1/users/13055","socket":{"auth_url":"https://api.cheddarapp.com/pusher/auth","api_key":"675f10a650f18b4eb0a8","app_id":"15197","channel":"private-user-13055"}}'
58
+ http_version:
59
+ recorded_at: Thu, 19 Jul 2012 12:47:59 GMT
60
+ - request:
61
+ method: get
62
+ uri: https://api.cheddarapp.com/v1/me
63
+ body:
64
+ encoding: US-ASCII
65
+ string: ''
66
+ headers:
67
+ Authorization:
68
+ - Bearer 6e8c9e570805e75d683a963b1290116a
69
+ Accept-Encoding:
70
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
71
+ Accept:
72
+ - ! '*/*'
73
+ User-Agent:
74
+ - Ruby
75
+ response:
76
+ status:
77
+ code: 200
78
+ message: OK
79
+ headers:
80
+ Access-Control-Allow-Headers:
81
+ - ! '*,X-Pusher-Socket-ID,Content-Type,Authorization'
82
+ Access-Control-Allow-Methods:
83
+ - GET, POST, PUT, OPTIONS
84
+ Access-Control-Allow-Origin:
85
+ - ! '*'
86
+ Access-Control-Max-Age:
87
+ - '86400'
88
+ Access-Control-Request-Method:
89
+ - ! '*'
90
+ Cache-Control:
91
+ - must-revalidate, private, max-age=0
92
+ Content-Type:
93
+ - application/json; charset=utf-8
94
+ Date:
95
+ - Thu, 19 Jul 2012 12:48:00 GMT
96
+ Etag:
97
+ - ! '"ef42e623e164e34871846180e276f9de"'
98
+ Server:
99
+ - thin 1.4.1 codename Chromeo
100
+ X-Rack-Cache:
101
+ - miss
102
+ X-Request-Id:
103
+ - db1848cbbec147bb7d76206c70a3a960
104
+ X-Runtime:
105
+ - '0.019653'
106
+ X-Ua-Compatible:
107
+ - IE=Edge,chrome=1
108
+ Content-Length:
109
+ - '354'
110
+ Connection:
111
+ - keep-alive
112
+ body:
113
+ encoding: US-ASCII
114
+ string: ! '{"created_at":"2012-07-18T19:33:13Z","first_name":null,"has_plus":false,"id":13055,"last_name":null,"updated_at":"2012-07-18T19:33:13Z","username":"vermonster","url":"https://api.cheddarapp.com/v1/users/13055","socket":{"auth_url":"https://api.cheddarapp.com/pusher/auth","api_key":"675f10a650f18b4eb0a8","app_id":"15197","channel":"private-user-13055"}}'
115
+ http_version:
116
+ recorded_at: Thu, 19 Jul 2012 12:48:00 GMT
117
+ recorded_with: VCR 2.2.3
@@ -0,0 +1,24 @@
1
+ require_relative "../lib/vermonster"
2
+
3
+ require "rspec"
4
+ require "vcr"
5
+ require "webmock/rspec"
6
+
7
+ VCR.configure do |c|
8
+ c.cassette_library_dir = "spec/fixtures/cassettes"
9
+ c.hook_into :webmock
10
+ end
11
+
12
+ RSpec.configure do |c|
13
+ c.extend VCR::RSpec::Macros
14
+ end
15
+
16
+ def oauth!
17
+ @client = {
18
+ :id => "f8d4f247547ad5315dd7127c7799a737",
19
+ :secret => "e8ae0a776a78772412b66635f718776b"
20
+ }
21
+
22
+ @cheddar = Vermonster::Client.new(:id => @client[:id], :secret => @client[:secret])
23
+ @cheddar.use_token!("6e8c9e570805e75d683a963b1290116a")
24
+ end
@@ -0,0 +1,54 @@
1
+ require "spec_helper"
2
+
3
+ describe Vermonster::Authentication do
4
+ before do
5
+ VCR.insert_cassette 'authentication', :record => :all
6
+ end
7
+
8
+ before(:each) do
9
+ @client = {
10
+ :id => "f8d4f247547ad5315dd7127c7799a737",
11
+ :secret => "e8ae0a776a78772412b66635f718776b"
12
+ }
13
+
14
+ @cheddar = Vermonster::Client.new(:id => @client[:id], :secret => @client[:secret])
15
+ end
16
+
17
+ describe "#authorize_url" do
18
+ it "should return the correct url" do
19
+ @cheddar.authorize_url.should == "https://api.cheddarapp.com/oauth/authorize?client_id=#{@client[:id]}"
20
+ end
21
+
22
+ it "should take other parameters" do
23
+ @cheddar.authorize_url(:redirect_uri => "http://google.com", :state => "foobar").should == "https://api.cheddarapp.com/oauth/authorize?client_id=#{@client[:id]}&redirect_uri=http://google.com&state=foobar"
24
+ end
25
+ end
26
+
27
+ describe "#token!" do
28
+ end
29
+
30
+ describe "#use_token!" do
31
+ it "should authenticate and return true when given an access token" do
32
+ @cheddar.use_token!("6e8c9e570805e75d683a963b1290116a").should be_true
33
+ end
34
+
35
+ it "should not authentication and return false when not given a real access token" do
36
+ @cheddar.use_token!("foobar").should be_false
37
+ end
38
+ end
39
+
40
+ describe "#authorized?" do
41
+ it "should return true if authorized" do
42
+ @cheddar.use_token!("6e8c9e570805e75d683a963b1290116a")
43
+ @cheddar.authorized?.should be_true
44
+ end
45
+
46
+ it "should return false if not authorized" do
47
+ @cheddar.authorized?.should be_false
48
+ end
49
+ end
50
+
51
+ after do
52
+ VCR.eject_cassette
53
+ end
54
+ end
@@ -0,0 +1,107 @@
1
+ require "spec_helper"
2
+
3
+ describe Vermonster::Lists do
4
+ before do
5
+ VCR.insert_cassette 'lists', :record => :new_episodes
6
+ end
7
+
8
+ before(:each) do
9
+ oauth!
10
+ end
11
+
12
+ describe "#lists" do
13
+ describe "#all" do
14
+ before do
15
+ @lists = @cheddar.lists.all
16
+ end
17
+
18
+ it "should be an instance of Array" do
19
+ @lists.should be_an_instance_of Array
20
+ end
21
+
22
+ it "should return Array of List instances" do
23
+ @lists.first.should be_an_instance_of Vermonster::Lists::List
24
+ end
25
+
26
+ it "should return the correct information" do
27
+ @lists.first["title"].should == "Learn Cheddar"
28
+ @lists.first["user"]["username"].should == "vermonster"
29
+ end
30
+ end
31
+
32
+ describe "#find" do
33
+ before do
34
+ @list = @cheddar.lists.find(24200)
35
+ end
36
+
37
+ it "should be an instance of List" do
38
+ @list.should be_an_instance_of Vermonster::Lists::List
39
+ end
40
+
41
+ it "should return the correct information" do
42
+ @list["title"].should == "Learn Cheddar"
43
+ @list["user"]["username"].should == "vermonster"
44
+ end
45
+ end
46
+
47
+ describe "#create" do
48
+ before do
49
+ @list = @cheddar.lists.create(:title => "Foobar")
50
+ end
51
+
52
+ it "should be an instance of List" do
53
+ @list.should be_an_instance_of Vermonster::Lists::List
54
+ end
55
+
56
+ it "should return the correct information" do
57
+ @list["title"].should == "Foobar"
58
+ end
59
+ end
60
+ end
61
+
62
+ describe "::List" do
63
+ describe "#initialize" do
64
+ before do
65
+ @list = Vermonster::Lists::List.new(Vermonster::Client.connection.get("lists/24200").body)
66
+ end
67
+
68
+ it "should return the same information from generated instance variables as key-value request" do
69
+ @list["title"].should == @list.title
70
+ end
71
+ end
72
+
73
+ describe "#tasks" do
74
+ before do
75
+ @tasks = @cheddar.lists.find(24200).tasks
76
+ end
77
+
78
+ it "should be an instance of Array" do
79
+ @tasks.should be_an_instance_of Array
80
+ end
81
+
82
+ it "should return Array of Task instances" do
83
+ @tasks.first.should be_an_instance_of Vermonster::Tasks::Task
84
+ end
85
+
86
+ it "should return the correct information" do
87
+ @tasks.first["display_text"].should == "Welcome to Cheddar! Click the checkbox to complete tasks"
88
+ @tasks.first["id"].should == 182736
89
+ end
90
+ end
91
+
92
+ describe "#update" do
93
+ before do
94
+ @list = @cheddar.lists.find(24200)
95
+ @list.update(:title => "Learn Vermonster")
96
+ end
97
+
98
+ it "should return the correct information" do
99
+ @list["title"].should == "Learn Vermonster"
100
+ end
101
+ end
102
+ end
103
+
104
+ after do
105
+ VCR.eject_cassette
106
+ end
107
+ end
@@ -0,0 +1,119 @@
1
+ require "spec_helper"
2
+
3
+ describe Vermonster::Tasks do
4
+ before do
5
+ VCR.insert_cassette 'tasks', :record => :new_episodes
6
+ end
7
+
8
+ before(:each) do
9
+ oauth!
10
+ end
11
+
12
+ describe "#tasks" do
13
+ describe "#find" do
14
+ before do
15
+ @task = @cheddar.tasks.find(182736)
16
+ end
17
+
18
+ it "should be an instance of Task" do
19
+ @task.should be_an_instance_of Vermonster::Tasks::Task
20
+ end
21
+
22
+ it "should return the correct information" do
23
+ @task["display_text"].should == "Welcome to Cheddar! Click the checkbox to complete tasks"
24
+ @task["id"].should == 182736
25
+ end
26
+ end
27
+
28
+ describe "#from_list" do
29
+ before do
30
+ @tasks = @cheddar.tasks.from_list(24200)
31
+ end
32
+
33
+ it "should be an instance of Array" do
34
+ @tasks.should be_an_instance_of Array
35
+ end
36
+
37
+ it "should return Array of Task instances" do
38
+ @tasks.first.should be_an_instance_of Vermonster::Tasks::Task
39
+ end
40
+
41
+ it "should return the correct information" do
42
+ @tasks.first["display_text"].should == "Welcome to Cheddar! Click the checkbox to complete tasks"
43
+ @tasks.first["id"].should == 182736
44
+ end
45
+ end
46
+
47
+ describe "#create" do
48
+ before do
49
+ @task = @cheddar.tasks.create(24200, :text => "Foo to the bar.")
50
+ end
51
+
52
+ it "should be an instance of Task" do
53
+ @task.should be_an_instance_of Vermonster::Tasks::Task
54
+ end
55
+
56
+ it "should return the correct information" do
57
+ @task["text"].should == "Foo to the bar."
58
+ end
59
+ end
60
+
61
+ describe "#archive" do
62
+ before do
63
+ @cheddar.tasks.archive(24393)
64
+ end
65
+
66
+ it "should archive all completed tasks" do
67
+ @cheddar.lists.find(24393).tasks.should be_empty
68
+ end
69
+ end
70
+
71
+ describe "#archive!" do
72
+ before do
73
+ @cheddar.tasks.archive!(24393)
74
+ end
75
+
76
+ it "should archive all tasks" do
77
+ @cheddar.lists.find(24393).tasks.should be_empty
78
+ end
79
+ end
80
+ end
81
+
82
+ describe "::Task" do
83
+ describe "#initialize" do
84
+ before do
85
+ @task = @cheddar.tasks.find(182736)
86
+ end
87
+
88
+ it "should return the same information from generated instance variables as key-value request" do
89
+ @task["display_text"].should == @task.display_text
90
+ end
91
+ end
92
+
93
+ describe "#update" do
94
+ before do
95
+ @task = @cheddar.tasks.find(182737)
96
+ @task.update(:text => "Welcome to Vermonster!")
97
+ end
98
+
99
+ it "should return the correct information" do
100
+ @task["text"].should == "Welcome to Vermonster!"
101
+ end
102
+ end
103
+
104
+ describe "#move" do
105
+ before do
106
+ @task = @cheddar.tasks.find(209582)
107
+ @task.move(24398)
108
+ end
109
+
110
+ it "should move the task" do
111
+ @task["list_id"].should == 24398
112
+ end
113
+ end
114
+ end
115
+
116
+ after do
117
+ VCR.eject_cassette
118
+ end
119
+ end
@@ -0,0 +1,59 @@
1
+ require "spec_helper"
2
+
3
+ describe Vermonster::Users do
4
+ before do
5
+ VCR.insert_cassette 'users', :record => :new_episodes
6
+ end
7
+
8
+ before(:each) do
9
+ oauth!
10
+ end
11
+
12
+ describe "#me" do
13
+ before do
14
+ @moi = @cheddar.me
15
+ end
16
+
17
+ it "should be an instance of Vermonster::Users::User" do
18
+ @moi.should be_an_instance_of Vermonster::Users::User
19
+ end
20
+
21
+ it "should return the correct information" do
22
+ @moi["username"].should == "vermonster"
23
+ @moi["has_plus"].should be_false
24
+ end
25
+ end
26
+
27
+ describe "#users" do
28
+ describe "#me" do
29
+ before do
30
+ @moi = @cheddar.users.me
31
+ end
32
+
33
+ it "should be an instance of Vermonster::Users::User" do
34
+ @moi.should be_an_instance_of Vermonster::Users::User
35
+ end
36
+
37
+ it "should return the correct information" do
38
+ @moi["username"].should == "vermonster"
39
+ @moi["has_plus"].should be_false
40
+ end
41
+ end
42
+ end
43
+
44
+ describe "::User" do
45
+ describe "#initalize" do
46
+ before do
47
+ @moi = @cheddar.me
48
+ end
49
+
50
+ it "should return the same information from generated instance variables as key-value request" do
51
+ @moi["username"].should == @moi.username
52
+ end
53
+ end
54
+ end
55
+
56
+ after do
57
+ VCR.eject_cassette
58
+ end
59
+ end
@@ -0,0 +1,29 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "vermonster/version"
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = "vermonster"
7
+ gem.version = Vermonster::VERSION
8
+ gem.authors = ["Ethan Turkeltaub", "Johnathan Croom"]
9
+ gem.email = ["ethan.turkeltaub@gmail.com", "johnathancroom@gmail.com"]
10
+ gem.homepage = "http://github.com/eturk/vermonster"
11
+ gem.summary = %q{Consume all of the Cheddar (API).}
12
+ gem.description = %q{Consume all of the Cheddar (API).}
13
+
14
+ gem.rubyforge_project = "vermonster"
15
+
16
+ gem.files = `git ls-files`.split("\n")
17
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ gem.require_paths = ["lib"]
20
+
21
+ gem.add_dependency 'faraday', '~> 0.8.0'
22
+ gem.add_dependency 'faraday_middleware', '~> 0.8.8'
23
+ gem.add_dependency 'hashie', '~> 1.2.0'
24
+
25
+ gem.add_development_dependency 'rake'
26
+ gem.add_development_dependency 'rspec'
27
+ gem.add_development_dependency 'vcr'
28
+ gem.add_development_dependency 'webmock'
29
+ end
metadata ADDED
@@ -0,0 +1,152 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vermonster
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ethan Turkeltaub
9
+ - Johnathan Croom
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2012-07-29 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: faraday
17
+ requirement: &74044780 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: 0.8.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: *74044780
26
+ - !ruby/object:Gem::Dependency
27
+ name: faraday_middleware
28
+ requirement: &74044460 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 0.8.8
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: *74044460
37
+ - !ruby/object:Gem::Dependency
38
+ name: hashie
39
+ requirement: &74044190 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ version: 1.2.0
45
+ type: :runtime
46
+ prerelease: false
47
+ version_requirements: *74044190
48
+ - !ruby/object:Gem::Dependency
49
+ name: rake
50
+ requirement: &74043950 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: *74043950
59
+ - !ruby/object:Gem::Dependency
60
+ name: rspec
61
+ requirement: &74043680 !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ type: :development
68
+ prerelease: false
69
+ version_requirements: *74043680
70
+ - !ruby/object:Gem::Dependency
71
+ name: vcr
72
+ requirement: &74043410 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ type: :development
79
+ prerelease: false
80
+ version_requirements: *74043410
81
+ - !ruby/object:Gem::Dependency
82
+ name: webmock
83
+ requirement: &74043150 !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: *74043150
92
+ description: Consume all of the Cheddar (API).
93
+ email:
94
+ - ethan.turkeltaub@gmail.com
95
+ - johnathancroom@gmail.com
96
+ executables: []
97
+ extensions: []
98
+ extra_rdoc_files: []
99
+ files:
100
+ - .gitignore
101
+ - .rvmrc
102
+ - Gemfile
103
+ - Gemfile.lock
104
+ - README.markdown
105
+ - Rakefile
106
+ - lib/vermonster.rb
107
+ - lib/vermonster/authentication.rb
108
+ - lib/vermonster/lists.rb
109
+ - lib/vermonster/tasks.rb
110
+ - lib/vermonster/users.rb
111
+ - lib/vermonster/version.rb
112
+ - spec/fixtures/cassettes/authentication.yml
113
+ - spec/fixtures/cassettes/lists.yml
114
+ - spec/fixtures/cassettes/tasks.yml
115
+ - spec/fixtures/cassettes/users.yml
116
+ - spec/spec_helper.rb
117
+ - spec/vermonster/authentication_spec.rb
118
+ - spec/vermonster/lists_spec.rb
119
+ - spec/vermonster/tasks_spec.rb
120
+ - spec/vermonster/users_spec.rb
121
+ - vermonster.gemspec
122
+ homepage: http://github.com/eturk/vermonster
123
+ licenses: []
124
+ post_install_message:
125
+ rdoc_options: []
126
+ require_paths:
127
+ - lib
128
+ required_ruby_version: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ segments:
135
+ - 0
136
+ hash: -383530577
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
+ none: false
139
+ requirements:
140
+ - - ! '>='
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ segments:
144
+ - 0
145
+ hash: -383530577
146
+ requirements: []
147
+ rubyforge_project: vermonster
148
+ rubygems_version: 1.8.10
149
+ signing_key:
150
+ specification_version: 3
151
+ summary: Consume all of the Cheddar (API).
152
+ test_files: []