Sha256: ac642ddfce4b73d23f3532b8e43fec7ea045dd8fe43a2f891ebeb28cb77d16cf

Contents?: true

Size: 454 Bytes

Versions: 1

Compression:

Stored size: 454 Bytes

Contents

module Pwush
  class Request
    attr_reader :body

    def initialize(auth:, app:, payload: nil)
      @auth    = auth
      @app     = app
      @payload = payload || {}
      @body    = build_body(@payload)
    end

    def to_json
      Oj.dump(body)
    end

    private

    def build_body(payload)
      wrap_request payload.merge(auth: @auth, application: @app)
    end

    def wrap_request(request)
      { request: request }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pwush-0.0.0 lib/pwush/request.rb