class Shokkenki::Consumer::Model::Interaction

Attributes

fixtures[R]
label[R]
request[R]
response[R]
time[R]

Public Class Methods

new(attributes) click to toggle source
# File lib/shokkenki/consumer/model/interaction.rb, line 10
def initialize attributes
  @request = attributes[:request].to_shokkenki_term
  @label = attributes[:label] || attributes[:request].label
  @response = attributes[:response].to_shokkenki_term
  @fixtures = attributes[:fixtures]
  @time = Time.now
end

Public Instance Methods

to_hash() click to toggle source
# File lib/shokkenki/consumer/model/interaction.rb, line 18
def to_hash
  hash = {
    :request => @request.to_hash,
    :response => @response.to_hash,
    :time => @time.utc.iso8601,
    :label => @label
  }
  hash.merge!(:fixtures => @fixtures.map{ |f| f.to_hash }) if @fixtures
  hash
end