Sha256: ac579f25a61511870d49291150cfc83f772cce2fa8df32bbe2f6305504642af3

Contents?: true

Size: 833 Bytes

Versions: 10

Compression:

Stored size: 833 Bytes

Contents

class StageGateway < GatewayBase
  def source
    @source ||= [
      FactoryGirl.build(:remote_stage,
        :stage_id    => 'stage_0',
        :matches_ids => %w(match_0)
      ),
      FactoryGirl.build( :remote_stage,
        :stage_id    => 'stage_1',
        :matches_ids => %w(match_0)
      )
    ]
  end

  def fetch(params)
    tournament_id = params[:tournament_id]

    raise "missed parameter 'tournament_id'" unless tournament_id

    source.select do |attrs|
      attrs[:tour_id] = tournament_id
    end
  end

  def find(params)
    tournament_id, id = params[:tournament_id], params[:id]

    raise "missed parameter 'tournament_id'" unless tournament_id
    raise "missed parameter 'id'" unless id

    source.find do |attrs|
      attrs[:tour_id] = tournament_id &&
      attrs[:stage_id] = id
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
synchronisable-1.2.3 spec/dummy/app/gateways/stage_gateway.rb
synchronisable-1.2.2 spec/dummy/app/gateways/stage_gateway.rb
synchronisable-1.2.1 spec/dummy/app/gateways/stage_gateway.rb
synchronisable-1.2.0 spec/dummy/app/gateways/stage_gateway.rb
synchronisable-1.1.9 spec/dummy/app/gateways/stage_gateway.rb
synchronisable-1.1.8 spec/dummy/app/gateways/stage_gateway.rb
synchronisable-1.1.7 spec/dummy/app/gateways/stage_gateway.rb
synchronisable-1.1.6 spec/dummy/app/gateways/stage_gateway.rb
synchronisable-1.1.5 spec/dummy/app/gateways/stage_gateway.rb
synchronisable-1.1.4 spec/dummy/app/gateways/stage_gateway.rb