Class: MediumApi::User

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idObject

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_urlObject

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

#nameObject

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

#urlObject

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

#usernameObject

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) ⇒ Object

include ResourceApi



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

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

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

#publicationsObject



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

def publications
    data = MediumApi.client.user_publications(id)

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