Class: MediumApi::User

Inherits:
Struct
  • Object
show all
Includes:
ResourceApi
Defined in:
lib/medium_api/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#id ⇒ Object

Returns the value of attribute id

Returns:

  • (Object) —

    the current value of id



2
3
4
# File 'lib/medium_api/user.rb', line 2

def id
  @id
end

#image_url ⇒ Object

Returns the value of attribute image_url

Returns:

  • (Object) —

    the current value of image_url



2
3
4
# File 'lib/medium_api/user.rb', line 2

def image_url
  @image_url
end

#name ⇒ Object

Returns the value of attribute name

Returns:

  • (Object) —

    the current value of name



2
3
4
# File 'lib/medium_api/user.rb', line 2

def name
  @name
end

#url ⇒ Object

Returns the value of attribute url

Returns:

  • (Object) —

    the current value of url



2
3
4
# File 'lib/medium_api/user.rb', line 2

def url
  @url
end

#username ⇒ Object

Returns the value of attribute username

Returns:

  • (Object) —

    the current value of username



2
3
4
# File 'lib/medium_api/user.rb', line 2

def username
  @username
end

Instance Method Details

#create_post(post_attributes) ⇒ MediumApi::Post

Parameters:

  • post_attributes

Returns:



6
7
8
9
10
# File 'lib/medium_api/user.rb', line 6

def create_post(post_attributes)
  data = client.create_user_post(id, post_attributes)

  Post.new(Utils.underscore_keys(data))
end

#publications ⇒ MediumApi::Publication



13
14
15
16
17
18
19
# File 'lib/medium_api/user.rb', line 13

def publications
  data = client.user_publications(id)

  data.map do |publication_attributes|
    Publication.new(Utils.underscore_keys(publication_attributes))
  end
end