Sha256: 22e58ed71658c3374c2b6f66bed30b8b9c4bf85340757e7d3b636436f0b8a0a4

Contents?: true

Size: 841 Bytes

Versions: 1

Compression:

Stored size: 841 Bytes

Contents

module CirroIO
  module Client
    class Gig < Base
      has_one :worker_invitation_filter
      has_many :gig_tasks

      # rubocop:disable Metrics/AbcSize
      def bulk_create_with(attrs)
        payload = { data: { attributes: attributes } }

        if attrs[:gig_tasks]
          payload[:data][:relationships] ||= {}
          payload[:data][:relationships][:gig_tasks] = attrs[:gig_tasks].map(&:attributes)
        end

        if attrs[:worker_invitation_filter]
          payload[:data][:relationships] ||= {}
          payload[:data][:relationships][:worker_invitation_filter] = attrs[:worker_invitation_filter].attributes
        end

        response = self.class.custom_post('bulk/gigs', payload)

        self.class.parser.parse(self.class, response).first
      end
      # rubocop:enable Metrics/AbcSize
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cirro-ruby-client-1.1.0 lib/cirro_io/client/gig.rb