Class: MediumApi::User
- Inherits:
-
Struct
- Object
- Struct
- MediumApi::User
- Defined in:
- lib/medium_api/user.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#image_url ⇒ Object
Returns the value of attribute image_url.
-
#name ⇒ Object
Returns the value of attribute name.
-
#url ⇒ Object
Returns the value of attribute url.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#create_post(post_attributes) ⇒ Object
include ResourceApi.
- #publications ⇒ Object
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute 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
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
2 3 4 |
# File 'lib/medium_api/user.rb', line 2 def name @name end |
#url ⇒ Object
Returns the value of attribute url
2 3 4 |
# File 'lib/medium_api/user.rb', line 2 def url @url end |
#username ⇒ Object
Returns the value of attribute 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 |
#publications ⇒ Object
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 |