chiketto 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chiketto.rb +2 -0
- data/lib/chiketto/email.rb +7 -0
- data/lib/chiketto/user.rb +20 -0
- data/lib/chiketto/version.rb +1 -1
- data/test/email_test.rb +10 -0
- data/test/user_test.rb +43 -0
- metadata +7 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d87b05ced85aee01cda02592cb2778870ccb795e
|
4
|
+
data.tar.gz: ae8687909ea959adf2eaf1cd01e139aae7087532
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1f43ef7603e230db93f3b246be60224515080ed3cd94fe46f02ad2111f6e8e60dacaf9023dd578b41bb9ded7f52c5686854c655dfe0c62ad0e3f10c3f7e59da
|
7
|
+
data.tar.gz: 151633ebb266a0280d989c8b086d63a54e19aa6c660cbb067747f03fc6914e8a9b98dcae2f698dc2a4e37bef3cacaca32b0ec0a65f6df3cd4b96e80110624598
|
data/lib/chiketto.rb
CHANGED
@@ -10,9 +10,11 @@ module Chiketto
|
|
10
10
|
require 'chiketto/address'
|
11
11
|
require 'chiketto/attendee'
|
12
12
|
require 'chiketto/category'
|
13
|
+
require 'chiketto/email'
|
13
14
|
require 'chiketto/event'
|
14
15
|
require 'chiketto/organizer'
|
15
16
|
require 'chiketto/ticket_class'
|
17
|
+
require 'chiketto/user'
|
16
18
|
require 'chiketto/venue'
|
17
19
|
|
18
20
|
class << self
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Chiketto
|
2
|
+
class User < Resource
|
3
|
+
attr_accessor :name,
|
4
|
+
:first_name,
|
5
|
+
:last_name
|
6
|
+
|
7
|
+
def self.find(id = 'me')
|
8
|
+
user = get "users/#{id}"
|
9
|
+
User.new user
|
10
|
+
end
|
11
|
+
|
12
|
+
def email
|
13
|
+
emails.reject { |email| email.primary }.first
|
14
|
+
end
|
15
|
+
|
16
|
+
def emails
|
17
|
+
@emails.map { |email| Chiketto::Email.new Hash.new(email) }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/chiketto/version.rb
CHANGED
data/test/email_test.rb
ADDED
data/test/user_test.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class UserTest < MiniTest::Test
|
4
|
+
USER_ID = 72013652427
|
5
|
+
|
6
|
+
def find_me
|
7
|
+
VCR.use_cassette 'user-me' do
|
8
|
+
@user = Chiketto::User.find
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_exposes_data
|
13
|
+
@user = Chiketto::User.new
|
14
|
+
assert_respond_to @user, :id
|
15
|
+
assert_respond_to @user, :name
|
16
|
+
assert_respond_to @user, :email
|
17
|
+
assert_respond_to @user, :first_name
|
18
|
+
assert_respond_to @user, :last_name
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_find_without_id
|
22
|
+
find_me
|
23
|
+
assert_kind_of Chiketto::User, @user
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_find_with_id
|
27
|
+
VCR.use_cassette 'user-id' do
|
28
|
+
@user = Chiketto::User.find USER_ID
|
29
|
+
end
|
30
|
+
assert_kind_of Chiketto::User, @user
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_user_has_emails
|
34
|
+
find_me
|
35
|
+
assert_kind_of Array, @user.emails
|
36
|
+
assert_kind_of Chiketto::Email, @user.emails.first
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_user_has_email_for_primary_only
|
40
|
+
find_me
|
41
|
+
assert_kind_of Chiketto::Email, @user.email
|
42
|
+
end
|
43
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chiketto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Radford
|
@@ -142,10 +142,12 @@ files:
|
|
142
142
|
- lib/chiketto/attr_attribute.rb
|
143
143
|
- lib/chiketto/attribute.rb
|
144
144
|
- lib/chiketto/category.rb
|
145
|
+
- lib/chiketto/email.rb
|
145
146
|
- lib/chiketto/event.rb
|
146
147
|
- lib/chiketto/organizer.rb
|
147
148
|
- lib/chiketto/resource.rb
|
148
149
|
- lib/chiketto/ticket_class.rb
|
150
|
+
- lib/chiketto/user.rb
|
149
151
|
- lib/chiketto/venue.rb
|
150
152
|
- lib/chiketto/version.rb
|
151
153
|
- lib/hash_ext.rb
|
@@ -154,10 +156,12 @@ files:
|
|
154
156
|
- test/attribute_test.rb
|
155
157
|
- test/category_test.rb
|
156
158
|
- test/chiketto_test.rb
|
159
|
+
- test/email_test.rb
|
157
160
|
- test/event_test.rb
|
158
161
|
- test/organizer_test.rb
|
159
162
|
- test/test_helper.rb
|
160
163
|
- test/ticket_class_test.rb
|
164
|
+
- test/user_test.rb
|
161
165
|
- test/venue_test.rb
|
162
166
|
homepage: https://github.com/chrisradford/chiketto
|
163
167
|
licenses:
|
@@ -189,8 +193,10 @@ test_files:
|
|
189
193
|
- test/attribute_test.rb
|
190
194
|
- test/category_test.rb
|
191
195
|
- test/chiketto_test.rb
|
196
|
+
- test/email_test.rb
|
192
197
|
- test/event_test.rb
|
193
198
|
- test/organizer_test.rb
|
194
199
|
- test/test_helper.rb
|
195
200
|
- test/ticket_class_test.rb
|
201
|
+
- test/user_test.rb
|
196
202
|
- test/venue_test.rb
|