ten_thousand_feet 0.0.38 → 0.0.111
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/.gitignore +0 -2
- data/README.md +2 -71
- data/lib/ten_thousand_feet/api/users.rb +8 -6
- data/lib/ten_thousand_feet/client.rb +7 -51
- data/lib/ten_thousand_feet/version.rb +1 -1
- data/spec/spec_helper.rb +1 -12
- data/spec/ten_thousand_feet/api/users_spec.rb +28 -26
- data/spec/ten_thousand_feet/client_spec.rb +6 -2
- data/ten_thousand_feet.gemspec +2 -2
- metadata +17 -32
- data/lib/ten_thousand_feet/api/assignments.rb +0 -23
- data/lib/ten_thousand_feet/api/phases.rb +0 -19
- data/lib/ten_thousand_feet/api/projects.rb +0 -35
- data/lib/ten_thousand_feet/api/time_entries.rb +0 -27
- data/lib/ten_thousand_feet/api/user_status.rb +0 -15
- data/spec/ten_thousand_feet/api/assignment_spec.rb +0 -74
- data/spec/ten_thousand_feet/api/phases_spec.rb +0 -61
- data/spec/ten_thousand_feet/api/projects_spec.rb +0 -103
- data/spec/ten_thousand_feet/api/time_entries_spec.rb +0 -76
- data/spec/ten_thousand_feet/api/user_status_spec.rb +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89721edb3f29e30d80b2cc8dde6c71a4c9fb054b
|
4
|
+
data.tar.gz: 5de31ab2ff2025979e85597b3ce0446ccbad5f44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f5885d453ec0725bcfe20081dbfd8ea490f1a790c8ae5116b12d87339f6527f7a656a10ac729f45c483e3fdebe040cc04c536bc537e9f57680fd1d11f07a47e
|
7
|
+
data.tar.gz: 79a744f1491348a728438a4a4460a15a407b157194b0e88e34059fd17c58b3027d73b808f9848b3f692ecb91a157776a886d4add404d2195293ddcaf416c16d7
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -4,84 +4,15 @@ Ruby wrapper for the [10,000ft API (BETA)](http://10kft.github.io/api-documentat
|
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
gem 'ten_thousand_feet'
|
7
|
+
gem install 'ten_thousand_feet'
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
gem install ten_thousand_feet
|
12
|
-
|
13
|
-
## Setup
|
9
|
+
## Usage
|
14
10
|
|
15
11
|
require 'ten_thousand_feet'
|
16
12
|
|
17
13
|
# Initialize a new 10,000ft client
|
18
14
|
client = TenThousandFeet.new(auth: YOUR_AUTH_TOKEN)
|
19
15
|
|
20
|
-
# API Methods
|
21
|
-
Note: 'options' will be different for each method. Check the official API documentation for a list of available options for each call.
|
22
|
-
|
23
|
-
'options' should be passed in as a hash:
|
24
|
-
|
25
|
-
# user_id = 1969
|
26
|
-
#
|
27
|
-
# options = {
|
28
|
-
# first_name: 'Austin',
|
29
|
-
# last_name: 'Powers',
|
30
|
-
# display_name: 'Austin Danger Powers'
|
31
|
-
# }
|
32
|
-
#
|
33
|
-
# client.update_user(user_id, options)
|
34
|
-
|
35
|
-
## Users
|
36
|
-
|
37
|
-
client.get_users(options)
|
38
|
-
client.show_user(user_id, options)
|
39
|
-
client.update_user(user_id, options)
|
40
|
-
client.create_user(options)
|
41
|
-
|
42
|
-
## User Status
|
43
|
-
|
44
|
-
client.get_user_statuses(user_id, options)
|
45
|
-
client.create_user_status(user_id, options)
|
46
|
-
|
47
|
-
## Assignments
|
48
|
-
|
49
|
-
client.get_assignments(user_id, options)
|
50
|
-
client.show_assignment(assignment_id, user_id, options)
|
51
|
-
client.create_assignment(project_id, user_id, options)
|
52
|
-
client.delete_assignment(assignment_id, user_id, options)
|
53
|
-
|
54
|
-
## Projects
|
55
|
-
|
56
|
-
client.get_projects(options)
|
57
|
-
client.show_project(project_id, options)
|
58
|
-
client.update_project(project_id, options)
|
59
|
-
client.create_project(options)
|
60
|
-
client.delete_project(project_id, options)
|
61
|
-
client.get_project_time_entries(project_id, options)
|
62
|
-
client.get_project_users(project_id, options)
|
63
|
-
|
64
|
-
## Phases
|
65
|
-
|
66
|
-
client.get_phases(project_id, options)
|
67
|
-
client.create_phases(project_id, options)
|
68
|
-
client.update_phases(project_id, phase_id, options)
|
69
|
-
|
70
|
-
## Time Entries
|
71
|
-
|
72
|
-
client.get_time_entries(user_id, options)
|
73
|
-
client.show_time_entry(time_entry_id, user_id, options)
|
74
|
-
client.update_time_entry(time_entry_id, user_id, options)
|
75
|
-
client.create_time_entry(user_id, options)
|
76
|
-
client.delete_time_entry(time_entry_id, user_id, project_id, options)
|
77
|
-
|
78
|
-
## To-Do
|
79
|
-
|
80
|
-
* Budget Items
|
81
|
-
* Budget Item Categories
|
82
|
-
* Tags Per Project
|
83
|
-
* Tags Per User
|
84
|
-
|
85
16
|
## Contributing
|
86
17
|
|
87
18
|
1. Fork it
|
@@ -2,20 +2,22 @@ module TenThousandFeet
|
|
2
2
|
module API
|
3
3
|
module Users
|
4
4
|
|
5
|
-
def get_users
|
6
|
-
get("/users",
|
5
|
+
def get_users
|
6
|
+
get("/users", { auth: self.auth })
|
7
7
|
end
|
8
8
|
|
9
|
-
def show_user(id
|
10
|
-
get("/users/#{id}",
|
9
|
+
def show_user(id)
|
10
|
+
get("/users/#{id}", { auth: self.auth })
|
11
11
|
end
|
12
12
|
|
13
13
|
def create_user(options={})
|
14
|
-
|
14
|
+
default_options = { auth: self.auth }
|
15
|
+
post("/users/", default_options.merge(options))
|
15
16
|
end
|
16
17
|
|
17
18
|
def update_user(id, options={})
|
18
|
-
|
19
|
+
default_options = { auth: self.auth }
|
20
|
+
put("/users/#{id}", default_options.merge(options))
|
19
21
|
end
|
20
22
|
|
21
23
|
end
|
@@ -1,12 +1,6 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'rest-client'
|
3
|
-
|
4
1
|
require 'ten_thousand_feet/api/users'
|
5
|
-
require '
|
6
|
-
require '
|
7
|
-
require 'ten_thousand_feet/api/user_status'
|
8
|
-
require 'ten_thousand_feet/api/assignments'
|
9
|
-
require 'ten_thousand_feet/api/time_entries'
|
2
|
+
require 'rest-client'
|
3
|
+
require 'json'
|
10
4
|
|
11
5
|
module TenThousandFeet
|
12
6
|
class Client
|
@@ -14,67 +8,29 @@ module TenThousandFeet
|
|
14
8
|
attr_reader :auth
|
15
9
|
|
16
10
|
include API::Users
|
17
|
-
include API::Phases
|
18
|
-
include API::Projects
|
19
|
-
include API::UserStatus
|
20
|
-
include API::Assignments
|
21
|
-
include API::TimeEntries
|
22
11
|
|
23
12
|
def initialize(options={})
|
24
13
|
@auth = options[:auth]
|
25
14
|
end
|
26
15
|
|
27
16
|
def api_url
|
28
|
-
"https://
|
29
|
-
end
|
30
|
-
|
31
|
-
def default_options
|
32
|
-
{ auth: @auth }
|
33
|
-
end
|
34
|
-
|
35
|
-
def query_string(options)
|
36
|
-
nodes = (options.count - 1)
|
37
|
-
params = "?"
|
38
|
-
|
39
|
-
options.each_with_index do |(key, value), index|
|
40
|
-
if index == nodes
|
41
|
-
params += key.to_s + "=" + value
|
42
|
-
else
|
43
|
-
params += key.to_s + "=" + value + "&"
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
params
|
48
|
-
end
|
49
|
-
|
50
|
-
def full_url(path, options)
|
51
|
-
if options.empty?
|
52
|
-
api_url + path
|
53
|
-
else
|
54
|
-
api_url + path + query_string(options)
|
55
|
-
end
|
17
|
+
"https://vnext-api.10000ft.com/api/v1"
|
56
18
|
end
|
57
19
|
|
58
20
|
def get(path, options = {})
|
59
|
-
|
60
|
-
|
61
|
-
JSON.parse(response)
|
21
|
+
JSON.parse( RestClient.get(api_url + path, options) )
|
62
22
|
end
|
63
23
|
|
64
24
|
def post(path, options = {})
|
65
|
-
|
66
|
-
|
67
|
-
JSON.parse(response)
|
25
|
+
JSON.parse( RestClient.post(api_url + path, options) )
|
68
26
|
end
|
69
27
|
|
70
28
|
def put(path, options = {})
|
71
|
-
|
72
|
-
|
73
|
-
JSON.parse(response)
|
29
|
+
JSON.parse( RestClient.put(api_url + path, options) )
|
74
30
|
end
|
75
31
|
|
76
32
|
def delete(path, options = {})
|
77
|
-
RestClient.delete(
|
33
|
+
JSON.parse( RestClient.delete(api_url + path, options) )
|
78
34
|
end
|
79
35
|
end
|
80
36
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,15 +1,4 @@
|
|
1
1
|
require 'pry'
|
2
2
|
require 'rest-client'
|
3
3
|
require 'ten_thousand_feet/client'
|
4
|
-
require 'ten_thousand_feet'
|
5
|
-
require 'yaml'
|
6
|
-
require 'vcr'
|
7
|
-
require 'webmock'
|
8
|
-
|
9
|
-
$AUTH = YAML.load_file('auth.yml')
|
10
|
-
|
11
|
-
VCR.configure do |c|
|
12
|
-
c.cassette_library_dir = 'fixtures/vcr_cassettes'
|
13
|
-
c.hook_into :webmock
|
14
|
-
c.allow_http_connections_when_no_cassette = true
|
15
|
-
end
|
4
|
+
require 'ten_thousand_feet'
|
@@ -4,31 +4,24 @@ module TenThousandFeet
|
|
4
4
|
module API
|
5
5
|
describe Users do
|
6
6
|
|
7
|
-
let!(:
|
8
|
-
let!(:
|
9
|
-
|
10
|
-
client.get_users
|
11
|
-
end
|
12
|
-
}
|
7
|
+
let!(:auth) { "Smg3M3czMiszU0djK0t3MytLV09OREFlWEdqa0JvRHFkRXdqcE9ueXFKRlVaK29heWpOYTY2RTM4eWJaCjdVc0pWbUhOUUc5ZEtMNkMyZURTMWJVeFNCdWpTMkhmUlpFTmtIMnBpd1Y0aSs5bk44RkZvMHZyMmg4MgpCaTdmdmhRcAo=" }
|
8
|
+
let!(:client) { TenThousandFeet.new({ auth: auth }) }
|
9
|
+
let!(:users) { client.get_users }
|
13
10
|
let!(:user) { users['data'][0] }
|
14
11
|
let!(:id) { user['id'] }
|
15
12
|
|
16
13
|
describe '#get_users' do
|
17
14
|
it 'retrieves a list of users' do
|
18
|
-
|
19
|
-
|
20
|
-
expect(name).to_not be_nil
|
21
|
-
end
|
15
|
+
name = users['data'][0]['first_name']
|
16
|
+
expect(name).to_not be_nil
|
22
17
|
end
|
23
18
|
end
|
24
19
|
|
25
20
|
describe '#show_users' do
|
26
21
|
it 'retrieves details of a specific user' do
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
expect(user['id']).to eq id
|
31
|
-
end
|
22
|
+
id = users['data'][0]['id']
|
23
|
+
user = client.show_user(id)
|
24
|
+
expect(user['id']).to eq id
|
32
25
|
end
|
33
26
|
end
|
34
27
|
|
@@ -42,25 +35,34 @@ module TenThousandFeet
|
|
42
35
|
end
|
43
36
|
|
44
37
|
it 'creates a new user' do
|
45
|
-
|
46
|
-
|
47
|
-
response = client.create_user(user_attributes)
|
38
|
+
user_count_before = users['data'].count
|
39
|
+
response = client.create_user(user_attributes)
|
48
40
|
|
49
|
-
|
50
|
-
|
41
|
+
new_users = client.get_users
|
42
|
+
user_count_after = new_users['data'].count
|
51
43
|
|
52
|
-
|
53
|
-
end
|
44
|
+
expect(user_count_after).to eq (user_count_before + 1)
|
54
45
|
end
|
55
46
|
end
|
56
47
|
|
57
48
|
describe '#update_user' do
|
58
49
|
context 'given a valid user' do
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
50
|
+
|
51
|
+
context 'given valid params' do
|
52
|
+
it 'updates an attribute for the user' do
|
53
|
+
name = "AustinPowers#{rand(0..100)}"
|
54
|
+
response = client.update_user(id, { first_name: name })
|
55
|
+
expect(response['first_name']).to eq name
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
context 'given no params' do
|
60
|
+
it 'returns the user unchanged' do
|
61
|
+
response = client.update_user(id, {})
|
62
|
+
expect(response['first_name']).to eq user['first_name']
|
63
|
+
end
|
63
64
|
end
|
65
|
+
|
64
66
|
end
|
65
67
|
end
|
66
68
|
end
|
@@ -2,9 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module TenThousandFeet
|
4
4
|
describe Client do
|
5
|
+
let!(:auth) {
|
6
|
+
"Smg3M3czMiszU0djK0t3MytLV09OREFlWEdqa0JvRHFkRXdqcE9ueXFKRlVaK29heWpOYTY2RTM4eWJaCjdVc0pWbUhOUUc5ZEtMNkMyZURTMWJVeFNCdWpTMkhmUlpFTmtIMnBpd1Y0aSs5bk44RkZvMHZyMmg4MgpCaTdmdmhRcAo="
|
7
|
+
}
|
8
|
+
|
5
9
|
it 'Sets the value of the auth token on the client' do
|
6
|
-
client = TenThousandFeet.new({ auth:
|
7
|
-
expect(client.auth).to eq
|
10
|
+
client = TenThousandFeet.new({ auth: auth })
|
11
|
+
expect(client.auth).to eq auth
|
8
12
|
end
|
9
13
|
end
|
10
14
|
end
|
data/ten_thousand_feet.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["susskyle@gmail.com"]
|
11
11
|
spec.description = %q{The 10,000ft Ruby API Client}
|
12
12
|
spec.summary = %q{Provides Ruby wrappers for the 10,000ft API.}
|
13
|
-
spec.homepage = "
|
13
|
+
spec.homepage = "http://tackmobile.com"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
@@ -19,11 +19,11 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_dependency "rest-client"
|
22
|
+
spec.add_dependency "hashie"
|
22
23
|
spec.add_development_dependency "bundler", "~> 1.3"
|
23
24
|
spec.add_development_dependency "rake"
|
24
25
|
spec.add_development_dependency "rspec"
|
25
26
|
spec.add_development_dependency "multi_json"
|
26
27
|
spec.add_development_dependency "vcr"
|
27
28
|
spec.add_development_dependency "pry"
|
28
|
-
spec.add_development_dependency "webmock", "1.8.0"
|
29
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ten_thousand_feet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.111
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Suss
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: hashie
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,20 +122,6 @@ dependencies:
|
|
108
122
|
- - '>='
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: webmock
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - '='
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: 1.8.0
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - '='
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: 1.8.0
|
125
125
|
description: The 10,000ft Ruby API Client
|
126
126
|
email:
|
127
127
|
- susskyle@gmail.com
|
@@ -136,24 +136,14 @@ files:
|
|
136
136
|
- README.md
|
137
137
|
- Rakefile
|
138
138
|
- lib/ten_thousand_feet.rb
|
139
|
-
- lib/ten_thousand_feet/api/assignments.rb
|
140
|
-
- lib/ten_thousand_feet/api/phases.rb
|
141
|
-
- lib/ten_thousand_feet/api/projects.rb
|
142
|
-
- lib/ten_thousand_feet/api/time_entries.rb
|
143
|
-
- lib/ten_thousand_feet/api/user_status.rb
|
144
139
|
- lib/ten_thousand_feet/api/users.rb
|
145
140
|
- lib/ten_thousand_feet/client.rb
|
146
141
|
- lib/ten_thousand_feet/version.rb
|
147
142
|
- spec/spec_helper.rb
|
148
|
-
- spec/ten_thousand_feet/api/assignment_spec.rb
|
149
|
-
- spec/ten_thousand_feet/api/phases_spec.rb
|
150
|
-
- spec/ten_thousand_feet/api/projects_spec.rb
|
151
|
-
- spec/ten_thousand_feet/api/time_entries_spec.rb
|
152
|
-
- spec/ten_thousand_feet/api/user_status_spec.rb
|
153
143
|
- spec/ten_thousand_feet/api/users_spec.rb
|
154
144
|
- spec/ten_thousand_feet/client_spec.rb
|
155
145
|
- ten_thousand_feet.gemspec
|
156
|
-
homepage:
|
146
|
+
homepage: http://tackmobile.com
|
157
147
|
licenses:
|
158
148
|
- MIT
|
159
149
|
metadata: {}
|
@@ -179,10 +169,5 @@ specification_version: 4
|
|
179
169
|
summary: Provides Ruby wrappers for the 10,000ft API.
|
180
170
|
test_files:
|
181
171
|
- spec/spec_helper.rb
|
182
|
-
- spec/ten_thousand_feet/api/assignment_spec.rb
|
183
|
-
- spec/ten_thousand_feet/api/phases_spec.rb
|
184
|
-
- spec/ten_thousand_feet/api/projects_spec.rb
|
185
|
-
- spec/ten_thousand_feet/api/time_entries_spec.rb
|
186
|
-
- spec/ten_thousand_feet/api/user_status_spec.rb
|
187
172
|
- spec/ten_thousand_feet/api/users_spec.rb
|
188
173
|
- spec/ten_thousand_feet/client_spec.rb
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module TenThousandFeet
|
2
|
-
module API
|
3
|
-
module Assignments
|
4
|
-
|
5
|
-
def get_assignments(user_id, options={})
|
6
|
-
get("/users/#{user_id}/assignments", options)
|
7
|
-
end
|
8
|
-
|
9
|
-
def show_assignment(id, user_id, options={})
|
10
|
-
get("/users/#{user_id}/assignments/#{id}", options)
|
11
|
-
end
|
12
|
-
|
13
|
-
def create_assignment(project_id, user_id, options={})
|
14
|
-
post("/users/#{user_id}/assignments", options)
|
15
|
-
end
|
16
|
-
|
17
|
-
def delete_assignment(id, user_id, options={})
|
18
|
-
delete("/users/#{user_id}/assignments/#{id}", options)
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module TenThousandFeet
|
2
|
-
module API
|
3
|
-
module Phases
|
4
|
-
|
5
|
-
def get_phases(project_id, options={})
|
6
|
-
get("/projects/#{project_id}/phases", options)
|
7
|
-
end
|
8
|
-
|
9
|
-
def create_phase(project_id, options={})
|
10
|
-
post("/projects/#{project_id}/phases", options)
|
11
|
-
end
|
12
|
-
|
13
|
-
def update_phase(project_id, phase_id, options={})
|
14
|
-
put("/projects/#{project_id}/phases/#{phase_id}", options)
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
module TenThousandFeet
|
2
|
-
module API
|
3
|
-
module Projects
|
4
|
-
|
5
|
-
def get_projects(options={})
|
6
|
-
get("/projects", options)
|
7
|
-
end
|
8
|
-
|
9
|
-
def show_project(id, options={})
|
10
|
-
get("/projects/#{id}", options)
|
11
|
-
end
|
12
|
-
|
13
|
-
def create_project(options={})
|
14
|
-
post("/projects", options)
|
15
|
-
end
|
16
|
-
|
17
|
-
def update_project(id, options={})
|
18
|
-
put("/projects/#{id}", options)
|
19
|
-
end
|
20
|
-
|
21
|
-
def delete_project(id, options={})
|
22
|
-
delete("/projects/#{id}", options)
|
23
|
-
end
|
24
|
-
|
25
|
-
def get_project_time_entries(id, options={})
|
26
|
-
get("/projects/#{id}/time_entries", options)
|
27
|
-
end
|
28
|
-
|
29
|
-
def get_project_users(id, options={})
|
30
|
-
get("/projects/#{id}/users", options)
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
module TenThousandFeet
|
2
|
-
module API
|
3
|
-
module TimeEntries
|
4
|
-
|
5
|
-
def get_time_entries(user_id, options={})
|
6
|
-
get("/users/#{user_id}/time_entries", options)
|
7
|
-
end
|
8
|
-
|
9
|
-
def show_time_entry(id, user_id, options={})
|
10
|
-
get("/users/#{user_id}/time_entries/#{id}", options)
|
11
|
-
end
|
12
|
-
|
13
|
-
def create_time_entry(user_id, options={})
|
14
|
-
post("/users/#{user_id}/time_entries", options)
|
15
|
-
end
|
16
|
-
|
17
|
-
def update_time_entry(id, user_id, options={})
|
18
|
-
put("/users/#{user_id}/time_entries/#{id}", options)
|
19
|
-
end
|
20
|
-
|
21
|
-
def delete_time_entry(id, user_id, project_id, options={})
|
22
|
-
delete("projects/#{project_id}/users/#{user_id}/time_entries/#{id}", options)
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module TenThousandFeet
|
2
|
-
module API
|
3
|
-
module UserStatus
|
4
|
-
|
5
|
-
def get_user_statuses(user_id, options={})
|
6
|
-
get("/users/#{user_id}/statuses", options)
|
7
|
-
end
|
8
|
-
|
9
|
-
def create_user_status(user_id, options={})
|
10
|
-
post("/users/#{user_id}/statuses", options)
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module TenThousandFeet
|
4
|
-
module API
|
5
|
-
describe Assignments do
|
6
|
-
|
7
|
-
let!(:client) { TenThousandFeet.new({ auth: $AUTH }) }
|
8
|
-
let!(:user) { client.get_users['data'][0] }
|
9
|
-
let!(:projects) {
|
10
|
-
VCR.use_cassette('projects') do
|
11
|
-
client.get_projects
|
12
|
-
end
|
13
|
-
}
|
14
|
-
let!(:project) { projects['data'][0] }
|
15
|
-
let!(:assignments) {
|
16
|
-
VCR.use_cassette('assignments') do
|
17
|
-
client.get_assignments(user['id'])
|
18
|
-
end
|
19
|
-
}
|
20
|
-
let!(:assignment) { assignments['data'][0] }
|
21
|
-
let!(:id) { assignment['id'] }
|
22
|
-
|
23
|
-
describe '#get_assignments' do
|
24
|
-
it 'retrieves a list of assignments for a user' do
|
25
|
-
VCR.use_cassette('get_assignments') do
|
26
|
-
expect(assignments['data']).to_not be_nil
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe '#show_assignments' do
|
32
|
-
it 'retrieves details of a assignment' do
|
33
|
-
VCR.use_cassette('show_assignments') do
|
34
|
-
id = assignments['data'][0]['id']
|
35
|
-
assignment = client.show_assignment(id, user['id'])
|
36
|
-
expect(assignment['id']).to eq id
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe '#create_assignment' do
|
42
|
-
def assignment_attributes
|
43
|
-
{
|
44
|
-
project_id: project['id'],
|
45
|
-
starts_at: '2013-10-10',
|
46
|
-
ends_at: '2013-10-10'
|
47
|
-
}
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'creates a new assignment' do
|
51
|
-
VCR.use_cassette('create_assignment') do
|
52
|
-
assignment_count_before = assignments['data'].count
|
53
|
-
response = client.create_assignment(project['id'], user['id'], assignment_attributes)
|
54
|
-
|
55
|
-
new_assignments = client.get_assignments(user['id'])
|
56
|
-
assignment_count_after = new_assignments['data'].count
|
57
|
-
|
58
|
-
expect(assignment_count_after).to eq (assignment_count_before + 1)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
describe '#delete_assignment' do
|
64
|
-
context 'given a valid time entry' do
|
65
|
-
it 'deletes the assignment' do
|
66
|
-
VCR.use_cassette('delete_assignment') do
|
67
|
-
response = client.delete_assignment(id, user['id'])
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module TenThousandFeet
|
4
|
-
module API
|
5
|
-
describe Phases do
|
6
|
-
|
7
|
-
let!(:client) { TenThousandFeet.new({ auth: $AUTH }) }
|
8
|
-
let!(:projects) {
|
9
|
-
VCR.use_cassette('projects') do
|
10
|
-
client.get_projects
|
11
|
-
end
|
12
|
-
}
|
13
|
-
let!(:project) { projects['data'][0] }
|
14
|
-
let!(:id) { project['id'] }
|
15
|
-
|
16
|
-
describe '#get_phases' do
|
17
|
-
it 'retrieves a list of phases for a given project' do
|
18
|
-
VCR.use_cassette('get_phases') do
|
19
|
-
phases = client.get_phases(id)
|
20
|
-
expect(phases['data']).to_not be_nil
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe '#create_phase' do
|
26
|
-
def phase_attributes
|
27
|
-
{
|
28
|
-
phase_name: 'Groovy baby',
|
29
|
-
starts_at: '2014-09-15',
|
30
|
-
ends_at: '2014-10-15'
|
31
|
-
}
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'creates a new phase for a given project' do
|
35
|
-
VCR.use_cassette('create_phase') do
|
36
|
-
response = client.create_phase(id, phase_attributes)
|
37
|
-
phase = client.get_phases(id)
|
38
|
-
expect(phase['data'][0]['phase_name']).to eq phase_attributes[:phase_name]
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
describe '#update_phase' do
|
44
|
-
def phase_attributes
|
45
|
-
{
|
46
|
-
phase_name: 'Groovy baby',
|
47
|
-
starts_at: '2014-09-15',
|
48
|
-
ends_at: '2014-10-15'
|
49
|
-
}
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'updates a given phases attributes' do
|
53
|
-
phase = client.create_phase(id, phase_attributes)
|
54
|
-
phase_name = "#{rand(0..100)} So Groovy"
|
55
|
-
response = client.update_phase(id, phase['id'], { phase_name: phase_name })
|
56
|
-
expect(response['phase_name']).to eq phase_name
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
@@ -1,103 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module TenThousandFeet
|
4
|
-
module API
|
5
|
-
describe Projects do
|
6
|
-
|
7
|
-
let!(:client) { TenThousandFeet.new({ auth: $AUTH }) }
|
8
|
-
let!(:projects) {
|
9
|
-
VCR.use_cassette('projects') do
|
10
|
-
client.get_projects
|
11
|
-
end
|
12
|
-
}
|
13
|
-
let!(:project) { projects['data'][0] }
|
14
|
-
let!(:id) { project['id'] }
|
15
|
-
|
16
|
-
describe '#get_projects' do
|
17
|
-
it 'retrieves a list of projects' do
|
18
|
-
VCR.use_cassette('get_projects') do
|
19
|
-
name = projects['data'][0]['name']
|
20
|
-
expect(name).to_not be_nil
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe '#show_projects' do
|
26
|
-
it 'retrieves details of a specific project' do
|
27
|
-
VCR.use_cassette('show_projects') do
|
28
|
-
id = projects['data'][0]['id']
|
29
|
-
project = client.show_project(id)
|
30
|
-
expect(project['id']).to eq id
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe '#create_projects' do
|
36
|
-
def project_attributes
|
37
|
-
{
|
38
|
-
name: '1 Billion Dollars',
|
39
|
-
client: 'Dr. Evil'
|
40
|
-
}
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'creates a new project' do
|
44
|
-
VCR.use_cassette('create_project') do
|
45
|
-
project_count_before = projects['data'].count
|
46
|
-
response = client.create_project(project_attributes)
|
47
|
-
|
48
|
-
new_projects = client.get_projects
|
49
|
-
project_count_after = new_projects['data'].count
|
50
|
-
|
51
|
-
expect(project_count_after).to eq (project_count_before + 1)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
describe '#update_project' do
|
57
|
-
context 'given a valid project' do
|
58
|
-
it 'updates an attribute for the project' do
|
59
|
-
name = "#{rand(0..100)} Billion Dollars"
|
60
|
-
response = client.update_project(id, { name: name })
|
61
|
-
expect(response['name']).to eq name
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe '#delete_project' do
|
67
|
-
context 'given a valid project' do
|
68
|
-
def project_attributes
|
69
|
-
{
|
70
|
-
name: '1 Billion Dollars',
|
71
|
-
client: 'Dr. Evil'
|
72
|
-
}
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'deletes a project' do
|
76
|
-
VCR.use_cassette('delete_project') do
|
77
|
-
new_project = client.create_project(project_attributes)
|
78
|
-
response = client.delete_project(new_project['id'])
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
describe '#get_project_time_entries' do
|
85
|
-
it 'retrieves a list of time entries for a given project' do
|
86
|
-
VCR.use_cassette('get_project_time_entries') do
|
87
|
-
response = client.get_project_time_entries(id)
|
88
|
-
expect(response['data']).to_not be_nil
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
describe '#get_project_time_users' do
|
94
|
-
it 'retrieves a list of users for a given project' do
|
95
|
-
VCR.use_cassette('get_project_time_users') do
|
96
|
-
response = client.get_project_users(id)
|
97
|
-
expect(response['data']).to_not be_nil
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
@@ -1,76 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module TenThousandFeet
|
4
|
-
module API
|
5
|
-
describe TimeEntries do
|
6
|
-
|
7
|
-
let!(:client) { TenThousandFeet.new({ auth: $AUTH }) }
|
8
|
-
let!(:user) { client.get_users['data'][0] }
|
9
|
-
let!(:projects) {
|
10
|
-
VCR.use_cassette('projects') do
|
11
|
-
client.get_projects
|
12
|
-
end
|
13
|
-
}
|
14
|
-
let!(:project) { projects['data'][0] }
|
15
|
-
let!(:time_entries) {
|
16
|
-
VCR.use_cassette('time_entries') do
|
17
|
-
client.get_time_entries(user['id'])
|
18
|
-
end
|
19
|
-
}
|
20
|
-
let!(:time_entry) { time_entries['data'][0] }
|
21
|
-
let!(:id) { time_entry['id'] }
|
22
|
-
|
23
|
-
describe '#get_time_entries' do
|
24
|
-
it 'retrieves a list of time entries for a user' do
|
25
|
-
VCR.use_cassette('get_time_entries') do
|
26
|
-
hours = time_entries['data'][0]['hours']
|
27
|
-
expect(hours).to_not be_nil
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe '#show_time_entries' do
|
33
|
-
it 'retrieves details of a specific time entry' do
|
34
|
-
VCR.use_cassette('show_time_entries') do
|
35
|
-
id = time_entries['data'][0]['id']
|
36
|
-
time_entry = client.show_time_entry(id, user['id'])
|
37
|
-
expect(time_entry['id']).to eq id
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe '#create_time_entry' do
|
43
|
-
#Required parameters: :date, :hours, :leave_type_id/:project_id/:assignable_id
|
44
|
-
def time_entry_attributes
|
45
|
-
{
|
46
|
-
hours: 10,
|
47
|
-
date: '2013-10-10',
|
48
|
-
project_id: project['id']
|
49
|
-
}
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'creates a new project' do
|
53
|
-
VCR.use_cassette('create_time_entry') do
|
54
|
-
time_entry_count_before = time_entries['data'].count
|
55
|
-
response = client.create_time_entry(user['id'], time_entry_attributes)
|
56
|
-
|
57
|
-
new_time_entries = client.get_time_entries(user['id'])
|
58
|
-
time_entry_count_after = new_time_entries['data'].count
|
59
|
-
|
60
|
-
expect(time_entry_count_after).to eq (time_entry_count_before + 1)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe '#update_time_entry' do
|
66
|
-
context 'given a valid time entry' do
|
67
|
-
it 'updates an attribute for the entry' do
|
68
|
-
hours = rand(0..100)
|
69
|
-
response = client.update_time_entry(id, user['id'], { hours: hours })
|
70
|
-
expect(response['hours']).to eq hours
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module TenThousandFeet
|
4
|
-
module API
|
5
|
-
describe UserStatus do
|
6
|
-
|
7
|
-
let!(:client) { TenThousandFeet.new({ auth: $AUTH }) }
|
8
|
-
let!(:users) {
|
9
|
-
VCR.use_cassette('users') do
|
10
|
-
client.get_users
|
11
|
-
end
|
12
|
-
}
|
13
|
-
let!(:user) { users['data'][0] }
|
14
|
-
let!(:id) { user['id'] }
|
15
|
-
|
16
|
-
describe '#get_user_statuses' do
|
17
|
-
it 'retrieves a list of statuses for a given user' do
|
18
|
-
VCR.use_cassette('get_user_statuses') do
|
19
|
-
status = client.get_user_statuses(id)
|
20
|
-
expect(status['data']).to_not be_nil
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe '#create_user_status' do
|
26
|
-
def user_status_attributes
|
27
|
-
{
|
28
|
-
status: 'ITO'
|
29
|
-
}
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'creates a new status for a given user' do
|
33
|
-
VCR.use_cassette('create_user_status') do
|
34
|
-
response = client.create_user_status(id, user_status_attributes)
|
35
|
-
status = client.get_user_statuses(id)
|
36
|
-
expect(status['data'][0]['status']).to eq 'ITO'
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|