Sha256: 93c89a7d00dc1319e4101a4ced87d3b77ec8b588db8b3fd1af672749ede257ca

Contents?: true

Size: 729 Bytes

Versions: 9

Compression:

Stored size: 729 Bytes

Contents

module Octoparts
  class AggregateRequestBuilder
    def initialize(&block)
      self.instance_eval(&block)
    end

    def request_meta(params)
      @request_meta = Octoparts::Model::RequestMeta.new
      params.each do |key, value|
        @request_meta.send("#{key}=", value)
      end
    end

    def requests(&block)
      self.instance_eval(&block)
    end

    def part_request(params)
      @requests ||= []
      part_request = Octoparts::Model::PartRequest.new
      params.each do |key, value|
        part_request.send("#{key}=", value)
      end
      @requests << part_request
      part_request
    end

    def build
      Octoparts::Model::AggregateRequest.create(@request_meta, @requests)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
octoparts-0.1.3 lib/octoparts/builder.rb
octoparts-0.1.1 lib/octoparts/builder.rb
octoparts-0.1.0 lib/octoparts/builder.rb
octoparts-0.0.9 lib/octoparts/builder.rb
octoparts-0.0.8 lib/octoparts/builder.rb
octoparts-0.0.7 lib/octoparts/builder.rb
octoparts-0.0.6 lib/octoparts/builder.rb
octoparts-0.0.5 lib/octoparts/builder.rb
octoparts-0.0.4 lib/octoparts/builder.rb