checkdin 0.2.0 → 0.2.1
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.
- data/lib/checkdin/users.rb +13 -0
- data/lib/checkdin/version.rb +1 -1
- data/spec/checkdin/users_spec.rb +22 -0
- metadata +2 -2
data/lib/checkdin/users.rb
CHANGED
@@ -31,5 +31,18 @@ module Checkdin
|
|
31
31
|
return_error_or_body(response)
|
32
32
|
end
|
33
33
|
|
34
|
+
# Create a user in the checkd.in system tied to the authenticating client.
|
35
|
+
#
|
36
|
+
# @param [Hash] options
|
37
|
+
# @option options String :identifier - The authenticating client's internal identifier for this user.
|
38
|
+
# @option options String :email - A valid email for the user
|
39
|
+
|
40
|
+
def create_user(options={})
|
41
|
+
response = connection.post do |req|
|
42
|
+
req.url "users", options
|
43
|
+
end
|
44
|
+
return_error_or_body(response)
|
45
|
+
end
|
46
|
+
|
34
47
|
end
|
35
48
|
end
|
data/lib/checkdin/version.rb
CHANGED
data/spec/checkdin/users_spec.rb
CHANGED
@@ -33,4 +33,26 @@ describe Checkdin::Users do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
end
|
36
|
+
|
37
|
+
context "creating a user" do
|
38
|
+
|
39
|
+
context "with valid parameters" do
|
40
|
+
use_vcr_cassette
|
41
|
+
let(:result) { @client.create_user(:email => 'atest@checkd.in', :identifier => 'clientuid123')}
|
42
|
+
|
43
|
+
it "should return the new user's basic information" do
|
44
|
+
result.user.should_not be_nil
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context "with an invalid email" do
|
49
|
+
use_vcr_cassette
|
50
|
+
|
51
|
+
it "should return error 400" do
|
52
|
+
expect do
|
53
|
+
@client.create_user(:email => 'notanemail', :identifier => 'client123')
|
54
|
+
end.to raise_error(Checkdin::APIError, /400/)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
36
58
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: checkdin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Matt Mueller
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-03-11 00:00:00 -06:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|