-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from DeployGate/feature/v0.0.4
v0.0.4
- Loading branch information
Showing
19 changed files
with
378 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
module DeployGate | ||
module API | ||
module V1 | ||
class User | ||
|
||
ENDPOINT = '/users' | ||
|
||
class << self | ||
# @param [String] name | ||
# @param [String] email | ||
# @param [String] password | ||
# @return [Hash] | ||
def create(name, email, password) | ||
res = Base.new().post(ENDPOINT, {:name => name, :email => email, :password => password}) | ||
|
||
user_create_results = { | ||
:error => res['error'], | ||
:message => res['because'] | ||
} | ||
|
||
results = res['results'] | ||
unless results.nil? | ||
user_create_results.merge!({ | ||
:name => results['user']['name'], | ||
:token => results['api_token'] | ||
}) | ||
end | ||
|
||
user_create_results | ||
end | ||
|
||
# @param [String] name | ||
# @param [String] email | ||
# @return [Boolean] | ||
def registered?(name, email) | ||
res = Base.new().get("#{ENDPOINT}/registered", {:name => name, :email => email}) | ||
res['results']['registered'] | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.