Sha256: fd41b50892e47306a32a558184b9a291691d728a629cf10c815182e40e7d1e3d

Contents?: true

Size: 414 Bytes

Versions: 1

Compression:

Stored size: 414 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
    attribute :action, 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.1.0 lib/adam_signals/response.rb