tenk 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/users.rb ADDED
@@ -0,0 +1,100 @@
1
+ require 'hashie'
2
+
3
+ module Tenk
4
+ # API methods for User resource which represents a single person (even if they
5
+ # are not actually able to log in to 10k)
6
+ class Users < ::Tenk::Resource
7
+ # Valid parameters for a User list request
8
+ class ListRequest < ::Hashie::Trash
9
+ property :fields, default: ''
10
+ property :per_page, default: 20
11
+ property :page, default: 1
12
+ property :with_archived, default: false
13
+ end
14
+
15
+ # Valid parameters for a User get request
16
+ class GetRequest < ::Hashie::Trash
17
+ property :fields, default: ''
18
+ end
19
+
20
+ # Valid parameters for a User create request
21
+ class CreateRequest < ::Hashie::Trash
22
+ property :email
23
+ property :first_name
24
+ property :last_name
25
+ property :account_owner
26
+ property :billable
27
+ property :billability_target
28
+ property :billrate
29
+ property :discipline
30
+ property :employee_number
31
+ property :hire_date
32
+ property :location
33
+ property :mobile_phone
34
+ property :office_phone
35
+ property :role
36
+ property :termination_date
37
+ end
38
+
39
+ # Valid parameters for a User update request
40
+ class UpdateRequest < CreateRequest
41
+ property :archived, default: false
42
+ end
43
+
44
+ require_relative './users/time_entries'
45
+ require_relative './users/assignments'
46
+ require_relative './users/tags'
47
+
48
+ # A TimeEntry subresource of Users
49
+ # @return [Users::TimeEntries]
50
+ def time_entries
51
+ @_time_entries ||= Users::TimeEntries.new(@_client)
52
+ end
53
+
54
+ # An Assignment subresource of Users
55
+ # @return [Users::Assignments]
56
+ def assignments
57
+ @_assignments ||= Users::Assignments.new(@_client)
58
+ end
59
+
60
+ # A TimeEntry subresource of Users
61
+ # @return [Tenk::Tags]
62
+ def tags
63
+ @_tags ||= Tenk::Tags.new(@_client)
64
+ end
65
+
66
+ # List Users
67
+ # @param opts [Hash] the filter options for the list of Users
68
+ # @return [Hashie::Mash] the API response as a Hashie::Mash
69
+ # @see ListRequest
70
+ def list(opts = {})
71
+ super(ListRequest.new(opts))
72
+ end
73
+
74
+ # Get a User
75
+ # @param id [Integer] the id of the User to retrieve
76
+ # @param opts [Hash] the params for the get request
77
+ # @return [Hashie::Mash] the API response as a Hashie::Mash
78
+ # @see GetRequest
79
+ def get(id, opts = {})
80
+ super(id, GetRequest.new(opts))
81
+ end
82
+
83
+ # Create a User
84
+ # @param opts [Hash] the attributes of the User to ceeate
85
+ # @return [Hashie::Mash] the API response as a Hashie::Mash
86
+ # @see CreateRequest
87
+ def create(opts = {})
88
+ super(CreateRequest.new(opts))
89
+ end
90
+
91
+ # Update a User
92
+ # @param id [Integer] the id of the User to update
93
+ # @param opts [Hash] the attributes of the User to update
94
+ # @return [Hashie::Mash] the API response as a Hashie::Mash
95
+ # @see UpdateRequest
96
+ def update(id, opts = {})
97
+ super(id, UpdateRequest.new(opts))
98
+ end
99
+ end
100
+ end
data/lib/version.rb ADDED
@@ -0,0 +1,4 @@
1
+ module Tenk
2
+ # The version of the gem
3
+ VERSION = '0.0.2'.freeze
4
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tenk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Prehn
@@ -88,11 +88,34 @@ dependencies:
88
88
  version: '11.0'
89
89
  description: This gem provides an API wrapper for working with the 10k plans API.
90
90
  email: prehnra@gmail.com
91
- executables: []
91
+ executables:
92
+ - tenk
92
93
  extensions: []
93
94
  extra_rdoc_files: []
94
95
  files:
96
+ - bin/tenk
97
+ - lib/approvals.rb
98
+ - lib/bill_rates.rb
99
+ - lib/client.rb
100
+ - lib/configuration.rb
101
+ - lib/placeholder_resources.rb
102
+ - lib/projects.rb
103
+ - lib/projects/assignments.rb
104
+ - lib/projects/bill_rates.rb
105
+ - lib/projects/phases.rb
106
+ - lib/projects/project_resource.rb
107
+ - lib/projects/tags.rb
108
+ - lib/projects/time_entries.rb
109
+ - lib/projects/users.rb
110
+ - lib/resource.rb
95
111
  - lib/tenk.rb
112
+ - lib/time_entries.rb
113
+ - lib/users.rb
114
+ - lib/users/assignments.rb
115
+ - lib/users/tags.rb
116
+ - lib/users/time_entries.rb
117
+ - lib/users/user_resource.rb
118
+ - lib/version.rb
96
119
  homepage: http://rubygems.org/gems/tenk
97
120
  licenses:
98
121
  - MIT