everytime 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +37 -0
- data/Rakefile +10 -0
- data/everytime.gemspec +26 -0
- data/lib/everytime.rb +83 -0
- data/lib/everytime/version.rb +3 -0
- data/test/test_everytime.rb +186 -0
- metadata +110 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 26a0931f6e52f5a74c48efe0e89da721163533aa
|
4
|
+
data.tar.gz: 5dfaadf9846ee7a120fa7e3d965c5b2c605a6df2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9c039c71d2a0b9c8b6997e633ffe8476a1df1ac794d4516eaad45e4057526b90feaffcde7a69dce170915488751a94e8779d5642ed3e22faec86adf3b6329a9a
|
7
|
+
data.tar.gz: 6c14b6b79cee168adb98ec31fd901d7d64d21c4ddd30e942ceb65671105f178b90a31c3c775b4618bc8e223f2e75a46a26c6e2957941279d3d0c0238d524fa29
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Guillaume Fradin
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Everytime
|
2
|
+
|
3
|
+
Add this line to your application's Gemfile:
|
4
|
+
|
5
|
+
gem 'everytime'
|
6
|
+
|
7
|
+
And then execute:
|
8
|
+
|
9
|
+
$ bundle
|
10
|
+
|
11
|
+
Or install it yourself as:
|
12
|
+
|
13
|
+
$ gem install everytime
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
project = Everytime::Project.new(name: "test todo lists")
|
18
|
+
project.save
|
19
|
+
|
20
|
+
medium = Everytime::Medium.new(path: "https://vimeo.com/13247598", project_id: project.id)
|
21
|
+
medium.save
|
22
|
+
|
23
|
+
bookmark = Everytime::Bookmark.new(title: "super moment", start_time: 50000, medium_id: medium.id)
|
24
|
+
bookmark.save
|
25
|
+
|
26
|
+
todo_list = Everytime::TodoList.new(name: "todo list", project_id: project.id)
|
27
|
+
todo_list.save
|
28
|
+
|
29
|
+
todo_item = Everytime::TodoItem.new(text: "shopping", todo_list_id: todo_list.id)
|
30
|
+
todo_item.save
|
31
|
+
|
32
|
+
storyboard = Everytime::Storyboard.new(name: "todo list", project_id: project.id)
|
33
|
+
storyboard.save
|
34
|
+
|
35
|
+
drawing = Everytime::Drawing.new(text: "[]", storyboard_id: storyboard.id)
|
36
|
+
drawing.save
|
37
|
+
|
data/Rakefile
ADDED
data/everytime.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'everytime/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "everytime"
|
8
|
+
spec.version = Everytime::VERSION
|
9
|
+
spec.authors = ["Everytime"]
|
10
|
+
spec.email = ["admin@everytimehq.com"]
|
11
|
+
spec.summary = %q{Everytime Api Wrapper}
|
12
|
+
spec.description = %q{Everytime Api Wrapper}
|
13
|
+
spec.homepage = "https://www.everytimehq.com/api"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
22
|
+
spec.add_development_dependency "rake", '~> 10.3'
|
23
|
+
spec.add_development_dependency "minitest", '~> 5.3'
|
24
|
+
|
25
|
+
spec.add_dependency 'activeresource', '~> 4.0'
|
26
|
+
end
|
data/lib/everytime.rb
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
require "everytime/version"
|
2
|
+
require 'active_resource'
|
3
|
+
|
4
|
+
module Everytime
|
5
|
+
|
6
|
+
class Resource < ActiveResource::Base
|
7
|
+
API_ROOT = "/api/v1"
|
8
|
+
|
9
|
+
# def self.auth_token=(token)
|
10
|
+
|
11
|
+
# end
|
12
|
+
self.site = (ENV["RAKE_ENV"] == "test") ? "http://localhost:5000" : "https://www.everytimehq.com"
|
13
|
+
|
14
|
+
def self.parent_resource(parent)
|
15
|
+
@parent_resource = parent
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.prefix_source
|
19
|
+
API_ROOT + "/" + ( @parent_resource ? "#{@parent_resource.to_s.pluralize}/:#{@parent_resource}_id" : "" )
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.check_prefix_options(options)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.prefix(options = {})
|
26
|
+
args = options.any? ? options.map { |name, value| "/#{name.to_s.chomp('_id').pluralize}/#{value}" }.join : ""
|
27
|
+
API_ROOT + args + "/"
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.all(options = {})
|
31
|
+
find(:all, options)
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.first(options = {})
|
35
|
+
find(:first, options)
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.last(options = {})
|
39
|
+
find(:last, options)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.prefix_options
|
43
|
+
id ? {} : super
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
class Bookmark < Resource
|
50
|
+
parent_resource :medium
|
51
|
+
end
|
52
|
+
class Drawing < Resource
|
53
|
+
parent_resource :storyboard
|
54
|
+
end
|
55
|
+
class TodoItem < Resource
|
56
|
+
parent_resource :todo_list
|
57
|
+
end
|
58
|
+
|
59
|
+
class Medium < Resource
|
60
|
+
parent_resource :project
|
61
|
+
#has_many :bookmarks
|
62
|
+
end
|
63
|
+
class Storyboard < Resource
|
64
|
+
parent_resource :project
|
65
|
+
#has_many :drawings
|
66
|
+
end
|
67
|
+
class TodoList < Resource
|
68
|
+
parent_resource :project
|
69
|
+
#has_many :todo_items
|
70
|
+
end
|
71
|
+
|
72
|
+
class Project < Resource
|
73
|
+
has_many :media, class_name: "Everytime::Medium"
|
74
|
+
# has_many :todo_lists
|
75
|
+
# has_many :storyboards
|
76
|
+
# has_many :play_lists
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
|
@@ -0,0 +1,186 @@
|
|
1
|
+
# RAKE_ENV=test EVERYTIME_API_TOKEN=xEBMjjVqP3tF4Hjzze9P rake test
|
2
|
+
# console: irb -Ilib -reverytime
|
3
|
+
|
4
|
+
require "minitest/autorun"
|
5
|
+
require 'active_support/testing/assertions'
|
6
|
+
include ActiveSupport::Testing::Assertions
|
7
|
+
|
8
|
+
require 'everytime'
|
9
|
+
|
10
|
+
class EverytimeTest < Minitest::Test
|
11
|
+
|
12
|
+
Everytime::Resource.user = ENV["EVERYTIME_API_TOKEN"]
|
13
|
+
|
14
|
+
|
15
|
+
def test_projects
|
16
|
+
project_id = nil
|
17
|
+
assert_difference 'Everytime::Project.all.count', 1 do
|
18
|
+
project = Everytime::Project.new(name: "test project")
|
19
|
+
assert project.save
|
20
|
+
project_id = project.id
|
21
|
+
assert project_id
|
22
|
+
end
|
23
|
+
|
24
|
+
project = Everytime::Project.find(project_id)
|
25
|
+
assert_equal project.name, "test project"
|
26
|
+
|
27
|
+
project.name = "changed name 2"
|
28
|
+
assert project.save
|
29
|
+
|
30
|
+
project.reload
|
31
|
+
assert_equal project.name, "changed name 2"
|
32
|
+
|
33
|
+
assert_difference 'Everytime::Project.all.count', -1 do
|
34
|
+
project.destroy
|
35
|
+
end
|
36
|
+
|
37
|
+
assert_equal Everytime::Project.all.count, 0
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_media
|
42
|
+
project = Everytime::Project.new(name: "test media")
|
43
|
+
assert project.save
|
44
|
+
|
45
|
+
assert_difference 'project.reload.media.count', 1 do
|
46
|
+
medium = Everytime::Medium.new(path: "https://vimeo.com/13247598", project_id: project.id)
|
47
|
+
assert medium.save
|
48
|
+
end
|
49
|
+
|
50
|
+
medium_id = project.media.last.id
|
51
|
+
medium = Everytime::Medium.find(medium_id)
|
52
|
+
assert medium.exists?
|
53
|
+
|
54
|
+
assert_equal medium.title, "\"Puppet\" Short Film"
|
55
|
+
medium.title = "Short film by Guillaume Fradin"
|
56
|
+
assert medium.save
|
57
|
+
|
58
|
+
medium.reload
|
59
|
+
|
60
|
+
assert_equal medium.title, "Short film by Guillaume Fradin"
|
61
|
+
|
62
|
+
bookmark_id = nil
|
63
|
+
assert_difference 'medium.reload.bookmarks.count', 1 do
|
64
|
+
bookmark = Everytime::Bookmark.new(title: "super moment", start_time: 50000, medium_id: medium.id)
|
65
|
+
assert bookmark.save
|
66
|
+
bookmark_id = bookmark.id
|
67
|
+
end
|
68
|
+
|
69
|
+
bookmark = Everytime::Bookmark.find(bookmark_id)
|
70
|
+
bookmark.title = "changed"
|
71
|
+
bookmark.save
|
72
|
+
|
73
|
+
bookmark.reload
|
74
|
+
assert_equal bookmark.title, "changed"
|
75
|
+
|
76
|
+
assert_difference 'medium.reload.bookmarks.count', -1 do
|
77
|
+
bookmark.destroy
|
78
|
+
end
|
79
|
+
|
80
|
+
assert_difference 'project.reload.media.count', -1 do
|
81
|
+
medium.destroy
|
82
|
+
end
|
83
|
+
|
84
|
+
project.destroy
|
85
|
+
|
86
|
+
assert_equal Everytime::Project.all.count, 0
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_todo_lists
|
91
|
+
project = Everytime::Project.new(name: "test todo lists")
|
92
|
+
assert project.save
|
93
|
+
|
94
|
+
assert_difference 'project.reload.todo_lists.count', 1 do
|
95
|
+
todo_list = Everytime::TodoList.new(name: "todo list", project_id: project.id)
|
96
|
+
assert todo_list.save
|
97
|
+
end
|
98
|
+
|
99
|
+
todo_list_id = project.todo_lists.last.id
|
100
|
+
todo_list = Everytime::TodoList.find(todo_list_id)
|
101
|
+
assert todo_list.exists?
|
102
|
+
|
103
|
+
assert_equal todo_list.name, "todo list"
|
104
|
+
todo_list.name = "to do quickly"
|
105
|
+
assert todo_list.save
|
106
|
+
|
107
|
+
todo_list.reload
|
108
|
+
|
109
|
+
assert_equal todo_list.name, "to do quickly"
|
110
|
+
|
111
|
+
todo_item_id = nil
|
112
|
+
assert_difference 'todo_list.reload.items.count', 1 do
|
113
|
+
todo_item = Everytime::TodoItem.new(text: "shopping", todo_list_id: todo_list.id)
|
114
|
+
assert todo_item.save
|
115
|
+
todo_item_id = todo_item.id
|
116
|
+
end
|
117
|
+
|
118
|
+
todo_item = Everytime::TodoItem.find(todo_item_id)
|
119
|
+
todo_item.text = "changed"
|
120
|
+
todo_item.save
|
121
|
+
|
122
|
+
todo_item.reload
|
123
|
+
assert_equal todo_item.text, "changed"
|
124
|
+
|
125
|
+
assert_difference 'todo_list.reload.items.count', -1 do
|
126
|
+
todo_item.destroy
|
127
|
+
end
|
128
|
+
|
129
|
+
assert_difference 'project.reload.todo_lists.count', -1 do
|
130
|
+
todo_list.destroy
|
131
|
+
end
|
132
|
+
|
133
|
+
project.destroy
|
134
|
+
|
135
|
+
assert_equal Everytime::Project.all.count, 0
|
136
|
+
end
|
137
|
+
|
138
|
+
def test_storyboards
|
139
|
+
project = Everytime::Project.new(name: "test storyboards")
|
140
|
+
assert project.save
|
141
|
+
|
142
|
+
assert_difference 'project.reload.storyboards.count', 1 do
|
143
|
+
storyboard = Everytime::Storyboard.new(name: "todo list", project_id: project.id)
|
144
|
+
assert storyboard.save
|
145
|
+
end
|
146
|
+
|
147
|
+
storyboard_id = project.storyboards.last.id
|
148
|
+
storyboard = Everytime::Storyboard.find(storyboard_id)
|
149
|
+
assert storyboard.exists?
|
150
|
+
|
151
|
+
assert_equal storyboard.name, "todo list"
|
152
|
+
storyboard.name = "to do quickly"
|
153
|
+
assert storyboard.save
|
154
|
+
|
155
|
+
storyboard.reload
|
156
|
+
|
157
|
+
assert_equal storyboard.name, "to do quickly"
|
158
|
+
|
159
|
+
drawing_id = nil
|
160
|
+
assert_difference 'storyboard.reload.items.count', 1 do
|
161
|
+
drawing = Everytime::Drawing.new(text: "shopping", storyboard_id: storyboard.id)
|
162
|
+
assert drawing.save
|
163
|
+
drawing_id = drawing.id
|
164
|
+
end
|
165
|
+
|
166
|
+
drawing = Everytime::Drawing.find(drawing_id)
|
167
|
+
drawing.text = "changed"
|
168
|
+
drawing.save
|
169
|
+
|
170
|
+
drawing.reload
|
171
|
+
assert_equal drawing.text, "changed"
|
172
|
+
|
173
|
+
assert_difference 'storyboard.reload.items.count', -1 do
|
174
|
+
drawing.destroy
|
175
|
+
end
|
176
|
+
|
177
|
+
assert_difference 'project.reload.storyboards.count', -1 do
|
178
|
+
storyboard.destroy
|
179
|
+
end
|
180
|
+
|
181
|
+
project.destroy
|
182
|
+
|
183
|
+
assert_equal Everytime::Project.all.count, 0
|
184
|
+
end
|
185
|
+
|
186
|
+
end
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: everytime
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Everytime
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-04-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: activeresource
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '4.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '4.0'
|
69
|
+
description: Everytime Api Wrapper
|
70
|
+
email:
|
71
|
+
- admin@everytimehq.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- Gemfile
|
78
|
+
- LICENSE.txt
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
81
|
+
- everytime.gemspec
|
82
|
+
- lib/everytime.rb
|
83
|
+
- lib/everytime/version.rb
|
84
|
+
- test/test_everytime.rb
|
85
|
+
homepage: https://www.everytimehq.com/api
|
86
|
+
licenses:
|
87
|
+
- MIT
|
88
|
+
metadata: {}
|
89
|
+
post_install_message:
|
90
|
+
rdoc_options: []
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
requirements: []
|
104
|
+
rubyforge_project:
|
105
|
+
rubygems_version: 2.2.2
|
106
|
+
signing_key:
|
107
|
+
specification_version: 4
|
108
|
+
summary: Everytime Api Wrapper
|
109
|
+
test_files:
|
110
|
+
- test/test_everytime.rb
|