Class: Vidsy::Data::API::User
- Inherits:
-
Object
- Object
- Vidsy::Data::API::User
- Defined in:
- lib/vidsy/data/api/user.rb
Class Method Summary collapse
Instance Method Summary collapse
- #closed_submissions ⇒ Object
- #create(options) ⇒ Object
- #find(id) ⇒ Object
- #find_by_email(email) ⇒ Object
-
#initialize(id = nil) ⇒ User
constructor
A new instance of User.
- #open_submissions ⇒ Object
- #submissions ⇒ Object
- #videos ⇒ Object
Constructor Details
#initialize(id = nil) ⇒ User
Returns a new instance of User.
8 9 10 |
# File 'lib/vidsy/data/api/user.rb', line 8 def initialize(id = nil) @id = id end |
Class Method Details
.create(options) ⇒ Object
12 13 14 |
# File 'lib/vidsy/data/api/user.rb', line 12 def self.create() new.create end |
.find(id) ⇒ Object
16 17 18 |
# File 'lib/vidsy/data/api/user.rb', line 16 def self.find(id) new.find id end |
.find_by_email(email) ⇒ Object
20 21 22 |
# File 'lib/vidsy/data/api/user.rb', line 20 def self.find_by_email(email) new.find_by_email email end |
Instance Method Details
#closed_submissions ⇒ Object
24 25 26 27 |
# File 'lib/vidsy/data/api/user.rb', line 24 def closed_submissions raise(ArgumentError, "ID not set for User") if id.nil? client.get "#{routes.user}/#{id}#{routes.submissions}/closed" end |
#create(options) ⇒ Object
29 30 31 |
# File 'lib/vidsy/data/api/user.rb', line 29 def create() client.post(routes.user, ).first end |
#find(id) ⇒ Object
33 34 35 |
# File 'lib/vidsy/data/api/user.rb', line 33 def find(id) client.get("#{routes.user}/#{id}").first end |
#find_by_email(email) ⇒ Object
37 38 39 |
# File 'lib/vidsy/data/api/user.rb', line 37 def find_by_email(email) client.get("#{routes.user}?email=#{email}").first end |
#open_submissions ⇒ Object
41 42 43 44 |
# File 'lib/vidsy/data/api/user.rb', line 41 def open_submissions raise(ArgumentError, "ID not set for User") if id.nil? client.get "#{routes.user}/#{id}#{routes.submissions}/open" end |
#submissions ⇒ Object
46 47 48 49 |
# File 'lib/vidsy/data/api/user.rb', line 46 def submissions raise(ArgumentError, "ID not set for User") if id.nil? client.get "#{routes.user}/#{id}#{routes.submissions}" end |
#videos ⇒ Object
51 52 53 54 |
# File 'lib/vidsy/data/api/user.rb', line 51 def videos raise(ArgumentError, "ID not set for User") if id.nil? client.get "#{routes.user}/#{id}#{routes.videos}" end |