Class: VimeoRuby::User

Inherits:
Base
  • Object
show all
Defined in:
lib/vimeo_ruby/user.rb,
lib/vimeo_ruby/user/uploaded_video_collection.rb

Defined Under Namespace

Classes: UploadedVideoCollection

Instance Attribute Summary collapse

Attributes inherited from Base

#access_token, #additional_info, #vimeo_id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

base_uri, client_identifier, client_secret, get

Constructor Details

#initialize(access_token: nil, attrs: {}) ⇒ User

Returns a new instance of User.



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/vimeo_ruby/user.rb', line 5

def initialize(access_token: nil, attrs: {})
  @available_for_hire = attrs.delete("available_for_hire")
  @bio = attrs.delete("bio")
  @can_work_remotely = attrs.delete("can_work_remotely")
  @location = attrs.delete("location")
  @name = attrs.delete("name")
  @profile_link = attrs.delete("link")
  @video_collection = nil
  vimeo_uri_with_id = attrs.delete("uri")
  super(access_token: access_token, vimeo_id: vimeo_uri_with_id, remaining_attrs: attrs)
end

Instance Attribute Details

#available_for_hireObject (readonly)

Returns the value of attribute available_for_hire.



3
4
5
# File 'lib/vimeo_ruby/user.rb', line 3

def available_for_hire
  @available_for_hire
end

#bioObject (readonly)

Returns the value of attribute bio.



3
4
5
# File 'lib/vimeo_ruby/user.rb', line 3

def bio
  @bio
end

#can_work_remotelyObject (readonly)

Returns the value of attribute can_work_remotely.



3
4
5
# File 'lib/vimeo_ruby/user.rb', line 3

def can_work_remotely
  @can_work_remotely
end

#locationObject (readonly)

Returns the value of attribute location.



3
4
5
# File 'lib/vimeo_ruby/user.rb', line 3

def location
  @location
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/vimeo_ruby/user.rb', line 3

def name
  @name
end

Returns the value of attribute profile_link.



3
4
5
# File 'lib/vimeo_ruby/user.rb', line 3

def profile_link
  @profile_link
end

#video_collectionObject (readonly)

Returns the value of attribute video_collection.



3
4
5
# File 'lib/vimeo_ruby/user.rb', line 3

def video_collection
  @video_collection
end

Class Method Details

.get_user(access_token: nil) ⇒ Object



18
19
20
21
# File 'lib/vimeo_ruby/user.rb', line 18

def get_user(access_token: nil)
   = get("#{base_uri}/me", access_token: access_token)
  new(access_token: access_token, attrs: )
end

Instance Method Details

#available_for_hire?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/vimeo_ruby/user.rb', line 36

def available_for_hire?
  @available_for_hire
end

#base_uriObject



24
25
26
# File 'lib/vimeo_ruby/user.rb', line 24

def base_uri
  self.class.base_uri
end

#can_work_remotely?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/vimeo_ruby/user.rb', line 40

def can_work_remotely?
  @can_work_remotely
end

#uploaded_videos(query_params: {}) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/vimeo_ruby/user.rb', line 28

def uploaded_videos(query_params: {})
  if @video_collection.nil? || !query_params.empty?
    @video_collection = retrieve_video_collection(query_params)
  else
    @video_collection
  end
end