Sha256: ee2636a1719ebc500259a50c6865c97ebb48614b9bda84dc0867af02343337d7

Contents?: true

Size: 384 Bytes

Versions: 1

Compression:

Stored size: 384 Bytes

Contents

require 'json'
require 'virtus'

class AdamSignals::Response
  include Virtus.value_object

  values do
    attribute :target_type, Symbol
    attribute :target_address, String
    attribute :body, String
  end

  def self.from_json(json)
    new JSON.parse(json)
  end

  def to_json
    JSON.generate attributes
  end

  def to_s
    "#<#{self.class.name} #{attributes}>"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
adam_signals-1.0.0 lib/adam_signals/response.rb