Sha256: 71a39a8b53a5478c246c49ca89377327917496060fb0444d500c2f2a00aa606e

Contents?: true

Size: 950 Bytes

Versions: 10

Compression:

Stored size: 950 Bytes

Contents

module Quaderno
  module Behavior
    module Deliver

      def self.included(base)
        base.send :include, InstanceMethods
      end

      module InstanceMethods
        include Quaderno::Helpers::Authentication

        def deliver(options = nil)
          self.authentication_data = get_authentication(options.merge(api_model: api_model)) if options.is_a?(Hash)

          party_response = api_model.get("#{authentication_data[:url]}#{api_model.api_path}/#{id}/deliver.json",
            basic_auth: authentication_data[:basic_auth],
            headers: self.class.version_header.merge(authentication_data[:headers])
          )

          api_model.check_exception_for(party_response, { rate_limit: true, subdomain_or_token: true, id: true, required_fields: true })
          { limit: party_response.headers["x-ratelimit-limit"].to_i, remaining: party_response.headers["x-ratelimit-remaining"].to_i }
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
quaderno-1.14.0 lib/quaderno-ruby/behavior/deliver.rb
quaderno-1.13.2 lib/quaderno-ruby/behavior/deliver.rb
quaderno-1.13.1 lib/quaderno-ruby/behavior/deliver.rb
quaderno-1.13.0 lib/quaderno-ruby/behavior/deliver.rb
quaderno-1.12.5 lib/quaderno-ruby/behavior/deliver.rb
quaderno-1.12.4 lib/quaderno-ruby/behavior/deliver.rb
quaderno-1.12.3 lib/quaderno-ruby/behavior/deliver.rb
quaderno-1.12.2 lib/quaderno-ruby/behavior/deliver.rb
quaderno-1.12.1 lib/quaderno-ruby/behavior/deliver.rb
quaderno-1.12.0 lib/quaderno-ruby/behavior/deliver.rb