discourse_api 0.34.0 → 0.35.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/.rubocop.yml +6 -0
  4. data/.travis.yml +10 -4
  5. data/CHANGELOG.md +12 -0
  6. data/Gemfile +1 -0
  7. data/Guardfile +2 -1
  8. data/Rakefile +7 -2
  9. data/discourse_api.gemspec +23 -22
  10. data/examples/backups.rb +1 -0
  11. data/examples/badges.rb +1 -0
  12. data/examples/category.rb +1 -0
  13. data/examples/change_topic_status.rb +3 -3
  14. data/examples/create_private_message.rb +1 -0
  15. data/examples/create_topic.rb +1 -0
  16. data/examples/create_update_category.rb +1 -1
  17. data/examples/create_user.rb +1 -0
  18. data/examples/dashboard.rb +3 -2
  19. data/examples/disposable_invite_tokens.rb +1 -0
  20. data/examples/example.rb +1 -0
  21. data/examples/group_set_user_notification_level.rb +1 -1
  22. data/examples/groups.rb +1 -0
  23. data/examples/invite_users.rb +1 -0
  24. data/examples/post_action.rb +1 -0
  25. data/examples/search.rb +1 -0
  26. data/examples/sent_private_messages.rb +1 -0
  27. data/examples/sso.rb +1 -0
  28. data/examples/topic_lists.rb +1 -0
  29. data/examples/update_user.rb +1 -0
  30. data/examples/upload_file.rb +1 -0
  31. data/lib/discourse_api.rb +1 -0
  32. data/lib/discourse_api/api/api_key.rb +3 -2
  33. data/lib/discourse_api/api/backups.rb +1 -0
  34. data/lib/discourse_api/api/badges.rb +5 -4
  35. data/lib/discourse_api/api/categories.rb +16 -15
  36. data/lib/discourse_api/api/dashboard.rb +7 -6
  37. data/lib/discourse_api/api/email.rb +1 -0
  38. data/lib/discourse_api/api/groups.rb +11 -10
  39. data/lib/discourse_api/api/invite.rb +4 -3
  40. data/lib/discourse_api/api/notifications.rb +2 -1
  41. data/lib/discourse_api/api/params.rb +3 -2
  42. data/lib/discourse_api/api/posts.rb +7 -6
  43. data/lib/discourse_api/api/private_messages.rb +4 -3
  44. data/lib/discourse_api/api/search.rb +2 -1
  45. data/lib/discourse_api/api/site_settings.rb +3 -2
  46. data/lib/discourse_api/api/sso.rb +3 -2
  47. data/lib/discourse_api/api/tags.rb +1 -0
  48. data/lib/discourse_api/api/topics.rb +17 -16
  49. data/lib/discourse_api/api/uploads.rb +4 -3
  50. data/lib/discourse_api/api/user_actions.rb +3 -2
  51. data/lib/discourse_api/api/users.rb +23 -20
  52. data/lib/discourse_api/client.rb +8 -7
  53. data/lib/discourse_api/error.rb +2 -1
  54. data/lib/discourse_api/single_sign_on.rb +1 -0
  55. data/lib/discourse_api/version.rb +2 -1
  56. data/spec/discourse_api/api/users_spec.rb +13 -13
  57. metadata +38 -25
  58. data/routes.txt +0 -203
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 52056720fe38a8e6345ebdaa427c8da352681b88bcf3a2de2b21636b251181ce
4
- data.tar.gz: 81f2c6c41121d1b15cc5c389d4f067314b271eb96b7976a12ed2625e1927861b
3
+ metadata.gz: c528dfd53262df7af997ea5f9da09b4ea423e9425dc98d18c944af293f15ef94
4
+ data.tar.gz: e0df934c4e39a5eed50f080bf6d02be0aec29aa3b21ddd21875782ad456867eb
5
5
  SHA512:
6
- metadata.gz: 75583ba2ac5bc68bba59ba127d87b9660de4101baf7eeb5a79454b536254eb07596d98df5610b67f47445e0f362f1a928d36e2cbdf08a74b57e66eb7aef20409
7
- data.tar.gz: '019c08c76bd3150b6eea2f990f7e3194931d04d96522e51a7662b5a2aa1b3cbbc7424b43833ef549d5e351baeeb7890564c0c0f473b6fa8af42ec871666b458d'
6
+ metadata.gz: bf4d4859413e6c923bd0c0162b13997133536e6d9d176ba8220364ed7cdbb58962e3a4ce27940bc5c5d96bd2e39fe601accc27fe813eabd1aabb209913351fe4
7
+ data.tar.gz: 46117b013a50ccc7fc3e6bd7f1fa4f117b1166cb846e34f76821db62ef66eeb4d7a87b21cbc6273494bcece664c1b6520639c016b430b0a47d970556df8b9ea9
data/.gitignore CHANGED
@@ -19,3 +19,6 @@ bin/
19
19
  .ruby-gemset
20
20
  .ruby-version
21
21
  .env
22
+
23
+
24
+ .rubocop-https---raw-githubusercontent-com-discourse-discourse-master--rubocop-yml
@@ -0,0 +1,6 @@
1
+ inherit_from: https://raw.githubusercontent.com/discourse/discourse/master/.rubocop.yml
2
+ AllCops:
3
+ TargetRubyVersion: 2.4
4
+ DisabledByDefault: true
5
+ Exclude:
6
+ - 'spec/**/**/*.rb'
@@ -1,5 +1,11 @@
1
- language: ruby
1
+ language: 'ruby'
2
+
3
+ before_install:
4
+ - 'gem update --system'
5
+ - 'gem install bundler'
6
+
2
7
  rvm:
3
- - 2.2.5
4
- - 2.3.1
5
- script: 'bundle exec rake test'
8
+ - '2.5.5'
9
+ - '2.6.2'
10
+
11
+ script: 'bundle exec rake'
@@ -2,6 +2,18 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
+ ## [0.35.0] - 2019-04-02
6
+ ### Added
7
+ - Added `custom_fields` param to create/update category
8
+ - Added `frozen_string_literal: true` to all the files
9
+ - Added rubocop and all the changes that went along with it
10
+ ### Fixed
11
+ - Allow `api_username` to be changed for an initialized client
12
+ - Update many of the `/users` routes to use the `/u` route
13
+ ### Changed
14
+ - Changed `update_trust_level` to follow consistent method param syntax where
15
+ you specify the id first followed by params
16
+
5
17
  ## [0.34.0] - 2019-04-02
6
18
  ### Added
7
19
  - Header based authentication
data/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  source 'https://rubygems.org'
2
3
 
3
4
  # Specify your gem's dependencies in discourse_api.gemspec
data/Guardfile CHANGED
@@ -1,5 +1,6 @@
1
+ # frozen_string_literal: true
1
2
  guard :rspec do
2
3
  watch(%r{^spec/.+_spec\.rb$})
3
4
  watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
4
- watch('spec/spec_helper.rb') { "spec" }
5
+ watch('spec/spec_helper.rb') { 'spec' }
5
6
  end
data/Rakefile CHANGED
@@ -1,7 +1,12 @@
1
- require "bundler/gem_tasks"
1
+ # frozen_string_literal: true
2
+ require 'bundler/gem_tasks'
2
3
 
3
4
  require 'rspec/core/rake_task'
4
5
  RSpec::Core::RakeTask.new(:spec)
5
6
 
7
+ require 'rubocop/rake_task'
8
+ RuboCop::RakeTask.new(:rubocop)
9
+
6
10
  task test: :spec
7
- task default: :spec
11
+ task lint: :rubocop
12
+ task default: [:spec, :lint]
@@ -1,35 +1,36 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+ lib = File.expand_path('lib', __dir__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'discourse_api/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "discourse_api"
7
+ spec.name = 'discourse_api'
8
8
  spec.version = DiscourseApi::VERSION
9
- spec.authors = ["Sam Saffron", "John Paul Ashenfelter", "Michael Herold", "Blake Erickson"]
10
- spec.email = ["sam.saffron@gmail.com", "john@ashenfelter.com", "michael.j.herold@gmail.com", "o.blakeerickson@gmail.com"]
11
- spec.description = %q{Discourse API}
12
- spec.summary = %q{Allows access to the Discourse API}
13
- spec.homepage = "http://github.com/discourse/discourse_api"
14
- spec.license = "MIT"
9
+ spec.authors = ['Sam Saffron', 'John Paul Ashenfelter', 'Michael Herold', 'Blake Erickson']
10
+ spec.email = ['sam.saffron@gmail.com', 'john@ashenfelter.com', 'michael.j.herold@gmail.com', 'o.blakeerickson@gmail.com']
11
+ spec.description = 'Discourse API'
12
+ spec.summary = 'Allows access to the Discourse API'
13
+ spec.homepage = 'http://github.com/discourse/discourse_api'
14
+ spec.license = 'MIT'
15
15
 
16
- spec.files = `git ls-files`.split($/)
16
+ spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
19
+ spec.require_paths = ['lib']
20
20
 
21
- spec.add_dependency "faraday", "~> 0.9"
22
- spec.add_dependency "faraday_middleware", "~> 0.10"
23
- spec.add_dependency "rack", ">= 1.6"
21
+ spec.add_dependency 'faraday', '~> 0.9'
22
+ spec.add_dependency 'faraday_middleware', '~> 0.10'
23
+ spec.add_dependency 'rack', '>= 1.6'
24
24
 
25
- spec.add_development_dependency "bundler", "~> 1.12"
26
- spec.add_development_dependency "rake", "~> 11.1"
27
- spec.add_development_dependency "rspec", "~> 3.4"
28
- spec.add_development_dependency "webmock", "~> 2.0"
29
- spec.add_development_dependency "guard-rspec", "~> 4.7"
30
- spec.add_development_dependency "guard", "~> 2.14"
31
- spec.add_development_dependency "rb-inotify", "~> 0.9"
32
- spec.add_development_dependency "simplecov", "~> 0.11"
25
+ spec.add_development_dependency 'bundler', '~> 2.0'
26
+ spec.add_development_dependency 'guard', '~> 2.14'
27
+ spec.add_development_dependency 'guard-rspec', '~> 4.7'
28
+ spec.add_development_dependency 'rake', '~> 11.1'
29
+ spec.add_development_dependency 'rb-inotify', '~> 0.9'
30
+ spec.add_development_dependency 'rspec', '~> 3.4'
31
+ spec.add_development_dependency 'rubocop', '~> 0.67.2'
32
+ spec.add_development_dependency 'simplecov', '~> 0.11'
33
+ spec.add_development_dependency 'webmock', '~> 2.0'
33
34
 
34
35
  spec.required_ruby_version = '>= 2.2.3'
35
36
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
3
  require File.expand_path('../../lib/discourse_api', __FILE__)
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
3
  require File.expand_path('../../lib/discourse_api', __FILE__)
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
3
  require File.expand_path('../../lib/discourse_api', __FILE__)
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
3
  require File.expand_path('../../lib/discourse_api', __FILE__)
3
4
 
@@ -17,7 +18,6 @@ response = client.create_topic(
17
18
  topic_id = response['topic_id']
18
19
  topic_slug = response['topic_slug']
19
20
 
20
-
21
21
  ##
22
22
  # available options (guessing from reading discourse source)
23
23
  # status can be: ['autoclose', 'closed', 'archived', 'disabled', 'visible']
@@ -25,9 +25,9 @@ topic_slug = response['topic_slug']
25
25
  ##
26
26
 
27
27
  # lock topic (note: api_username determines user that is performing action)
28
- params = {status: 'closed', enabled: true, api_username: "YOUR USERNAME/USERS USERNAME"}
28
+ params = { status: 'closed', enabled: true, api_username: "YOUR USERNAME/USERS USERNAME" }
29
29
  client.change_topic_status(topic_slug, topic_id, params)
30
30
 
31
31
  # unlock topic (note: api_username determines user that is performing action)
32
- params = {status: 'closed', enabled: false, api_username: "YOUR USERNAME/USERS USERNAME"}
32
+ params = { status: 'closed', enabled: false, api_username: "YOUR USERNAME/USERS USERNAME" }
33
33
  client.change_topic_status(topic_slug, topic_id, params)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
3
  require File.expand_path('../../lib/discourse_api', __FILE__)
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
3
  require File.expand_path('../../lib/discourse_api', __FILE__)
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
3
  require File.expand_path('../../lib/discourse_api', __FILE__)
3
4
 
@@ -18,7 +19,6 @@ client.api_username = "system"
18
19
  # :email_in_allow_strangers, :logo_url, :background_url, :allow_badges, :topic_template
19
20
  ###
20
21
 
21
-
22
22
  # Create category
23
23
  new_category = client.create_category(
24
24
  name: "Test Category",
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
3
  require File.expand_path('../../lib/discourse_api', __FILE__)
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
3
  require File.expand_path('../../lib/discourse_api', __FILE__)
3
4
 
@@ -5,9 +6,9 @@ client = DiscourseApi::Client.new("http://localhost:3000")
5
6
  client.api_key = "YOUR_API_KEY"
6
7
  client.api_username = "YOUR_USERNAME"
7
8
 
8
- # get all dashboard status as json
9
+ # get all dashboard status as json
9
10
  puts client.get_dashboard_stats
10
11
 
11
- # get hash of some dashboard total value
12
+ # get hash of some dashboard total value
12
13
  puts client.get_dashboard_stats_totals
13
14
  # sample output: {"users"=>9, "topics"=>230, "posts"=>441}
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # requires this plugin => https://github.com/discourse/discourse-invite-tokens
2
3
 
3
4
  require 'csv'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
3
  require File.expand_path('../../lib/discourse_api', __FILE__)
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
3
  require File.expand_path('../../lib/discourse_api', __FILE__)
3
4
 
@@ -34,4 +35,3 @@ end
34
35
  end
35
36
  end
36
37
  end
37
-
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
3
  require File.expand_path('../../lib/discourse_api', __FILE__)
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
3
  require File.expand_path('../../lib/discourse_api', __FILE__)
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
3
  require File.expand_path('../../lib/discourse_api', __FILE__)
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
3
  require File.expand_path('../../lib/discourse_api', __FILE__)
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
3
  require File.expand_path('../../lib/discourse_api', __FILE__)
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
3
  require File.expand_path('../../lib/discourse_api', __FILE__)
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
3
  require File.expand_path('../../lib/discourse_api', __FILE__)
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
3
  require File.expand_path('../../lib/discourse_api', __FILE__)
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
3
  require File.expand_path('../../lib/discourse_api', __FILE__)
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require "discourse_api/api/params"
2
3
  require "discourse_api/client"
3
4
  require "discourse_api/error"
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module DiscourseApi
2
3
  module API
3
4
  module ApiKey
@@ -19,11 +20,11 @@ module DiscourseApi
19
20
  end
20
21
 
21
22
  def revoke_api_key(id)
22
- response = delete("/admin/api/key", {id: id})
23
+ response = delete("/admin/api/key", id: id)
23
24
  end
24
25
 
25
26
  def regenerate_api_key(id)
26
- response = put("/admin/api/key", {id: id})
27
+ response = put("/admin/api/key", id: id)
27
28
  response.body
28
29
  end
29
30
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module DiscourseApi
2
3
  module API
3
4
  module Backups
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module DiscourseApi
2
3
  module API
3
4
  module Badges
@@ -11,14 +12,14 @@ module DiscourseApi
11
12
  response.body['badges']
12
13
  end
13
14
 
14
- def grant_user_badge(params={})
15
+ def grant_user_badge(params = {})
15
16
  post("/user_badges", params)
16
17
  end
17
18
 
18
- def create_badge(params={})
19
+ def create_badge(params = {})
19
20
  args = API.params(params)
20
- .required(:name, :badge_type_id)
21
- .optional(:description, :allow_title, :multiple_grant, :icon, :listable,
21
+ .required(:name, :badge_type_id)
22
+ .optional(:description, :allow_title, :multiple_grant, :icon, :listable,
22
23
  :target_posts, :query, :enabled, :auto_revoke, :badge_grouping_id,
23
24
  :trigger, :show_posts, :image, :long_description)
24
25
  post("/admin/badges.json", args)
@@ -1,38 +1,39 @@
1
+ # frozen_string_literal: true
1
2
  module DiscourseApi
2
3
  module API
3
4
  module Categories
4
5
  # :color and :text_color are RGB hexadecimal strings
5
6
  # :permissions is a hash with the group name and permission_type which is
6
7
  # an integer 1 = Full 2 = Create Post 3 = Read Only
7
- def create_category(args={})
8
+ def create_category(args = {})
8
9
  args = API.params(args)
9
- .required(:name, :color, :text_color)
10
- .optional(:description, :permissions)
11
- .default(parent_category_id: nil)
10
+ .required(:name, :color, :text_color)
11
+ .optional(:description, :permissions, :custom_fields)
12
+ .default(parent_category_id: nil)
12
13
  response = post("/categories", args)
13
14
  response['category']
14
15
  end
15
16
 
16
- def update_category(args={})
17
+ def update_category(args = {})
17
18
  category_id = args[:id]
18
19
  args = API.params(args)
19
- .required(:id, :name, :color, :text_color)
20
- .optional(:slug, :permissions, :auto_close_hours, :auto_close_based_on_last_post, :position, :email_in,
21
- :email_in_allow_strangers, :logo_url, :background_url, :allow_badges, :topic_template)
22
- .default(parent_category_id: nil)
20
+ .required(:id, :name, :color, :text_color)
21
+ .optional(:slug, :permissions, :auto_close_hours, :auto_close_based_on_last_post, :position, :email_in,
22
+ :email_in_allow_strangers, :logo_url, :background_url, :allow_badges, :topic_template, :custom_fields)
23
+ .default(parent_category_id: nil)
23
24
  response = put("/categories/#{category_id}", args)
24
25
  response['body']['category'] if response['body']
25
26
  end
26
27
 
27
- def categories(params={})
28
+ def categories(params = {})
28
29
  response = get('/categories.json', params)
29
30
  response[:body]['category_list']['categories']
30
31
  end
31
32
 
32
- def category_latest_topics(args={})
33
+ def category_latest_topics(args = {})
33
34
  params = API.params(args)
34
- .required(:category_slug)
35
- .optional(:page).to_h
35
+ .required(:category_slug)
36
+ .optional(:page).to_h
36
37
  url = "/c/#{params[:category_slug]}/l/latest.json"
37
38
  if params.include?(:page)
38
39
  url = "#{url}?page=#{params[:page]}"
@@ -64,10 +65,10 @@ module DiscourseApi
64
65
  response[:body]['category']
65
66
  end
66
67
 
67
- def category_set_user_notification(args={})
68
+ def category_set_user_notification(args = {})
68
69
  category_id = args[:id]
69
70
  args = API.params(args)
70
- .required(:notification_level)
71
+ .required(:notification_level)
71
72
  post("/category/#{category_id}/notifications", args)
72
73
  end
73
74
  end
@@ -1,22 +1,23 @@
1
+ # frozen_string_literal: true
1
2
  module DiscourseApi
2
3
  module API
3
4
  module Dashboard
4
5
  def get_dashboard_stats
5
6
  response = get("admin/dashboard.json")
6
7
  response[:body]
7
- end
8
-
8
+ end
9
+
9
10
  def get_dashboard_stats_totals
10
11
  stats = get_dashboard_stats
11
- global_reports = stats['global_reports']
12
+ global_reports = stats['global_reports']
12
13
  users = global_reports[1]
13
14
  topics = global_reports[3]
14
15
  posts = global_reports[4]
15
-
16
+
16
17
  totals = {
17
- 'users' => users['total'],
18
+ 'users' => users['total'],
18
19
  'topics' => topics['total'],
19
- 'posts' => posts['total']
20
+ 'posts' => posts['total']
20
21
  }
21
22
  end
22
23
  end