Module: Kinja::Author
- Included in:
- Client
- Defined in:
- lib/kinja/author.rb
Instance Method Summary collapse
- #get_all_author_posts(id, max = 100) ⇒ Object
- #get_author(user) ⇒ Object
- #get_author_id(name) ⇒ Object
- #get_author_posts(id, start = nil, max = 20) ⇒ Object
- #get_default_blog_id(user) ⇒ Object
Instance Method Details
#get_all_author_posts(id, max = 100) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/kinja/author.rb', line 15 def (id, max=100) posts = [] feed = (id, nil, max) posts.push feed["items"] next_one = feed["pagination"]["next"]["startTime"] loop do feed = (id, next_one, max) posts.push feed["items"] posts = posts.flatten break if feed["pagination"]["next"].nil? next_one = feed["pagination"]["next"]["startTime"] puts posts.length puts "Getting next one #{next_one}" end posts.flatten end |
#get_author(user) ⇒ Object
3 4 5 |
# File 'lib/kinja/author.rb', line 3 def (user) HTTParty.get((user["id"]))["data"] end |
#get_author_id(name) ⇒ Object
7 8 9 |
# File 'lib/kinja/author.rb', line 7 def (name) HTTParty.get((name))["data"]["id"] end |
#get_author_posts(id, start = nil, max = 20) ⇒ Object
33 34 35 |
# File 'lib/kinja/author.rb', line 33 def (id, start=nil, max=20) HTTParty.get((id, start, max))["data"] end |
#get_default_blog_id(user) ⇒ Object
11 12 13 |
# File 'lib/kinja/author.rb', line 11 def get_default_blog_id(user) (user)[0]["defaultBlogId"] end |