Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
j_platform / app / controllers / j_platform / buffer_accounts_controller.rb
Size: Mime:
module JPlatform
  class BufferAccountsController < BaseController
    def buffer_message
      sa_ids = params[:sa_ids]
      sa_ids = sa_ids.split(",") if sa_ids.is_a?String

      platform_buffer_path = "#{JPlatform::Default.endpoint}/api/v1/social_accounts/buffer_accounts/#{params[:id]}/buffer_message"
      post = Typhoeus::Request.post(platform_buffer_path,
                                    headers: {authorization: ::PlatformResource.headers['authorization']},
                                    params: {message: params[:message], sa_ids: sa_ids})

      result = {"state"=> "error", "message" => "Unknown error"}
      if post.success?
        result = post.body
      else
        result = result.to_json
      end
      render json: result
    end
  end
end