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
|
---|---|---|---|---|---|
abff971bd1d92df4f38ee9c11dd60c1a61e329db | 557 | require 'bio-ucsc'
describe "Bio::Ucsc::Hg19::WgEncodeHaibMethylRrbsMcf10aesYalestruhlgrowprotSitesRep1" do
describe "#find_by_interval" do
context "given range chr1:1-800,000" do
it 'returns a record (r.chrom == "chr1")' do
Bio::Ucsc::Hg19::DBConnection.default
Bio::Ucsc::Hg19::DBConnection.connect
i = Bio::GenomicInterval.parse("chr1:1-800,000")
r = Bio::Ucsc::Hg19::WgEncodeHaibMethylRrbsMcf10aesYalestruhlgrowprotSitesRep1.find_by_interval(i)
r.chrom.should == "chr1"
end
end
end
end
| 32.764706 | 106 | 0.691203 |
7ad0be58869b05ef636847d99101924947c59d02 | 137 | RSpec::Matchers.define :be_url do |expected|
match do |actual|
URI.parse(actual)
rescue URI::InvalidURIError
false
end
end
| 17.125 | 44 | 0.708029 |
79ea6adfc62ccea1de6ad0454f6834a8e7c825bc | 2,123 | class ZeroInstall < Formula
desc "Zero Install is a decentralised software installation system"
homepage "http://0install.net/"
url "https://github.com/0install/0install/archive/v2.12-1.tar.gz"
version "2.12-1"
sha256 "317ac6ac680d021cb475962b7f6c2bcee9c35ce7cf04ae00d72bba8113f13559"
revision 1
bottle do
cellar :any_skip_relocation
sha256 "bf4bb4e75194ac7f85969298f592fa460c459fe5363aaca290c16055cbb6be91" => :sierra
sha256 "fc20a07f9e2f81feeeb0b755838b5e6f327206f9a95c00f13b7fcea851c00199" => :el_capitan
sha256 "173371c177694ff72038f504c81bde55777960d14678bf1d0b942487aff444ef" => :yosemite
end
depends_on "pkg-config" => :build
depends_on "ocaml" => :build
depends_on "ocamlbuild" => :build
depends_on "opam" => :build
depends_on "camlp4" => :build
depends_on :gpg => :run
depends_on "gtk+" => :optional
def install
ENV.append_path "PATH", Formula["gnupg"].opt_bin
opamroot = buildpath/"opamroot"
ENV["OPAMROOT"] = opamroot
ENV["OPAMYES"] = "1"
system "opam", "init", "--no-setup"
modules = %w[yojson xmlm ounit react ppx_tools lwt<3 extlib ocurl sha]
modules << "lablgtk" if build.with? "gtk+"
system "opam", "config", "exec", "opam", "install", *modules
system "opam", "config", "exec", "make"
inreplace "dist/install.sh", '"/usr/local"', prefix
inreplace "dist/install.sh", '"${PREFIX}/man"', man
system "make", "install"
end
test do
(testpath/"hello.py").write <<-EOS.undent
print("hello world")
EOS
(testpath/"hello.xml").write <<-EOS.undent
<?xml version="1.0" ?>
<interface xmlns="http://zero-install.sourceforge.net/2004/injector/interface">
<name>Hello</name>
<summary>minimal demonstration program</summary>
<implementation id="." version="0.1-pre">
<command name='run' path='hello.py'>
<runner interface='http://repo.roscidus.com/python/python'></runner>
</command>
</implementation>
</interface>
EOS
assert_equal "hello world\n", shell_output("#{bin}/0launch --console hello.xml")
end
end
| 34.803279 | 92 | 0.675459 |
7a575d230999167111464e4d6f19f1b6b4a57750 | 1,946 | class NicknamesController < ApplicationController
before_action :set_nickname, only: [:show, :edit, :update, :destroy]
# GET /nicknames
# GET /nicknames.json
def index
@nicknames = Nickname.all
end
# GET /nicknames/1
# GET /nicknames/1.json
def show
end
# GET /nicknames/new
def new
@nickname = Nickname.new
end
# GET /nicknames/1/edit
def edit
end
# POST /nicknames
# POST /nicknames.json
def create
@nickname = Nickname.new(nickname_params)
respond_to do |format|
if @nickname.save
format.html { redirect_to @nickname, notice: 'Nickname was successfully created.' }
format.json { render :show, status: :created, location: @nickname }
else
format.html { render :new }
format.json { render json: @nickname.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /nicknames/1
# PATCH/PUT /nicknames/1.json
def update
respond_to do |format|
if @nickname.update(nickname_params)
format.html { redirect_to @nickname, notice: 'Nickname was successfully updated.' }
format.json { render :show, status: :ok, location: @nickname }
else
format.html { render :edit }
format.json { render json: @nickname.errors, status: :unprocessable_entity }
end
end
end
# DELETE /nicknames/1
# DELETE /nicknames/1.json
def destroy
@nickname.destroy
respond_to do |format|
format.html { redirect_to nicknames_url, notice: 'Nickname was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_nickname
@nickname = Nickname.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def nickname_params
params.require(:nickname).permit(:name, :building_id)
end
end
| 25.946667 | 95 | 0.668037 |
ff3423b6841e3eed0e8fe848b19bf4b288db5e0c | 367 | require "bundler/setup"
require "hl/citation"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
config.expect_with :rspec do |c|
c.syntax = :expect
end
end
| 24.466667 | 66 | 0.752044 |
ed2bf083ea94baea408edee7dc172a7c6180604d | 255 | pap_file=Файл паролей PAP,0
ppp_options=Файл настройки PPP,0
dialin_config=Файл настройки приема входящих звонков mgetty,0
encrypt_pass=Шифровать пароли в файле паролей,1,1-Да,0-Нет
login_config=Файл настройки входов mgetty,0
line2=Системные параметры,11
| 36.428571 | 61 | 0.847059 |
11098c7552f586b80c05edd0abf53e657fbf5277 | 551 | Spree::Admin::StockTransfersController.class_eval do
def load_viewable_stock_locations
@stock_locations = Spree::StockLocation.for_store.accessible_by(current_ability, :read)
end
def load_source_stock_locations
@source_stock_locations ||= Spree::StockLocation.for_store.accessible_by(current_ability, :transfer_from)
end
def load_destination_stock_locations
@destination_stock_locations ||= Spree::StockLocation.for_store.accessible_by(current_ability, :transfer_to).where.not(id: @stock_transfer.source_location_id)
end
end
| 39.357143 | 162 | 0.823956 |
ed3ef1e7144d8f437a9f9e7968777bd1409fff1f | 859 | #!/usr/bin/env ruby
# encoding: utf-8
drchord_dir = File.expand_path(File.dirname(__FILE__))
begin
ENV['BUNDLE_GEMFILE'] = File.expand_path(File.join(drchord_dir, 'Gemfile'))
require 'bundler/setup'
rescue LoadError
puts "Error: 'bundler' not found. Please install it with `gem install bundler`."
exit
end
require 'optparse'
options = {:node => "druby://127.0.0.1:3000"}
OptionParser.new do |opt|
opt.banner = "Usage: ruby #{File.basename($0)} [options]"
opt.on('-n --node', 'IP_ADDR:PORT') {|v| options[:node] = "druby://#{v}" }
opt.on_tail('-h', '--help', 'show this message') {|v| puts opt; exit }
begin
opt.parse!
rescue OptionParser::InvalidOption
puts "Error: Invalid option. \n#{opt}"; exit
end
end
require File.expand_path(File.join(drchord_dir, '/lib/shell/shell.rb'))
shell = DRChord::DHTShell.new(options)
shell.run
| 28.633333 | 82 | 0.684517 |
e803d7fa674121c0b866c9bd9e704877c1438476 | 53 | class X < Hash
def initialize
end
end
X.new.dup
| 7.571429 | 16 | 0.679245 |
332e3c509fc8cc468db22d7b59911c4bfb2d25aa | 1,583 | class PetitionCountJob < ApplicationJob
class InvalidSignatureCounts < RuntimeError; end
delegate :update_signature_counts, to: :Site
delegate :signature_count_interval, to: :Site
delegate :disable_signature_counts!, to: :Site
delegate :enable_signature_counts!, to: :Site
delegate :disable_invalid_signature_count_check?, to: :Site
queue_as :highest_priority
def perform(now = Time.current)
return if disable_invalid_signature_count_check?
if update_signature_counts
disable_signature_counts!
reschedule_job(scheduled_time(now))
else
unless petitions.empty?
petitions.each(&:reset_signature_count!)
send_notification(petitions)
end
enable_signature_counts!
end
end
private
def petitions
@petitions ||= fetch_petitions
end
def fetch_petitions
petitions_scope.reject(&:valid_signature_count?)
end
def petitions_scope
Petition.signed_since(36.hours.ago)
end
def reschedule_job(time)
self.class.set(wait_until: time).perform_later
end
def scheduled_time(now)
signature_count_interval.seconds.since(now) + 30.seconds
end
def send_notification(petitions)
Appsignal.send_exception(exception(petitions))
end
def exception(petitions)
InvalidSignatureCounts.new(error_message(petitions))
end
def error_message(petitions)
I18n.t(
:"invalid_signature_counts",
scope: :"petitions.errors",
count: petitions.size,
ids: petitions.map(&:id).inspect,
id: petitions.first.id.to_s
)
end
end
| 23.279412 | 61 | 0.725837 |
91df4191702eb90db0be1e1cecf90d7024405831 | 20,629 | # encoding: utf-8
#--
# Copyright 2013-2015 DataStax, 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 'spec_helper'
module Cassandra
class Cluster
describe(ControlConnection) do
let :control_connection do
ControlConnection.new(logger, io_reactor, cluster_registry, cluster_schema, cluster_metadata, load_balancing_policy, reconnection_policy, address_resolution_policy, driver.connector, connection_options)
end
let :io_reactor do
FakeIoReactor.new
end
let :cluster_registry do
driver.cluster_registry
end
let :cluster_schema do
driver.cluster_schema
end
let(:cluster_metadata) { driver.cluster_metadata }
let :logger do
driver.logger
end
let :driver do
Driver.new(protocol_version: 7, io_reactor: io_reactor)
end
let :load_balancing_policy do
driver.load_balancing_policy
end
let :connection_options do
driver.connection_options
end
let :reconnection_policy do
driver.reconnection_policy
end
let(:address_resolution_policy) { driver.address_resolution_policy }
def connections
io_reactor.connections
end
def last_connection
connections.last
end
def requests
last_connection.requests
end
def last_request
requests.last
end
def handle_request(&handler)
@request_handler = handler
end
let :local_info do
{
'data_center' => 'dc1',
'host_id' => nil,
}
end
let :local_metadata do
[
['system', 'local', 'data_center', :text],
['system', 'local', 'host_id', :uuid],
]
end
let :peer_metadata do
[
['system', 'peers', 'peer', :inet],
['system', 'peers', 'data_center', :varchar],
['system', 'peers', 'host_id', :uuid],
['system', 'peers', 'rpc_address', :inet],
]
end
let :data_centers do
Hash.new('dc1')
end
let :racks do
Hash.new('rack1')
end
let :release_versions do
Hash.new('2.0.7-SNAPSHOT')
end
let :host_ids do
Hash.new {|hash, ip| hash[ip] = uuid_generator.uuid}
end
let :additional_nodes do
Array.new(5) { IPAddr.new("127.0.#{rand(255)}.#{rand(255)}") }
end
let :bind_all_rpc_addresses do
false
end
let :min_peers do
[2]
end
let :uuid_generator do
Uuid::Generator.new
end
before do
cluster_registry.add_listener(driver.load_balancing_policy)
cluster_registry.add_listener(control_connection)
cluster_registry.host_found('127.0.0.1')
io_reactor.on_connection do |connection|
connection[:spec_rack] = racks[connection.host]
connection[:spec_data_center] = data_centers[connection.host]
connection[:spec_host_id] = host_ids[connection.host]
connection[:spec_release_version] = release_versions[connection.host]
connection.handle_request do |request, timeout|
additional_rpc_addresses = additional_nodes.dup
if @request_handler
response = @request_handler.call(request, connection, proc { connection.default_request_handler(request) }, timeout)
end
response ||= case request
when Protocol::StartupRequest, Protocol::RegisterRequest
Protocol::ReadyResponse.new
when Protocol::QueryRequest
response = case request.cql
when /USE\s+"?(\S+)"?/
Cassandra::Protocol::SetKeyspaceResultResponse.new($1, nil)
when /FROM system\.local/
row = {
'rack' => connection[:spec_rack],
'data_center' => connection[:spec_data_center],
'host_id' => connection[:spec_host_id],
'release_version' => connection[:spec_release_version]
}
Protocol::RowsResultResponse.new([row], local_metadata, nil, nil)
when /FROM system\.peers WHERE peer = '?(\S+)'/
ip = $1
rows = [
{
'rack' => racks[ip],
'data_center' => data_centers[ip],
'host_id' => host_ids[ip],
'release_version' => release_versions[ip]
}
]
Protocol::RowsResultResponse.new(rows, peer_metadata, nil, nil)
when /FROM system\.peers/
rows = min_peers[0].times.map do |host_id|
ip = additional_rpc_addresses.shift
{
'peer' => ip,
'rack' => racks[ip],
'data_center' => data_centers[ip],
'host_id' => host_ids[ip],
'rpc_address' => bind_all_rpc_addresses ? IPAddr.new('0.0.0.0') : ip,
'release_version' => release_versions[ip]
}
end
Protocol::RowsResultResponse.new(rows, peer_metadata, nil, nil)
end
when Protocol::OptionsRequest
Protocol::SupportedResponse.new('CQL_VERSION' => %w[3.0.0], 'COMPRESSION' => %w[lz4 snappy])
end
response ||= connection.default_request_handler(request)
response
end
end
end
describe "#connect_async" do
it 'tries decreasing protocol versions until one succeeds' do
counter = 0
handle_request do |request|
if counter < 3
counter += 1
Protocol::ErrorResponse.new(0x0a, 'Bork version, dummy!')
elsif counter == 3
counter += 1
Protocol::SupportedResponse.new('CQL_VERSION' => %w[3.0.0], 'COMPRESSION' => %w[lz4 snappy])
end
end
control_connection.connect_async.value
connection_options.protocol_version.should == 4
end
it 'logs when it tries the next protocol version' do
logger.stub(:info)
counter = 0
handle_request do |request|
if counter < 3
counter += 1
Protocol::ErrorResponse.new(0x0a, 'Bork version, dummy!')
elsif counter == 3
counter += 1
Protocol::SupportedResponse.new('CQL_VERSION' => %w[3.0.0], 'COMPRESSION' => %w[lz4 snappy])
end
end
control_connection.connect_async.value
logger.should have_received(:info).with("Host 127.0.0.1 doesn't support protocol version 7, downgrading")
end
it 'gives up when the protocol version is zero' do
counter = 0
handle_request do |request|
counter += 1
Protocol::ErrorResponse.new(0x0a, 'Bork version, dummy!')
end
expect { control_connection.connect_async.value }.to raise_error(Cassandra::Errors::ProtocolError, 'Bork version, dummy!')
counter.should == 7
end
it 'gives up when a non-protocol version related error is raised' do
handle_request do |request|
Protocol::ErrorResponse.new(0x1001, 'Get off my lawn!')
end
expect { control_connection.connect_async.value }.to raise_error(Cassandra::Errors::NoHostsAvailable)
end
it 'fails authenticating when an auth provider has been specified but the protocol is negotiated to v1' do
driver.protocol_version = 1
driver.auth_provider = double(:auth_provider)
counter = 0
handle_request do |request|
case request
when Protocol::OptionsRequest
Protocol::SupportedResponse.new('CQL_VERSION' => %w[3.0.0], 'COMPRESSION' => %w[lz4 snappy])
when Protocol::StartupRequest
Protocol::AuthenticateResponse.new('org.apache.cassandra.auth.PasswordAuthenticator')
end
end
expect { control_connection.connect_async.value }.to raise_error(Errors::AuthenticationError)
end
it 'registers an event listener' do
control_connection.connect_async.value
last_connection.should have_event_listener
end
it 'populates cluster state' do
control_connection.connect_async.value
expect(cluster_registry).to have(3).hosts
cluster_registry.hosts.each do |host|
ip = host.ip
host.rack.should == racks[ip]
host.datacenter.should == data_centers[ip]
host.release_version.should == release_versions[ip]
end
end
context 'with empty peers' do
it 'skips empty peers' do
additional_rpc_addresses = additional_nodes.dup
handle_request do |request|
case request
when Protocol::QueryRequest
case request.cql
when /FROM system\.peers/
rows = min_peers[0].times.map do |host_id|
ip = additional_rpc_addresses.shift
{
'peer' => ip,
'rack' => racks[ip],
'data_center' => data_centers[ip],
'host_id' => host_ids[ip],
'rpc_address' => bind_all_rpc_addresses ? IPAddr.new('0.0.0.0') : ip,
'release_version' => release_versions[ip]
}
end
rows << {
'peer' => nil,
'rack' => nil,
'data_center' => nil,
'host_id' => nil,
'rpc_address' => nil,
'release_version' => nil
}
Protocol::RowsResultResponse.new(rows, peer_metadata, nil, nil)
end
end
end
control_connection.connect_async.value
expect(cluster_registry).to have(3).hosts
end
end
context 'when the nodes have 0.0.0.0 as rpc_address' do
let :bind_all_rpc_addresses do
true
end
it 'falls back on using the peer column' do
control_connection.connect_async.value
cluster_registry.should have(3).hosts
cluster_registry.hosts.each do |host|
ip = host.ip
host.rack.should == racks[ip]
host.datacenter.should == data_centers[ip]
host.release_version.should == release_versions[ip]
end
end
end
context 'when connection closed' do
let(:reconnect_interval) { 5 }
let(:reconnection_schedule) { double('reconnection schedule', :next => reconnect_interval) }
before do
reconnection_policy.stub(:schedule) { reconnection_schedule }
control_connection.connect_async.value
end
it 'reconnects' do
last_connection.close
io_reactor.advance_time(reconnect_interval)
last_connection.should be_connected
end
context 'and reconnected' do
it 'has an event listener' do
control_connection.connect_async.value
last_connection.should have_event_listener
end
end
context 'and all hosts are down' do
before do
cluster_registry.each_host.each do |host|
io_reactor.node_down(host.ip.to_s)
end
connections.each do |connection|
connection.close
end
end
it 'keeps trying until some host comes up' do
rand(10).times { io_reactor.advance_time(reconnect_interval) }
last_connection.should_not be_connected
io_reactor.node_up('127.0.0.1')
io_reactor.advance_time(reconnect_interval)
last_connection.should be_connected
end
end
end
context 'registered for events' do
let :registry do
double("registry stub")
end
before do
control_connection.connect_async.value
end
context 'when a status change event is received' do
let :event do
Protocol::StatusChangeEventResponse.new(change, address, 9999)
end
context 'with UP' do
let :change do
'UP'
end
let :address do
IPAddr.new('127.0.0.1')
end
it 'logs when it receives an UP event' do
logger.stub(:debug)
cluster_registry.stub(:host_up)
connections.first.trigger_event(event)
logger.should have_received(:debug).with(/Event received EVENT STATUS_CHANGE UP/)
end
context 'and host is known' do
before do
cluster_registry.stub(:has_host?) { true }
end
let :address do
additional_nodes[0]
end
it 'notifies registry' do
ip = address.to_s
expect(cluster_registry).to receive(:host_found).once.with(address, {
'rack' => racks[ip],
'data_center' => data_centers[ip],
'host_id' => host_ids[ip],
'release_version' => release_versions[ip]
})
connections.first.trigger_event(event)
end
end
context 'and host is unknown' do
before do
cluster_registry.stub(:has_host?) { false }
end
let :address do
additional_nodes[3]
end
it 'does nothing' do
expect(cluster_registry).to_not receive(:host_found)
connections.first.trigger_event(event)
end
end
end
context 'with DOWN' do
let :change do
'DOWN'
end
let :address do
'127.0.0.1'
end
it 'logs when it receives an DOWN event' do
logger.stub(:debug)
connections.first.trigger_event(event)
logger.should have_received(:debug).with(/Event received EVENT STATUS_CHANGE DOWN/)
end
it 'notifies registry' do
ip = address.to_s
expect(cluster_registry).to receive(:host_down).once.with(ip)
connections.first.trigger_event(event)
end
end
end
context 'when a topology change event is received' do
let :event do
Protocol::TopologyChangeEventResponse.new(change, address, 9999)
end
context 'with NEW_NODE' do
let :change do
'NEW_NODE'
end
let :address do
'127.0.0.1'
end
it 'logs when it receives an NEW_NODE event' do
logger.stub(:debug)
connections.first.trigger_event(event)
logger.should have_received(:debug).with(/Event received EVENT TOPOLOGY_CHANGE NEW_NODE/)
end
context 'and host is unknown' do
let :address do
additional_nodes[3]
end
before do
cluster_registry.stub(:has_host?) { false }
end
it 'notifies registry' do
ip = address.to_s
expect(cluster_registry).to receive(:host_found).once.with(address, {
'rack' => racks[ip],
'data_center' => data_centers[ip],
'host_id' => host_ids[ip],
'release_version' => release_versions[ip]
})
connections.first.trigger_event(event)
end
end
context 'and host is known' do
let :address do
additional_nodes[0]
end
before do
cluster_registry.stub(:has_host?) { true }
end
it 'does nothing' do
expect(cluster_registry).to_not receive(:host_found)
connections.first.trigger_event(event)
end
end
end
context 'with REMOVED_NODE' do
let :change do
'REMOVED_NODE'
end
let :address do
'127.0.0.1'
end
it 'logs when it receives an REMOVED_NODE event' do
logger.stub(:debug)
connections.first.trigger_event(event)
logger.should have_received(:debug).with(/Event received EVENT TOPOLOGY_CHANGE REMOVED_NODE/)
end
it 'notifies registry' do
ip = address.to_s
expect(cluster_registry).to receive(:host_lost).once.with(ip)
connections.first.trigger_event(event)
end
end
end
end
end
describe "#close_async" do
context 'when connected' do
before do
control_connection.connect_async.value
end
it 'closes reactor' do
future = double('close future')
expect(future).to receive(:on_value)
expect(future).to receive(:on_failure)
io_reactor.should_receive(:stop).once.and_return(future)
control_connection.close_async
end
it 'calls close listeners' do
called = false
control_connection.on_close do
called = true
end
expect(io_reactor).to receive(:stop).once.and_return(Ione::Future.resolved)
control_connection.close_async.value
expect(called).to be_truthy
end
end
context 'not connected' do
before do
control_connection.connect_async.value
control_connection.close_async.value
end
it 'returns a fulfilled future' do
future = control_connection.close_async
future.should be_resolved
future.value.should be_nil
end
end
context 'when reconnecting' do
let(:reconnect_interval) { 5 }
let(:reconnection_schedule) { double('reconnection schedule', :next => reconnect_interval) }
before do
reconnection_policy.stub(:schedule) { reconnection_schedule }
control_connection.connect_async.value
cluster_registry.each_host do |host|
io_reactor.node_down(host.ip.to_s)
end
last_connection.close
end
it 'stops reconnecting' do
connections.select(&:connected?).should be_empty
control_connection.close_async
cluster_registry.each_host do |host|
io_reactor.node_up(host.ip.to_s)
end
io_reactor.advance_time(reconnect_interval)
io_reactor.advance_time(reconnect_interval)
connections.select(&:connected?).should be_empty
end
end
end
end
end
end
| 31.982946 | 210 | 0.534878 |
bb29447fc1af081e16f32b085a8e7f2f16628f11 | 2,071 | class Libdap < Formula
desc "Framework for scientific data networking"
homepage "http://www.opendap.org"
url "https://github.com/OPENDAP/libdap4/archive/version-3.18.0.tar.gz"
sha256 "373c60cf2c5c9eaf598558167aedbc3ef9a0d9b652dfbd96b4725637cf03f628"
head "https://github.com/OPENDAP/libdap4.git"
bottle do
sha256 "4c7e4ac48248b98e01434e58b0f4bd49430728494a79a14606c7dc7b36a1214a" => :el_capitan
sha256 "1adc5a6e18823ac189ee748323f6e95160d098faa2ce0f2dec94dc08c9c0afc0" => :yosemite
sha256 "cf167f219d06fe935453d1af606d8d38711c865f541d1f61007cb27f2666bae6" => :mavericks
end
option "without-test", "Skip build-time tests (Not recommended)"
depends_on "pkg-config" => :build
depends_on "bison" => :build
depends_on "automake" => :build
depends_on "autoconf" => :build
depends_on "libtool" => :build
depends_on "libxml2"
depends_on "openssl"
needs :cxx11 if MacOS.version < :mavericks
def install
# NOTE:
# To future maintainers: if you ever want to build this library as a
# universal binary, see William Kyngesburye's notes:
# http://www.kyngchaos.com/macosx/build/dap
# Otherwise, "make check" fails
ENV.cxx11 if MacOS.version < :mavericks
args = %W[
--prefix=#{prefix}
--disable-dependency-tracking
--disable-debug
--with-included-regex
]
# Let's try removing this for OS X > 10.6; old note follows:
# __Always pass the curl prefix!__
# Otherwise, configure will fall back to pkg-config and on Leopard
# and Snow Leopard, the libcurl.pc file that ships with the system
# is seriously broken---too many arch flags. This will be carried
# over to `dap-config` and from there the contamination will spread.
args << "--with-curl=/usr" if MacOS.version <= :snow_leopard
system "autoreconf", "-fvi"
system "./configure", *args
system "make"
system "make", "check" if build.with? "test"
system "make", "install"
end
test do
assert_match version.to_s, shell_output("#{bin}/dap-config --version")
end
end
| 33.95082 | 92 | 0.708353 |
33b73a7b5a18b9a1663272575401def8c40ed3ed | 694 | # == Schema Information
#
# Table name: accounts
#
# id :integer not null, primary key
# type :string default("Account"), not null
# description :string default(""), not null
# currency :string default("USD"), not null
# created_at :datetime not null
# updated_at :datetime not null
# owner_id :integer
# owner_type :string
# standalone :boolean default(FALSE)
#
# Indexes
#
# index_accounts_on_item_id (owner_id)
# index_accounts_on_item_type (owner_type)
# index_accounts_on_type (type)
#
class Account::BountySourceFeesPledge < Account
def self.liability?
false
end
end
| 25.703704 | 61 | 0.62536 |
18fded52a20abb832f6acd5e97dc0203d8e49c86 | 7,229 | require 'concurrent/dereferenceable'
require 'concurrent/atomic/condition'
require 'concurrent/atomic/event'
module Concurrent
# An `MVar` is a synchronized single element container. They are empty or contain one item.
# Taking a value from an empty `MVar` blocks, as does putting a value into a full one.
# You can either think of them as blocking queue of length one, or a special kind of
# mutable variable.
#
# On top of the fundamental `#put` and `#take` operations, we also provide a `#mutate`
# that is atomic with respect to operations on the same instance. These operations all
# support timeouts.
#
# We also support non-blocking operations `#try_put!` and `#try_take!`, a `#set!` that
# ignores existing values, a `#value` that returns the value without removing it or
# returns `MVar::EMPTY`, and a `#modify!` that yields `MVar::EMPTY` if the `MVar` is
# empty and can be used to set `MVar::EMPTY`. You shouldn't use these operations in the
# first instance.
#
# `MVar` is a [Dereferenceable](Dereferenceable).
#
# `MVar` is related to M-structures in Id, `MVar` in Haskell and `SyncVar` in Scala.
#
# Note that unlike the original Haskell paper, our `#take` is blocking. This is how
# Haskell and Scala do it today.
#
# **See Also:**
#
# 1. P. Barth, R. Nikhil, and Arvind. [M-Structures: Extending a parallel, non-
# strict, functional language with state](http://dl.acm.org/citation.cfm?id=652538). In Proceedings of the 5th ACM Conference on Functional Programming Languages and Computer Architecture (FPCA), 1991.
# 2. S. Peyton Jones, A. Gordon, and S. Finne. [Concurrent Haskell](http://dl.acm.org/citation.cfm?id=237794). In Proceedings of the 23rd Symposium on Principles of Programming Languages (PoPL), 1996.
class MVar
include Dereferenceable
# Unique value that represents that an `MVar` was empty
EMPTY = Object.new
# Unique value that represents that an `MVar` timed out before it was able
# to produce a value.
TIMEOUT = Object.new
# Create a new `MVar`, either empty or with an initial value.
#
# @param [Hash] opts the options controlling how the future will be processed
# @option opts [Boolean] :operation (false) when `true` will execute the future on the global
# operation pool (for long-running operations), when `false` will execute the future on the
# global task pool (for short-running tasks)
# @option opts [object] :executor when provided will run all operations on
# this executor rather than the global thread pool (overrides :operation)
# @option opts [String] :dup_on_deref (false) call `#dup` before returning the data
# @option opts [String] :freeze_on_deref (false) call `#freeze` before returning the data
# @option opts [String] :copy_on_deref (nil) call the given `Proc` passing the internal value and
# returning the value returned from the proc
def initialize(value = EMPTY, opts = {})
@value = value
@mutex = Mutex.new
@empty_condition = Condition.new
@full_condition = Condition.new
set_deref_options(opts)
end
# Remove the value from an `MVar`, leaving it empty, and blocking if there
# isn't a value. A timeout can be set to limit the time spent blocked, in
# which case it returns `TIMEOUT` if the time is exceeded.
# @return [Object] the value that was taken, or `TIMEOUT`
def take(timeout = nil)
@mutex.synchronize do
wait_for_full(timeout)
# If we timed out we'll still be empty
if unlocked_full?
value = @value
@value = EMPTY
@empty_condition.signal
apply_deref_options(value)
else
TIMEOUT
end
end
end
# Put a value into an `MVar`, blocking if there is already a value until
# it is empty. A timeout can be set to limit the time spent blocked, in
# which case it returns `TIMEOUT` if the time is exceeded.
# @return [Object] the value that was put, or `TIMEOUT`
def put(value, timeout = nil)
@mutex.synchronize do
wait_for_empty(timeout)
# If we timed out we won't be empty
if unlocked_empty?
@value = value
@full_condition.signal
apply_deref_options(value)
else
TIMEOUT
end
end
end
# Atomically `take`, yield the value to a block for transformation, and then
# `put` the transformed value. Returns the transformed value. A timeout can
# be set to limit the time spent blocked, in which case it returns `TIMEOUT`
# if the time is exceeded.
# @return [Object] the transformed value, or `TIMEOUT`
def modify(timeout = nil)
raise ArgumentError.new('no block given') unless block_given?
@mutex.synchronize do
wait_for_full(timeout)
# If we timed out we'll still be empty
if unlocked_full?
value = @value
@value = yield value
@full_condition.signal
apply_deref_options(value)
else
TIMEOUT
end
end
end
# Non-blocking version of `take`, that returns `EMPTY` instead of blocking.
def try_take!
@mutex.synchronize do
if unlocked_full?
value = @value
@value = EMPTY
@empty_condition.signal
apply_deref_options(value)
else
EMPTY
end
end
end
# Non-blocking version of `put`, that returns whether or not it was successful.
def try_put!(value)
@mutex.synchronize do
if unlocked_empty?
@value = value
@full_condition.signal
true
else
false
end
end
end
# Non-blocking version of `put` that will overwrite an existing value.
def set!(value)
@mutex.synchronize do
old_value = @value
@value = value
@full_condition.signal
apply_deref_options(old_value)
end
end
# Non-blocking version of `modify` that will yield with `EMPTY` if there is no value yet.
def modify!
raise ArgumentError.new('no block given') unless block_given?
@mutex.synchronize do
value = @value
@value = yield value
if unlocked_empty?
@empty_condition.signal
else
@full_condition.signal
end
apply_deref_options(value)
end
end
# Returns if the `MVar` is currently empty.
def empty?
@mutex.synchronize { @value == EMPTY }
end
# Returns if the `MVar` currently contains a value.
def full?
not empty?
end
private
def unlocked_empty?
@value == EMPTY
end
def unlocked_full?
! unlocked_empty?
end
def wait_for_full(timeout)
wait_while(@full_condition, timeout) { unlocked_empty? }
end
def wait_for_empty(timeout)
wait_while(@empty_condition, timeout) { unlocked_full? }
end
def wait_while(condition, timeout)
remaining = Condition::Result.new(timeout)
while yield && remaining.can_wait?
remaining = condition.wait(@mutex, remaining.remaining_time)
end
end
end
end
| 33.16055 | 203 | 0.650989 |
e21999b7319d5d93641974bb986386419850f113 | 703 | require_relative '../rspec_helper'
describe Nfe::NaturalPeople do
before(:each) do
Nfe.api_key('e12cmDevG5iLhSd9Y7BOpxynL86Detjd2R1D5jsP5UGXA8gwxug0Vojl3H9TIzBpbhI')
Nfe::NaturalPeople.company_id("55e8a2c9440c3b0b84ceaa12")
end
it 'should list all NaturalPeople' do
natural_peoples_list = Nfe::NaturalPeople.list_all
expect(natural_peoples_list.object).to eq('list')
expect(natural_peoples_list.data.size).to be >= 1
end
it 'should retrieve a NaturalPeople' do
natural_people = Nfe::NaturalPeople.retrieve("55eeebf8440c3b0b84ceb1a8")
expect(natural_people.id).to eq("55eeebf8440c3b0b84ceb1a8")
expect(natural_people.name).to eq("Ricardo Caldeira")
end
end
| 33.47619 | 86 | 0.775249 |
018126ba72a7bc4badcee9a2c316f13b44ca71f2 | 77 | Delayed::Worker.destroy_failed_jobs = false
Delayed::Worker.max_attempts = 2
| 25.666667 | 43 | 0.818182 |
5df96f0445238273bfd64c6522991af8eb53a1e7 | 3,350 | # Copyright 2011-2013 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file 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 'spec_helper'
module AWS
class EC2
describe CustomerGatewayCollection do
it_should_behave_like "an ec2 model object", {}
it_should_behave_like "ec2 collection object" do
let(:member_class) { CustomerGateway }
let(:client_method) { :describe_customer_gateways }
def stub_two_members(resp)
resp.data[:customer_gateway_set] = [
{
:customer_gateway_id => 'cgw-1',
:state => 'available',
:vpn_type => 'ipsec.1',
:bgp_asn => 65534,
},{
:customer_gateway_id => 'cgw-2',
:state => 'pending',
:vpn_type => 'ipsec.1',
:bgp_asn => 65535,
},
]
end
it_should_behave_like "a tagged ec2 collection"
it_should_behave_like "ec2 collection array access"
let(:customer_gateways) { collection }
context '#each' do
it 'yields route tables' do
gateways = collection.to_a
gateways.each{|t| t.should be_a(CustomerGateway) }
gateways.map(&:id).should == %w(cgw-1 cgw-2)
end
end
context '#[]' do
it 'returns a customer gateway with the correct config' do
gateway = customer_gateways['cgw-123']
gateway.should be_a(CustomerGateway)
gateway.id.should == 'cgw-123'
gateway.config.should == config
end
end
context '#create' do
let(:details) {{
:customer_gateway_id => 'cgw-123',
:bgp_asn => 65432,
:ip_address => '1.2.3.4',
:vpn_type => 'ipsec.1',
:state => 'available',
}}
let(:response) { client.stub_for(:create_customer_gateway) }
before(:each) do
response.data[:customer_gateway] = details
client.stub(:create_customer_gateway).and_return(response)
end
it 'calls #create_customer_gateway on the client' do
client.should_receive(:create_customer_gateway).with(
:bgp_asn => 65432,
:public_ip => '1.2.3.4',
:type => 'ipsec.1'
).and_return(response)
customer_gateways.create(65432, '1.2.3.4')
end
it 'returns a customer gateway object' do
cgw = customer_gateways.create(65432, '1.2.3.4')
cgw.should be_a(CustomerGateway)
cgw.customer_gateway_id.should == 'cgw-123'
cgw.bgp_asn.should == 65432
cgw.ip_address.should == '1.2.3.4'
cgw.vpn_type.should == 'ipsec.1'
cgw.config.should == config
end
end
end
end
end
end
| 29.130435 | 78 | 0.570149 |
21de45ba714a800fe9d0c761f924a9f046f2d6e3 | 1,321 | # frozen_string_literal: true
require_relative "support/simplecov"
require "spec_helper"
ENV["RAILS_ENV"] ||= "test"
require_relative "../config/environment"
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
require "rspec/rails"
require "faker"
# Add additional requires below this line. Rails is not loaded until this point!
# Checks for pending migrations and applies them before tests are run.
# If you are not using ActiveRecord, you can remove these lines.
begin
ActiveRecord::Migration.maintain_test_schema!
rescue ActiveRecord::PendingMigrationError => e
puts e.to_s.strip
exit 1
end
RSpec.configure do |config|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
config.use_transactional_fixtures = true
config.infer_spec_type_from_file_location!
config.filter_rails_from_backtrace!
config.include FactoryBot::Syntax::Methods
config.before(:suite) do
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with(:truncation)
end
config.around(:each) do |example|
DatabaseCleaner.cleaning do
example.run
end
end
end
Shoulda::Matchers.configure do |config|
config.integrate do |with|
with.test_framework :rspec
with.library :rails
end
end
| 26.42 | 86 | 0.770628 |
1cb3b157f0abbf835f7b6a809e057b3e5f12f05f | 3,483 | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# This cop looks for trailing blank lines and a final newline in the
# source code.
#
# @example EnforcedStyle: final_blank_line
# # `final_blank_line` looks for one blank line followed by a new line
# # at the end of files.
#
# # bad
# class Foo; end
# # EOF
#
# # bad
# class Foo; end # EOF
#
# # good
# class Foo; end
#
# # EOF
#
# @example EnforcedStyle: final_newline (default)
# # `final_newline` looks for one newline at the end of files.
#
# # bad
# class Foo; end
#
# # EOF
#
# # bad
# class Foo; end # EOF
#
# # good
# class Foo; end
# # EOF
#
class TrailingBlankLines < Cop
include ConfigurableEnforcedStyle
include RangeHelp
def investigate(processed_source)
buffer = processed_source.buffer
return if buffer.source.empty?
# The extra text that comes after the last token could be __END__
# followed by some data to read. If so, we don't check it because
# there could be good reasons why it needs to end with a certain
# number of newlines.
return if ends_in_end?(processed_source)
whitespace_at_end = buffer.source[/\s*\Z/]
blank_lines = whitespace_at_end.count("\n") - 1
wanted_blank_lines = style == :final_newline ? 0 : 1
return unless blank_lines != wanted_blank_lines
offense_detected(buffer, wanted_blank_lines, blank_lines,
whitespace_at_end)
end
def autocorrect(range)
lambda do |corrector|
corrector.replace(range, style == :final_newline ? "\n" : "\n\n")
end
end
private
def offense_detected(buffer, wanted_blank_lines, blank_lines,
whitespace_at_end)
begin_pos = buffer.source.length - whitespace_at_end.length
autocorrect_range = range_between(begin_pos, buffer.source.length)
begin_pos += 1 unless whitespace_at_end.empty?
report_range = range_between(begin_pos, buffer.source.length)
add_offense(autocorrect_range,
location: report_range,
message: message(wanted_blank_lines, blank_lines))
end
def ends_in_end?(processed_source)
buffer = processed_source.buffer
return true if buffer.source.strip.start_with?('__END__')
return false if processed_source.tokens.empty?
extra = buffer.source[processed_source.tokens.last.end_pos..-1]
extra&.strip&.start_with?('__END__')
end
def message(wanted_blank_lines, blank_lines)
case blank_lines
when -1
'Final newline missing.'
when 0
'Trailing blank line missing.'
else
instead_of = if wanted_blank_lines.zero?
''
else
"instead of #{wanted_blank_lines} "
end
format('%<current>d trailing blank lines %<prefer>sdetected.',
current: blank_lines, prefer: instead_of)
end
end
end
end
end
end
| 30.552632 | 78 | 0.559288 |
4a3778a0ac271479ad83d6a9cb2f753b33864de1 | 81 | class Clue < ActiveRecord::Base
belongs_to :game_board
belongs_to :place
end
| 16.2 | 31 | 0.777778 |
ed76f1b385e8c17c9ed8f08c3b6d04d2f9524f1f | 5,184 | #
# Be sure to run `pod spec lint ALTimer.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 https://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
#
Pod::Spec.new do |spec|
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# These will help people to find your library, and whilst it
# can feel like a chore to fill in it's definitely to your advantage. The
# summary should be tweet-length, and the description more in depth.
#
spec.name = "ALTimer"
spec.version = "1.0.0"
spec.summary = "A autoRelease Timer."
# 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!
spec.description = <<-DESC
This is a simple timer with a autorelease timer .
DESC
spec.homepage = "https://github.com/hy15816/ALTimer"
# spec.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"
# ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Licensing your code is important. See https://choosealicense.com for more info.
# CocoaPods will detect a license file if there is a named LICENSE*
# Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'.
#
spec.license = "MIT"
# spec.license = { :type => "MIT", :file => "FILE_LICENSE" }
# ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Specify the authors of the library, with email addresses. Email addresses
# of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also
# accepts just a name if you'd rather not provide an email address.
#
# Specify a social_media_url where others can refer to, for example a twitter
# profile URL.
#
spec.author = { "Lost-souls" => "[email protected]" }
# Or just: spec.author = "Lost-souls"
# spec.authors = { "Lost-souls" => "[email protected]" }
# spec.social_media_url = "https://twitter.com/Lost-souls"
# ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# If this Pod runs only on iOS or OS X, then specify the platform and
# the deployment target. You can optionally include the target after the platform.
#
# spec.platform = :ios
spec.platform = :ios, "8.0"
# When using multiple platforms
# spec.ios.deployment_target = "5.0"
# spec.osx.deployment_target = "10.7"
# spec.watchos.deployment_target = "2.0"
# spec.tvos.deployment_target = "9.0"
# ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Specify the location from where the source should be retrieved.
# Supports git, hg, bzr, svn and HTTP.
#
spec.source = { :git => "https://github.com/hy15816/ALTimer.git", :tag => "#{spec.version}" }
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# CocoaPods is smart about how it includes source code. For source files
# giving a folder will include any swift, h, m, mm, c & cpp files.
# For header files it will include any header in the folder.
# Not including the public_header_files will make all headers public.
#
spec.source_files = "ALTimer/*"
# spec.exclude_files = "Classes/Exclude"
# spec.public_header_files = "Classes/**/*.h"
# ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# A list of resources included with the Pod. These are copied into the
# target bundle with a build phase script. Anything else will be cleaned.
# You can preserve files from being cleaned, please don't preserve
# non-essential files like tests, examples and documentation.
#
# spec.resource = "icon.png"
# spec.resources = "Resources/*.png"
# spec.preserve_paths = "FilesToSave", "MoreFilesToSave"
# ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Link your library with frameworks, or libraries. Libraries do not include
# the lib prefix of their name.
#
# spec.framework = "SomeFramework"
# spec.frameworks = "SomeFramework", "AnotherFramework"
# spec.library = "iconv"
# spec.libraries = "iconv", "xml2"
# ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# If your library depends on compiler flags you can set them in the xcconfig hash
# where they will only apply to your library. If you depend on other Podspecs
# you can include multiple dependencies to ensure it works.
spec.requires_arc = true
# spec.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
# spec.dependency "JSONKit", "~> 1.4"
end
| 37.294964 | 101 | 0.597222 |
e9e787fe8c64ad343776f2d8458b1bbb6a1559bc | 235 | Two sparse right-hand sides for a five by five matrix EXAMPLE3
rhsrs SPARS_R2 r 5 2 3
(5I5) (5I5) (5E10.1)
1 3 4
3 4 5
3.0 4.0 1.0 | 39.166667 | 72 | 0.387234 |
1830a8d657c35d5e60940233d5a24055fc86d5b6 | 1,015 | # frozen_string_literal: true
require 'capybara/selenium/extensions/html5_drag'
class Capybara::Selenium::ChromeNode < Capybara::Selenium::Node
include Html5Drag
def set_text(value, clear: nil, **_unused)
super.tap do
# React doesn't see the chromedriver element clear
send_keys(:space, :backspace) if value.to_s.empty? && clear.nil?
end
end
def set_file(value) # rubocop:disable Naming/AccessorMethodName
super(value)
rescue *file_errors => err
if err.message =~ /File not found : .+\n.+/m
raise ArgumentError, "Selenium < 3.14 with remote Chrome doesn't support multiple file upload" if e.message.match?(/File not found : .+\n.+/m)
end
raise
end
def drag_to(element)
return super unless html5_draggable?
html5_drag_to(element)
end
private
def file_errors
::Selenium::WebDriver.logger.suppress_deprecations do
[::Selenium::WebDriver::Error::ExpectedError]
end
end
def bridge
driver.browser.send(:bridge)
end
end
| 23.604651 | 148 | 0.703448 |
03e3429f6cb42ccb9d703222164bb5f91054811a | 651 | Pod::Spec.new do |s|
s.name = 'Godzippa'
s.version = '2.1.1'
s.license = 'MIT'
s.summary = 'GZip Compression / Decompression Category for NSData and NSFileManager.'
s.homepage = 'https://github.com/mattt/Godzippa'
s.social_media_url = 'https://twitter.com/mattt'
s.author = { 'Mattt' => '[email protected]' }
s.source = { git: 'https://github.com/mattt/Godzippa.git',
tag: s.version }
s.source_files = 'Sources/*.{h,m}'
s.requires_arc = true
s.ios.deployment_target = '6.0'
s.osx.deployment_target = '10.8'
s.watchos.deployment_target = '2.0'
s.tvos.deployment_target = '9.0'
s.library = 'z'
end
| 31 | 88 | 0.632873 |
acb6baf4329682e0541584db806d3658d16489bc | 1,568 | require File.dirname(__FILE__) + '/../abstract_unit'
class RangeTest < Test::Unit::TestCase
def test_to_s_from_dates
date_range = Date.new(2005, 12, 10)..Date.new(2005, 12, 12)
assert_equal "BETWEEN '2005-12-10' AND '2005-12-12'", date_range.to_s(:db)
end
def test_to_s_from_times
date_range = Time.utc(2005, 12, 10, 15, 30)..Time.utc(2005, 12, 10, 17, 30)
assert_equal "BETWEEN '2005-12-10 15:30:00' AND '2005-12-10 17:30:00'", date_range.to_s(:db)
end
def test_overlaps_last_inclusive
assert((1..5).overlaps?(5..10))
end
def test_overlaps_last_exclusive
assert !(1...5).overlaps?(5..10)
end
def test_overlaps_first_inclusive
assert((5..10).overlaps?(1..5))
end
def test_overlaps_first_exclusive
assert !(5..10).overlaps?(1...5)
end
def test_should_include_identical_inclusive
assert((1..10).include?(1..10))
end
def test_should_include_identical_exclusive
assert((1...10).include?(1...10))
end
def test_should_include_other_with_exlusive_end
assert((1..10).include?(1...10))
end
def test_exclusive_end_should_not_include_identical_with_inclusive_end
assert !(1...10).include?(1..10)
end
def test_should_not_include_overlapping_first
assert !(2..8).include?(1..3)
end
def test_should_not_include_overlapping_last
assert !(2..8).include?(5..9)
end
def test_blockless_step
assert_equal [1,3,5,7,9], (1..10).step(2)
end
def test_original_step
array = []
(1..10).step(2) {|i| array << i }
assert_equal [1,3,5,7,9], array
end
end
| 24.5 | 96 | 0.686224 |
abe51121c987094674ee8fb84f1f43adc29760bc | 9,788 | RSpec.describe Sentry do
before do
perform_basic_setup
end
let(:event) do
Sentry::Event.new(configuration: Sentry::Configuration.new)
end
let(:transport) do
Sentry.get_current_client.transport
end
describe ".init" do
context "with block argument" do
it "initializes the current hub and main hub" do
described_class.init do |config|
config.dsn = DUMMY_DSN
end
current_hub = described_class.get_current_hub
expect(current_hub).to be_a(Sentry::Hub)
expect(current_hub.current_scope).to be_a(Sentry::Scope)
expect(subject.get_main_hub).to eq(current_hub)
end
end
context "without block argument" do
it "initializes the current hub and main hub" do
ENV['SENTRY_DSN'] = DUMMY_DSN
described_class.init
current_hub = described_class.get_current_hub
expect(current_hub).to be_a(Sentry::Hub)
expect(current_hub.current_scope).to be_a(Sentry::Scope)
expect(subject.get_main_hub).to eq(current_hub)
end
end
it "initializes Scope with correct max_breadcrumbs" do
described_class.init do |config|
config.max_breadcrumbs = 1
end
current_scope = described_class.get_current_scope
expect(current_scope.breadcrumbs.buffer.size).to eq(1)
end
end
describe "#clone_hub_to_current_thread" do
it "clones a new hub to the current thread" do
main_hub = described_class.get_main_hub
new_thread = Thread.new do
described_class.clone_hub_to_current_thread
thread_hub = described_class.get_current_hub
expect(thread_hub).to be_a(Sentry::Hub)
expect(thread_hub).not_to eq(main_hub)
expect(thread_hub.current_client).to eq(main_hub.current_client)
expect(described_class.get_main_hub).to eq(main_hub)
end
new_thread.join
end
it "stores the hub in a thread variable (instead of just fiber variable)" do
Sentry.set_tags(outside_fiber: true)
fiber = Fiber.new do
Sentry.set_tags(inside_fiber: true)
end
fiber.resume
expect(Sentry.get_current_scope.tags).to eq({ outside_fiber: true, inside_fiber: true })
end
end
describe ".configure_scope" do
it "yields the current hub's scope" do
scope = nil
described_class.configure_scope { |s| scope = s }
expect(scope).to eq(described_class.get_current_hub.current_scope)
end
end
shared_examples "capture_helper" do
context "without any Sentry setup" do
before do
allow(Sentry).to receive(:get_main_hub)
allow(Sentry).to receive(:get_current_hub)
end
it "doesn't cause any issue" do
described_class.send(capture_helper, capture_subject)
end
end
context "with sending_allowed? condition" do
before do
expect(Sentry.configuration).to receive(:sending_allowed?).and_return(false)
end
it "doesn't send the event nor assign last_event_id" do
described_class.send(capture_helper, capture_subject)
expect(transport.events).to be_empty
expect(subject.last_event_id).to eq(nil)
end
end
context "when rate limited" do
let(:string_io) { StringIO.new }
before do
perform_basic_setup do |config|
config.logger = Logger.new(string_io)
config.transport.transport_class = Sentry::HTTPTransport
end
Sentry.get_current_client.transport.rate_limits.merge!("error" => Time.now + 100)
end
it "stops the event and logs correct message" do
described_class.send(capture_helper, capture_subject)
expect(string_io.string).to match(/Envelope \[event\] not sent: rate limiting/)
end
end
end
describe ".send_event" do
let(:event) { Sentry.get_current_client.event_from_message("test message") }
before do
Sentry.configuration.before_send = lambda do |event, hint|
event.tags[:hint] = hint
event
end
end
it "sends the event" do
described_class.send_event(event)
expect(transport.events.count).to eq(1)
end
it "sends the event with hint" do
described_class.send_event(event, { foo: "bar" })
expect(transport.events.count).to eq(1)
event = transport.events.last
expect(event.tags[:hint][:foo]).to eq("bar")
end
end
describe ".capture_event" do
it_behaves_like "capture_helper" do
let(:capture_helper) { :capture_event }
let(:capture_subject) { event }
end
it "sends the event via current hub" do
expect do
described_class.capture_event(event)
end.to change { transport.events.count }.by(1)
end
end
describe ".capture_exception" do
let(:exception) { ZeroDivisionError.new("divided by 0") }
it_behaves_like "capture_helper" do
let(:capture_helper) { :capture_exception }
let(:capture_subject) { exception }
end
it "sends the exception via current hub" do
expect do
described_class.capture_exception(exception, tags: { foo: "baz" })
end.to change { transport.events.count }.by(1)
end
it "doesn't do anything if the exception is excluded" do
Sentry.get_current_client.configuration.excluded_exceptions = ["ZeroDivisionError"]
result = described_class.capture_exception(exception)
expect(result).to eq(nil)
end
end
describe ".capture_message" do
let(:message) { "Test" }
it_behaves_like "capture_helper" do
let(:capture_helper) { :capture_message }
let(:capture_subject) { message }
end
it "sends the message via current hub" do
expect do
described_class.capture_message("Test", tags: { foo: "baz" })
end.to change { transport.events.count }.by(1)
end
end
describe ".start_transaction" do
context "when tracing is enabled" do
before do
Sentry.configuration.traces_sample_rate = 1.0
end
it "starts a new transaction" do
transaction = described_class.start_transaction(op: "foo")
expect(transaction).to be_a(Sentry::Transaction)
expect(transaction.op).to eq("foo")
end
context "when given an transaction object" do
it "adds sample decision to it" do
transaction = Sentry::Transaction.new(hub: Sentry.get_current_hub)
described_class.start_transaction(transaction: transaction)
expect(transaction.sampled).to eq(true)
end
it "provides proper sampling context to the traces_sampler" do
transaction = Sentry::Transaction.new(op: "foo", hub: Sentry.get_current_hub)
context = nil
Sentry.configuration.traces_sampler = lambda do |sampling_context|
context = sampling_context
end
described_class.start_transaction(transaction: transaction)
expect(context[:parent_sampled]).to be_nil
expect(context[:transaction_context][:op]).to eq("foo")
end
it "passes parent_sampled to the sampling_context" do
transaction = Sentry::Transaction.new(parent_sampled: true, hub: Sentry.get_current_hub)
context = nil
Sentry.configuration.traces_sampler = lambda do |sampling_context|
context = sampling_context
end
described_class.start_transaction(transaction: transaction)
expect(context[:parent_sampled]).to eq(true)
end
end
context "when given a custom_sampling_context" do
it "takes that into account" do
context = nil
Sentry.configuration.traces_sampler = lambda do |sampling_context|
context = sampling_context
end
described_class.start_transaction(custom_sampling_context: { foo: "bar" })
expect(context).to include({ foo: "bar" })
end
end
end
context "when tracing is disabled" do
it "returns nil" do
expect(described_class.start_transaction(op: "foo")).to eq(nil)
end
end
end
describe ".last_event_id" do
it "gets the last_event_id from current_hub" do
expect(described_class.get_current_hub).to receive(:last_event_id)
described_class.last_event_id
end
end
describe ".add_breadcrumb" do
it "adds breadcrumb to the current scope" do
crumb = Sentry::Breadcrumb.new(message: "foo")
described_class.add_breadcrumb(crumb)
expect(described_class.get_current_scope.breadcrumbs.peek).to eq(crumb)
end
it "triggers before_breadcrumb callback" do
Sentry.configuration.before_breadcrumb = lambda do |breadcrumb, hint|
nil
end
crumb = Sentry::Breadcrumb.new(message: "foo")
described_class.add_breadcrumb(crumb)
expect(described_class.get_current_scope.breadcrumbs.peek).to eq(nil)
end
end
describe ".set_tags" do
it "adds tags to the current scope" do
described_class.set_tags(foo: "bar")
expect(described_class.get_current_scope.tags).to eq(foo: "bar")
end
end
describe ".set_extras" do
it "adds extras to the current scope" do
described_class.set_extras(foo: "bar")
expect(described_class.get_current_scope.extra).to eq(foo: "bar")
end
end
describe ".set_context" do
it "adds context to the current scope" do
described_class.set_context("character", { name: "John", age: 25 })
expect(described_class.get_current_scope.contexts).to include("character" => { name: "John", age: 25 })
end
end
describe ".set_user" do
it "adds user to the current scope" do
described_class.set_user(id: 1)
expect(described_class.get_current_scope.user).to eq(id: 1)
end
end
end
| 28.703812 | 109 | 0.670719 |
7ad48b027f20772175bda703fbe499884aaceaee | 4,721 | # encoding: utf-8
require 'openssl'
require 'hashie/mash'
require 'utils/file_reader'
module Inspec::Resources
class X509CertificateResource < Inspec.resource(1)
name 'x509_certificate'
supports platform: 'unix'
supports platform: 'windows'
desc 'Used to test x.509 certificates'
example "
describe x509_certificate('/etc/pki/www.mywebsite.com.pem') do
its('subject') { should match /CN=My Website/ }
its('validity_in_days') { should be > 30 }
end
describe x509_certificate('trials/x509/cert.pem') do
it { should be_certificate }
it { should be_valid }
its('fingerprint') { should eq '62b137bdf427e7273dc2e487877b3033e4c8ce17' }
its('signature_algorithm') { should eq 'sha1WithRSAEncryption' }
its('validity_in_days') { should_not be < 100 }
its('validity_in_days') { should be >= 100 }
its('subject_dn') { should eq '/C=DE/ST=Berlin/L=Berlin/O=InSpec/OU=Chef Software, Inc/CN=inspec.io/[email protected]' }
its('subject.C') { should eq 'DE' }
its('subject.emailAddress') { should_not be_empty }
its('subject.emailAddress') { should eq '[email protected]' }
its('issuer_dn') { should eq '/C=DE/ST=Berlin/L=Berlin/O=InSpec/OU=Chef Software, Inc/CN=inspec.io/[email protected]' }
its('key_length') { should be >= 2048 }
its('extensions.subjectKeyIdentifier') { should cmp 'A5:16:0B:12:F4:48:0F:06:6C:32:29:67:98:12:DF:3D:0D:75:9D:5C' }
end
"
include FileReader
# @see https://tools.ietf.org/html/rfc5280#page-23
def initialize(filename)
@certpath = filename
@issuer = nil
@parsed_subject = nil
@parsed_issuer = nil
@extensions = nil
@cert = OpenSSL::X509::Certificate.new read_file_content(@certpath)
end
# Forward these methods directly to OpenSSL::X509::Certificate instance
%w{version not_before not_after signature_algorithm public_key}.each do |m|
define_method m.to_sym do |*args|
@cert.method(m.to_sym).call(*args)
end
end
def certificate?
[email protected]?
end
def fingerprint
return if @cert.nil?
OpenSSL::Digest::SHA1.new(@cert.to_der).to_s
end
def serial
return if @cert.nil?
@cert.serial.to_i
end
def subject_dn
return if @cert.nil?
@cert.subject.to_s
end
def subject
return if @cert.nil?
# Return cached subject if we have already parsed it
return @parsed_subject if @parsed_subject
# Use a Mash to make it easier to access hash elements in "its('subject') {should ...}"
@parsed_subject = Hashie::Mash.new(Hash[@cert.subject.to_a.map { |k, v, _| [k, v] }])
end
def issuer_dn
return if @cert.nil?
@cert.issuer.to_s
end
def issuer
return if @cert.nil?
# Return cached subject if we have already parsed it
return @parsed_issuer if @parsed_issuer
# Use a Mash to make it easier to access hash elements in "its('issuer') {should ...}"
@parsed_issuer = Hashie::Mash.new(Hash[@cert.issuer.to_a.map { |k, v, _| [k, v] }])
end
def key_length
return if @cert.nil?
@cert.public_key.n.num_bytes * 8
end
def validity_in_days
(not_after - Time.now.utc) / 86400
end
def valid?
now = Time.now
certificate? && (now >= not_before && now <= not_after)
end
def extensions
# Return cached Mash if we already parsed the certificate extensions
return @extensions if @extensions
# Return the exception class if we failed to instantiate a Cert from file
return @cert unless @cert.respond_to? :extensions
# Use a Mash to make it easier to access hash elements in "its('entensions') {should ...}"
@extensions = Hashie::Mash.new({})
# Make sure standard extensions exist so we don't get nil for nil:NilClass
# when the user tests for extensions which aren't present
%w{
keyUsage extendedKeyUsage basicConstraints subjectKeyIdentifier
authorityKeyIdentifier subjectAltName issuerAltName authorityInfoAccess
crlDistributionPoints issuingDistributionPoint certificatePolicies
policyConstraints nameConstraints noCheck tlsfeature nsComment
}.each { |extension| @extensions[extension] ||= [] }
# Now parse the extensions into the Mash
extension_array = @cert.extensions.map(&:to_s)
extension_array.each do |extension|
kv = extension.split(/ *= */, 2)
@extensions[kv.first] = kv.last.split(/ *, */)
end
@extensions
end
def to_s
"x509_certificate #{@certpath}"
end
end
end
| 34.210145 | 139 | 0.651769 |
e8fc0f5f04890a88c5f681fdb594923e832ed04f | 930 | # -*- ruby -*-
# frozen_string_literal: true
require 'observability' unless defined?( Observability )
# A mixin that allows events to be created for any current observers at runtime.
module Observability::ObserverHooks
### Create an event at the current point of execution, make it the innermost
### context, then yield to the method's block. Finish the event when the yield
### returns, handling exceptions that are being raised automatically.
def observe( detail, **options, &block )
if block
marker = Observability.observer.event( [block, detail], **options )
Observability.observer.finish_after_block( marker, &block )
else
Loggability[ Observability ].warn "No block given for %p -> %p with options: %p" %
[ self, detail, options ]
end
end
### Return the current Observability observer agent.
def observability
return Observability.observer
end
end # module Observability::ObserverHooks
| 29.0625 | 85 | 0.73871 |
bbb4c63ba0694be933dc5d4d9289fbf078650834 | 1,197 | Puppet::Type.newtype(:swift_container_sync_realms_config) do
ensurable
newparam(:name, :namevar => true) do
desc 'Section/setting name to manage from /etc/swift/container-sync-realms.conf'
newvalues(/\S+\/\S+/)
end
newproperty(:value) do
desc 'The value of the setting to be defined.'
munge do |value|
value = value.to_s.strip
value.capitalize! if value =~ /^(true|false)$/i
value
end
newvalues(/^[\S ]*$/)
def is_to_s( currentvalue )
if resource.secret?
return '[old secret redacted]'
else
return currentvalue
end
end
def should_to_s( newvalue )
if resource.secret?
return '[new secret redacted]'
else
return newvalue
end
end
end
newparam(:secret, :boolean => true) do
desc 'Whether to hide the value from Puppet logs. Defaults to `false`.'
newvalues(:true, :false)
defaultto false
end
newparam(:ensure_absent_val) do
desc 'A value that is specified as the value property will behave as if ensure => absent was specified'
defaultto('<SERVICE DEFAULT>')
end
autorequire(:anchor) do
['swift::install::end']
end
end
| 22.166667 | 107 | 0.640769 |
339f484caebe2292daaab97404776b1120e59b64 | 158 | require 'spec_helper'
describe Chatter::Config do
it 'should specify a default robot' do
expect(Chatter::Default.bot).to be_an(Bots::Clever)
end
end
| 19.75 | 55 | 0.740506 |
5d5c77bfa71e6ab909f143508ab23ee70f3fbf60 | 7,823 | require_relative "./table"
require_relative "./inline"
module IsoDoc
module WordFunction
module Body
def define_head(head, filename, _dir)
head.style do |style|
loc = File.join(File.dirname(__FILE__), "..", "base_style",
"metanorma_word.scss")
stylesheet = File.read(loc, encoding: "utf-8")
style.comment "\n#{stylesheet}\n"
end
super
end
def body_attr
{ lang: "EN-US", link: "blue", vlink: "#954F72" }
end
def make_body1(body, _docxml)
body.div **{ class: "WordSection1" } do |div1|
div1.p { |p| p << " " } # placeholder
end
section_break(body)
end
def make_body2(body, docxml)
body.div **{ class: "WordSection2" } do |div2|
boilerplate docxml, div2
preface_block docxml, div2
abstract docxml, div2
foreword docxml, div2
introduction docxml, div2
preface docxml, div2
acknowledgements docxml, div2
div2.p { |p| p << " " } # placeholder
end
section_break(body)
end
def make_body3(body, docxml)
body.div **{ class: "WordSection3" } do |div3|
middle docxml, div3
footnotes div3
comments div3
end
end
def insert_tab(out, count)
out.span **attr_code(style: "mso-tab-count:#{count}") do |span|
[1..count].each { span << "  " }
end
end
def para_class(_node)
return "Sourcecode" if @annotation
return "MsoCommentText" if @in_comment
return "Note" if @note
nil
end
def para_parse(node, out)
out.p **attr_code(para_attrs(node)) do |p|
unless @termdomain.empty?
p << "<#{@termdomain}> "
@termdomain = ""
end
node.children.each { |n| parse(n, p) unless n.name == "note" }
end
node.xpath(ns("./note")).each { |n| parse(n, out) }
end
WORD_DT_ATTRS = { class: @note ? "Note" : nil, align: "left",
style: "margin-left:0pt;text-align:left;" }.freeze
def dt_parse(dterm, term)
term.p **attr_code(WORD_DT_ATTRS) do |p|
if dterm.elements.empty?
p << dterm.text
else
dterm.children.each { |n| parse(n, p) }
end
end
end
def dl_parse(node, out)
return super unless node.ancestors("table, dl").empty?
dl_parse_table(node, out)
end
def dl_parse_table(node, out)
list_title_parse(node, out)
out.table **{ class: "dl" } do |v|
node.elements.select { |n| dt_dd?(n) }
.each_slice(2) do |dt, dd|
dl_parse_table1(v, dt, dd)
end
dl_parse_notes(node, v)
end
end
def dl_parse_table1(table, dterm, ddefn)
table.tr do |tr|
tr.td **{ valign: "top", align: "left" } do |term|
dt_parse(dterm, term)
end
tr.td **{ valign: "top" } do |listitem|
ddefn.children.each { |n| parse(n, listitem) }
end
end
end
def dl_parse_notes(node, out)
remainder = node.elements.reject { |n| dt_dd?(n) || n.name == "name" }
return if remainder.empty?
out.tr do |tr|
tr.td **{ colspan: 2 } do |td|
remainder.each { |n| parse(n, td) }
end
end
end
def figure_get_or_make_dl(node)
dl = node.at(".//table[@class = 'dl']")
if dl.nil?
node.add_child("<p><b>#{@i18n.key}</b></p><table class='dl'></table>")
dl = node.at(".//table[@class = 'dl']")
end
dl
end
# get rid of footnote link, it is in diagram
def figure_aside_process(fig, aside, key)
fig&.at("./a[@class='TableFootnoteRef']")&.remove
fnref = fig.at(".//span[@class='TableFootnoteRef']/..")
tr = key.add_child("<tr></tr>").first
dt = tr.add_child("<td valign='top' align='left'></td>").first
dd = tr.add_child("<td valign='top'></td>").first
fnref.parent = dt
aside.xpath(".//p").each do |a|
a.delete("class")
a.parent = dd
end
end
def note_p_parse(node, div)
name = node&.at(ns("./name"))&.remove
div.p **{ class: "Note" } do |p|
p.span **{ class: "note_label" } do |s|
name&.children&.each { |n| parse(n, s) }
end
insert_tab(p, 1)
node.first_element_child.children.each { |n| parse(n, p) }
end
node.element_children[1..-1].each { |n| parse(n, div) }
end
def note_parse1(node, div)
name = node&.at(ns("./name"))&.remove
div.p **{ class: "Note" } do |p|
p.span **{ class: "note_label" } do |s|
name&.children&.each { |n| parse(n, s) }
end
insert_tab(p, 1)
end
node.children.each { |n| parse(n, div) }
end
def termnote_parse(node, out)
name = node&.at(ns("./name"))&.remove
out.div **note_attrs(node) do |div|
div.p **{ class: "Note" } do |p|
if name
name.children.each { |n| parse(n, p) }
p << l10n(": ")
end
para_then_remainder(node.first_element_child, node, p, div)
end
end
end
def para_attrs(node)
attrs = { class: para_class(node), id: node["id"], style: "" }
unless node["align"].nil?
attrs[:align] = node["align"] unless node["align"] == "justify"
attrs[:style] += "text-align:#{node['align']};"
end
attrs[:style] += keep_style(node).to_s
attrs[:style] = nil if attrs[:style].empty?
attrs
end
def example_table_attr(node)
super.merge(
style: "mso-table-lspace:15.0cm;margin-left:423.0pt;"\
"mso-table-rspace:15.0cm;margin-right:423.0pt;"\
"mso-table-anchor-horizontal:column;"\
"mso-table-overlap:never;border-collapse:collapse;"\
"#{keep_style(node)}",
)
end
def formula_where(deflist, out)
return unless deflist
out.p { |p| p << @i18n.where }
parse(deflist, out)
t = out.parent.at("./table") and t["class"] = "formula_dl"
end
def formula_parse1(node, out)
out.div **attr_code(class: "formula") do |div|
div.p do |_p|
parse(node.at(ns("./stem")), div)
insert_tab(div, 1)
if lbl = node&.at(ns("./name"))&.text
div << "(#{lbl})"
end
end
end
end
def li_parse(node, out)
out.li **attr_code(id: node["id"]) do |li|
if node["uncheckedcheckbox"] == "true"
li << '<span class="zzMoveToFollowing">☐ </span>'
elsif node["checkedcheckbox"] == "true"
li << '<span class="zzMoveToFollowing">☑ </span>'
end
node.children.each { |n| parse(n, li) }
end
end
def suffix_url(url)
return url if url.nil? || %r{^https?://|^#}.match?(url)
return url unless File.extname(url).empty?
url.sub(/#{File.extname(url)}$/, ".doc")
end
def info(isoxml, out)
@tocfigurestitle =
isoxml&.at(ns("//misc-container/toc[@type = 'figure']/title"))&.text
@toctablestitle =
isoxml&.at(ns("//misc-container/toc[@type = 'table']/title"))&.text
@tocrecommendationstitle = isoxml
&.at(ns("//misc-container/toc[@type = 'recommendation']/title"))&.text
super
end
end
end
end
| 30.439689 | 80 | 0.509907 |
9146a52634e9cb92eb8851f78c9306e8a27d2dfd | 446 | # -*- coding: utf-8 -*-
module DataMapper
module Validations
module Fixtures
class Pirogue
#
# Behaviors
#
include DataMapper::Resource
#
# Properties
#
property :id, Serial
property :salesman, String, :default => 'Layfayette'
#
# Validations
#
validates_absence_of :salesman, :on => :sale
end
end
end
end
| 15.37931 | 60 | 0.504484 |
b924ad14a88d114288576f1b0cd72fbc9f660b4a | 131 | class Supplier < ApplicationRecord
#Associations
has_many :requests
#Validations
validates_presence_of :description
end
| 13.1 | 36 | 0.793893 |
ac271a05563e98ef0f227fb5e17fef7906a78634 | 2,489 | #!/usr/bin/env ruby
# I am a newbie and thought this one seemed easy enough
# to jump in (especially since I "borrowed" the hard part
# from a previous Ruby Quiz). I would appreciate any
# comments improving my idiomatic ruby.
# - Mark Thomas ['ruby','thomaszone.com'].join('@')
# seed sentence
sentence = "LOOK AND SAY"
# iteration at which to give up (prevent runaway prog)
MAX = 10000
# I took this Monkey patched Integer class from
# Glenn Parker's Ruby Quiz #25 solution, which
# provides Integer#to_english
class Integer
Ones = %w[ zero one two three four five six seven eight nine ]
Teen = %w[ ten eleven twelve thirteen fourteen fifteen
sixteen seventeen eighteen nineteen ]
Tens = %w[ zero ten twenty thirty forty fifty
sixty seventy eighty ninety ]
Mega = %w[ none thousand million billion ]
def to_english
places = to_s.split(//).collect {|s| s.to_i}.reverse
name = []
((places.length + 2) / 3).times do |p|
strings = Integer.trio(places[p * 3, 3])
name.push(Mega[p]) if strings.length > 0 and p > 0
name += strings
end
name.push(Ones[0]) unless name.length > 0
name.reverse.join(" ")
end
private
def Integer.trio(places)
strings = []
if places[1] == 1
strings.push(Teen[places[0]])
elsif places[1] and places[1] > 0
strings.push(places[0] == 0 ? Tens[places[1]] :
"#{Tens[places[1]]}-#{Ones[places[0]]}")
elsif places[0] > 0
strings.push(Ones[places[0]])
end
if places[2] and places[2] > 0
strings.push("hundred", Ones[places[2]])
end
strings
end
end
def look_and_say(sentence)
letters = {}
letters.default = 0
#put letters in a hash
s = sentence.gsub(/[^A-Z]/,'')
s.split('').each do |letter|
letters[letter] = letters[letter] + 1
end
#say in english
new_sentence = "";
letters.sort.each do |letter,count|
new_sentence << " " + count.to_english.upcase +
" " + letter
end
return new_sentence
end
#=================================================
# Main
puts "0. " + sentence
sentences = []
for i in 1..MAX
break if sentences.index(sentence)
print i.to_s + "."
sentences << sentence
new_sentence = look_and_say(sentence)
puts new_sentence
sentence = new_sentence
end
# Print Results
dupe = i-1
first = sentences.index(sentence)
cycle = dupe - first
puts "Repeated at #{dupe} which was the same as #{first},"
puts "a cycle of #{cycle}"
| 24.643564 | 64 | 0.62716 |
6aec90c5e2a18bd2142faaa43db5e963a2aad331 | 175 | class CreateAdTags < ActiveRecord::Migration
def change
create_table :ad_tags do |t|
t.belongs_to :ad
t.belongs_to :tag
t.timestamps
end
end
end
| 17.5 | 44 | 0.662857 |
0155eaf52ea6774fa1ad9edd982476d16bc4f1b0 | 942 | # frozen_string_literal: true
require "rails_helper"
module PublishCourseDetails
describe View do
include SummaryHelper
context "with a publish course", feature_publish_course_details: true do
let(:course) { trainee.published_course }
let(:trainee) { create(:trainee, :with_secondary_education, :with_publish_course_details) }
before do
render_inline(View.new(data_model: trainee))
end
it "render the correct course details" do
expect(rendered_component).to have_text("#{course.name} (#{course.code})")
expect(rendered_component).to have_text("Secondary")
expect(rendered_component).to have_text(trainee.course_subject_one.upcase_first)
expect(rendered_component).to have_text(age_range_for_summary_view(trainee.course_age_range))
expect(rendered_component).to have_text(date_for_summary_view(trainee.course_start_date))
end
end
end
end
| 34.888889 | 101 | 0.742038 |
ac3a503eea222584fa296ed8373416ff049ea107 | 1,483 | module SessionsHelper
# Logs in the given user.
def log_in(user)
session[:user_id] = user.id
end
# Remembers a user in a persistent session.
def remember(user)
user.remember
cookies.permanent.signed[:user_id] = user.id
cookies.permanent[:remember_token] = user.remember_token
end
# Returns true if the given user is the current user.
def current_user?(user)
user == current_user
end
# Returns the current logged-in user (if any).
def current_user
if (user_id = session[:user_id])
@current_user ||= User.find_by(id: user_id)
elsif (user_id = cookies.signed[:user_id])
user = User.find_by(id: user_id)
if user && user.authenticated?(:remember, cookies[:remember_token])
log_in user
@current_user = user
end
end
end
# Returns true if the user is logged in, false otherwise.
def logged_in?
!current_user.nil?
end
# Forgets a persistent session.
def forget(user)
user.forget
cookies.delete(:user_id)
cookies.delete(:remember_token)
end
def log_out
forget(current_user)
session.delete(:user_id)
@current_user = nil
end
# Redirects to stored location (or to the default).
def redirect_back_or(default)
redirect_to(session[:forwarding_url] || default)
session.delete(:forwarding_url)
end
# Stores the URL trying to be accessed.
def store_location
session[:forwarding_url] = request.original_url if request.get?
end
end
| 23.539683 | 73 | 0.690492 |
d5c586174bc8974194b7a9422b004289ae0dd8fe | 1,046 | require 'rails_helper'
module Mutations
module Auth
RSpec.describe SignIn, type: :request do
describe '.resolve' do
it 'returns current_user' do
user = FactoryBot.create(:user)
variables = {auth: user.username, password: user.password}
post '/graphql', params: {query: query, variables: variables}
json = JSON.parse(response.body)
expect(json['data']['signIn']['token']).to be_present
data = json['data']['signIn']['user']
expect(data).to include(
'id' => be_present,
'email' => be_present
)
end
end
def query
'
mutation($auth: String!, $password: String!) {
signIn(input: {
auth: $auth,
password: $password
}) {
token,
user {
id,
email
}
}
}
'
end
end
end
end | 25.512195 | 71 | 0.448375 |
5d3585638b5b09abf8f9bc14724c85f78f80ac2b | 7,259 | #!/usr/bin/env ruby
# Copyright 2016 hidenorly
#
# 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 'optparse'
require 'rubygems'
require 'mqtt'
require 'thread'
require 'json'
# --- global
$g_criticalSection = Mutex.new
$g_eventFlag = ConditionVariable.new
# --- utility for mqtt
$g_mqttClient = nil
$g_options = {}
$g_result = []
def convOptions(options)
result = {
:host => options[:host],
:port => options[:port]
}
result[:username] = options[:username] if options[:username]
result[:password] = options[:password] if options[:password]
result[:ssl] = options[:ssl] if options[:ssl]
result[:client_id] = options[:client_id] if options[:client_id]
return result
end
def connectMqtt
if $g_mqttClient == nil then
$g_mqttClient = MQTT::Client.connect($g_options)
end
return $g_mqttClient
end
def isConnected
if $g_mqttClient == nil then
connectMqtt()
end
return $g_mqttClient.connected?
end
# --- utility
def getOldIndex(data, targetTime)
found = false
i = 0
n = data.length
while ( i < n ) do
if data[i][:time] < targetTime then
i=i+1
found = true
else
if found then
return i-1
end
return -1
end
end
return -1
end
def getTimeOnly(samplingTime)
pos1 = samplingTime.index(" ")
pos2 = samplingTime.rindex(" ")
return samplingTime.slice(pos1+1, pos2-pos1-1) if pos1!=nil && pos2!=nil
return samplingTime
end
def createOutputData(inData, topic)
outData = []
labels = [ "time" ]
values = [ topic ]
inData.each do |aData|
labels << getTimeOnly(aData[:time].to_s)
values << aData[:value]
end
outData << labels
outData << values
return outData
end
def outputJSON(path, data)
fileWriter = File.open(path, "w")
# puts JSON.dump(data)
JSON.dump(data, fileWriter)
fileWriter.close
end
def outputCSV(path, data, writeMode="w")
fileWriter = File.open(path, writeMode)
data.each do |aData|
timeStr = aData[:time].to_s
pos = timeStr.rindex(" ")
timeStr = timeStr.slice(0, pos) if pos!=nil
outBuf = "#{timeStr},#{aData[:value]}"
fileWriter.puts outBuf
puts outBuf
end
fileWriter.close
end
def getFilename(path, prefix, topic, format)
filename = path.to_s
filename = filename +"/" if !filename.end_with?("/")
filename = filename + prefix
filename = filename + "_" if !topic.start_with?("/") && !topic.start_with?("-")
filename = filename + topic.to_s.tr("/", "-")
filename = filename +"." if !filename.end_with?(".")
filename = filename + format
return filename
end
def outputPersistLogData(topicDataStore, persistPath, lastTime)
if nil!=persistPath then
topicDataStore.each do |topic, data|
# trim data within window period
index = getOldIndex(data, lastTime)
if index!=-1 then
outputCSV(getFilename(persistPath, "persist", topic, "csv"), data.slice(0,index), "a")
end
end
end
end
def createCacheFile(topic, data, format, cachePath)
case format
when "csv"
outputCSV(getFilename(cachePath, "cache", topic, format), data)
when "json"
outputJSON(getFilename(cachePath, "cache", topic, format), createOutputData(data, topic))
end
end
#---- main --------------------------
options = {
:host => "localhost",
:port => "1883",
:ssl => false,
:username => nil,
:password => nil,
:client_id => nil,
:topics => [],
:outDir => nil,
:cacheDir => ".",
:updateCycle => 5,
:windowPeriod => 3600,
:format => "json"
}
opt_parser = OptionParser.new do |opts|
opts.banner = "Usage: usage (options)"
opts.on("-h", "--host=", "set mqtt host (default:#{options[:host]})") do |host|
options[:host] = host
end
opts.on("-p", "--port=", "set mqtt port (default:#{options[:port]})") do |port|
options[:port] = port
end
opts.on("-s", "--ssl", "Enable SSL connection (default:#{options[:ssl]})") do |ssl|
options[:ssl] = true
end
opts.on("-u", "--user=", "set username for the host") do |username|
options[:username] = username
end
opts.on("-p", "--password=", "set password for the host") do |password|
options[:password] = password
end
opts.on("-t", "--topics=", Array, "Set subscribing topics a,b,c") do |topics|
options[:topics] = topics
end
opts.on("-o", "--outDir=", "Set persist file output directory (default:#{options[:outDir]}) ") do |outDir|
options[:outDir] = outDir
end
opts.on("-c", "--cacheDir=", "Set cache file output directory (default:#{options[:cacheDir]}) ") do |cacheDir|
options[:cacheDir] = cacheDir
end
opts.on("", "--client_id=", "Set client ID (default:#{options[:client_id]})") do |client_id|
options[:client_id] = client_id
end
opts.on("-u", "--updateCycle=", "Set updateCycle [Sec] (default:#{options[:updateCycle]})") do |updateCycle|
options[:updateCycle] = updateCycle.to_i
end
opts.on("-w", "--windowPeriod=", "Set windowPeriod [Sec] (default:#{options[:windowPeriod]})") do |windowPeriod|
options[:windowPeriod] = windowPeriod.to_i
end
opts.on("-f", "--format=", "Set output cache format json,csv(default:#{options[:format]})") do |format|
options[:format] = format
end
end.parse!
$g_options = convOptions(options)
client = connectMqtt()
client.subscribe(options[:topics])
$g_updateCycle = options[:updateCycle]
$g_windowPeriod = options[:windowPeriod]
a = Thread.new {
topicDataStore = {}
lastTime = Time.now
while( isConnected() ) do
# to minimize blocking time on main thread
data = []
$g_criticalSection.synchronize{
$g_eventFlag.wait($g_criticalSection)
#while( $g_result.size>0 ) do
# data << $g_result.slice!(0)
#end
data = data + $g_result
$g_result = []
}
# store received data to sorted topic data
data.each do |aMes|
# puts "A THREAD:#{aMes[:time]} : #{aMes[:topic]} : #{aMes[:message]}"
topicDataStore[ aMes[:topic] ] = Array.new if !topicDataStore.has_key?(aMes[:topic])
last = topicDataStore[ aMes[:topic] ].last
if last==nil || last[:time]<aMes[:time] then
topicDataStore[ aMes[:topic] ] << { :time=>aMes[:time], :value=>aMes[:message] }
end
end
# update data
now = Time.now
if (now-lastTime)>$g_updateCycle then
outputPersistLogData(topicDataStore, options[:outDir], lastTime)
lastTime = now
targetTime = now - $g_windowPeriod
# puts "updated #{lastTime} / #{targetTime}"
topicDataStore.each do |topic, data|
# trim data within window period
index = getOldIndex(data, targetTime)
if index!=-1 then
data.slice!(0,index)
end
# puts "#{topic}:#{data}" # output this trimed data to cache file
createCacheFile(topic, data, options[:format], options[:cacheDir])
end
end
end
}
while( isConnected() ) do
client.get() do |topic, message|
$g_criticalSection.synchronize{
$g_result.push({:time=>Time.now, :topic=>topic, :message=>message})
}
$g_eventFlag.signal() #broadcast()
end
end
$g_eventFlag.broadcast()
a.join()
| 25.925 | 113 | 0.675988 |
f72d53918c6c5db93ba4fdf40178b24eb26cb694 | 704 | # -*- ruby -*-
_VERSION = "0.4.6"
date = %w$Date:: 2016-09-11 19:33:36 +0900#$[1]
Gem::Specification.new do |s|
s.name = "io-console"
s.version = _VERSION
s.date = date
s.summary = "Console interface"
s.email = "[email protected]"
s.description = "add console capabilities to IO instances."
s.required_ruby_version = ">= 2.0.0"
s.homepage = "https://www.ruby-lang.org"
s.authors = ["Nobu Nakada"]
s.require_path = %[lib]
s.files = %w[console.c depend extconf.rb lib/console/size.rb win32_vk.inc]
s.extensions = %w[extconf.rb]
s.license = "BSD-2-Clause"
s.cert_chain = %w[certs/nobu.pem]
s.signing_key = File.expand_path("~/.ssh/gem-private_key.pem") if $0 =~ /gem\z/
end
| 32 | 81 | 0.653409 |
08ca862ac3ce59a9483536f04455c7514b5209dd | 289 | class CreateAuthentications < ActiveRecord::Migration
def self.up
create_table :authentications do |t|
t.integer :user_id, :null => false
t.string :provider, :uid, :null => false
t.timestamps
end
end
def self.down
drop_table :authentications
end
end | 20.642857 | 53 | 0.678201 |
bb04c3b85779164fd35af5b69f8dec4e8174bdda | 1,562 | class Avrdude < Formula
desc "Atmel AVR MCU programmer"
homepage "https://savannah.nongnu.org/projects/avrdude/"
url "https://download.savannah.gnu.org/releases/avrdude/avrdude-6.3.tar.gz"
mirror "https://download-mirror.savannah.gnu.org/releases/avrdude/avrdude-6.3.tar.gz"
sha256 "0f9f731b6394ca7795b88359689a7fa1fba818c6e1d962513eb28da670e0a196"
bottle do
sha256 "cf4744484312894ba0feb9380fae6bf13967655db74bd24c52ccc30c7eacd26c" => :high_sierra
sha256 "45c59c4d7821476baa9354c5d57254ee2e7a589f4928f4ecc68f55c93dd648c6" => :sierra
sha256 "4e5318b6c2022a2c33f2cd7528c02a23599097227a390855b8ad5f0680c85dd3" => :el_capitan
sha256 "5abc4587ae12d475dd95a1b94e1c3045c4c4a64037d7be3dc935ff3a41d0285c" => :yosemite
sha256 "17916229c901c02efd79616a053fd6910a1e6c07c90027d868b43c5b536f86d5" => :mavericks
end
head do
url "https://svn.savannah.nongnu.org/svn/avrdude/trunk/avrdude"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
depends_on "libusb-compat"
depends_on "libftdi0"
depends_on "libelf"
depends_on "libhid" => :optional
def install
if build.head?
inreplace "bootstrap", /libtoolize/, "glibtoolize"
system "./bootstrap"
end
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}"
system "make"
system "make", "install"
end
test do
assert_equal "avrdude done. Thank you.",
shell_output("#{bin}/avrdude -c jtag2 -p x16a4 2>&1", 1).strip
end
end
| 34.711111 | 93 | 0.731754 |
f750067c3a12d4e4f833d39e843b22d34189de57 | 1,412 | class Slides < Formula
desc "Terminal based presentation tool"
homepage "https://github.com/maaslalani/slides"
url "https://github.com/maaslalani/slides/archive/refs/tags/v0.6.2.tar.gz"
sha256 "67de7cd34317bfba774102c690cd7de9f6d5b8f0271d34c1a5eff5fbb22f36b8"
license "MIT"
head "https://github.com/maaslalani/slides.git", branch: "main"
bottle do
sha256 cellar: :any_skip_relocation, arm64_big_sur: "2d099ef411a8ff3b1e3004d27f03659bae45520875be6c8432eff6b247380d30"
sha256 cellar: :any_skip_relocation, big_sur: "e4e45fb8e8c8cebccaf5182d52b459800b35c5b3d789248d4d872a0f1f2b395b"
sha256 cellar: :any_skip_relocation, catalina: "63371b5b12cdc44e65ca563e32dab81fca0e6e0bc6bda094a88753b8eecc1349"
end
depends_on "go" => :build
def install
system "go", "build", *std_go_args
end
test do
(testpath/"test.md").write <<-MARKDOWN
# Slide 1
Content
---
# Slide 2
More Content
MARKDOWN
# Bubbletea-based apps are hard to test even under PTY.spawn (or via
# expect) because they rely on vt100-like answerback support, such as
# "<ESC>[6n" to report the cursor position. For now we just run the command
# for a second and see that it tried to send some ANSI out of it.
require "pty"
r, _, pid = PTY.spawn "#{bin}/slides test.md"
sleep 1
Process.kill("TERM", pid)
assert_match(/\e\[/, r.read)
end
end
| 32.837209 | 122 | 0.721671 |
6ab2be01746e15cfc47649cf4496b4d55f99d4b2 | 658 | require 'spec_helper_acceptance'
# Ensure IPTables is installed - Section 3.6.1
describe package('iptables') do
it { should be_installed }
end
# Ensure Default deny Firewall Policy - Section 3.6.2
# Ensure loopback traffic is configured - Section 3.6.3
# Ensure outbound and established connections are configured - Section 3.6.4
# Ensure Firewall rules exist for all open ports - Section 3.6.5
# Ensure wireless interfaces are disabled - Section 3.7
describe file('/etc/sysconfig/iptables') do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
it { should be_mode 600 }
its (:content)
end | 34.631579 | 76 | 0.731003 |
285cb301e1f82d73fbee1402da4201a6e58a1254 | 2,861 | # frozen_string_literal: true
require 'spec_helper'
require 'pinboard-fixup-tweets/stats'
require 'timecop'
# rubocop:disable Metrics/BlockLength
RSpec.describe PinboardFixupTweets::Stats do
subject do
Timecop.freeze(Time.utc(2018, 1, 29, 21, 47, 11)) do
described_class.new('Unit Test')
end
end
# rubocop:disable Lint/ConstantDefinitionInBlock
module Outer
module Inner
end
end
# rubocop:enable Lint/ConstantDefinitionInBlock
it 'provides a summary telling that there is no data' do
expect(subject.to_s).to eq('Unit Test: No data was recorded.')
end
context 'incrementing a counter with a symbol as name' do
before do
subject.increment(:foo)
end
it 'provides a string summary' do
expect(subject.to_s).to eq('Unit Test: foo: 1')
end
end
context 'incrementing a counter with a string as name' do
before do
subject.increment('bar')
end
it 'provides a string summary' do
expect(subject.to_s).to eq('Unit Test: bar: 1')
end
end
context 'incrementing a counter with a class as name' do
before do
subject.increment(Outer::Inner)
end
it 'provides a string summary' do
expect(subject.to_s).to eq('Unit Test: Outer::Inner: 1')
end
end
context 'incrementing a counter with mixed names' do
before do
2.times { subject.increment(:bar) }
3.times { subject.increment('foo') }
4.times { subject.increment(Outer::Inner) }
subject.gauge('hits', 69)
end
it 'provides a string summary' do
expect(subject.to_s).to eq('Unit Test: Outer::Inner: 4, bar: 2, foo: 3, hits: 69')
end
context 'in JSON format' do
let(:json) do
Timecop.freeze(Time.utc(2018, 1, 29, 21, 54, 42)) do
subject.to_json
end
end
let(:parsed_json) { JSON.parse(json) }
it 'is valid JSON' do
expect(parsed_json).to be
end
context 'meta data' do
let(:meta) { parsed_json['meta'] }
it 'provides the stats title' do
expect(meta['title']).to eq('Unit Test')
end
it 'has the correct created_at date' do
expect(meta['created_at']).to eq('2018-01-29T21:47:11Z')
end
it 'has the correct elapsed_time_in_seconds' do
expect(meta['elapsed_time_in_seconds']).to eq(451)
end
it 'has the correct finished_at date' do
expect(meta['finished_at']).to eq('2018-01-29T21:54:42Z')
end
end
it 'has all values' do
expect(parsed_json['values']).to include('bar' => 2)
expect(parsed_json['values']).to include('foo' => 3)
expect(parsed_json['values']).to include('Outer::Inner' => 4)
expect(parsed_json['values']).to include('hits' => 69)
end
end
end
end
# rubocop:enable Metrics/BlockLength
| 26.009091 | 88 | 0.631597 |
91f6f10f485e7cb2d4a205b955257ffaee35cea0 | 1,004 | class Shapelib < Formula
desc "Library for reading and writing ArcView Shapefiles"
homepage "http://shapelib.maptools.org/"
url "https://download.osgeo.org/shapelib/shapelib-1.5.0.tar.gz"
sha256 "1fc0a480982caef9e7b9423070b47750ba34cd0ba82668f2e638fab1d07adae1"
livecheck do
url "https://download.osgeo.org/shapelib/"
regex(/href=.*?shapelib[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
cellar :any
sha256 "9800e87eaeeca3eca0d59c3bca555c0211df96f021735251964981ac2b16bd90" => :catalina
sha256 "90f9b9b0ccadf93be027e515be356d0b92f4dfb33979f11df9fc7570c3249d0e" => :mojave
sha256 "f1242aaf566b272f69331d16441171b12d0b4cef8396b56e0a8246fe7618ca68" => :high_sierra
sha256 "0add799fff38395de6300f1b18102270bd269b5dc37714e7cac1873849b2ced7" => :sierra
end
depends_on "cmake" => :build
def install
system "cmake", ".", *std_cmake_args
system "make", "install"
end
test do
assert_match "shp_file", shell_output("#{bin}/shptreedump", 1)
end
end
| 32.387097 | 93 | 0.748008 |
019290bb87ae9ba770a887ca5e0a233ff18e31ca | 57 | class NilClass #:nodoc:
def to_param
nil
end
end
| 9.5 | 23 | 0.666667 |
26338b24336c1ab92212e8b4507eb969b9a9073a | 229 | class UsersController < Clearance::UsersController
private
def new
@user = User.new
end
def user_params
params.require(:user).permit(:name, :cash_balance, :email, :password)
end
end
| 17.615385 | 77 | 0.624454 |
0183a8c0f6d38d4b8fa41fbab3950810ad9f9e6b | 461 | module StatsD::Instrument::Helpers
def capture_statsd_calls(&block)
mock_backend = StatsD::Instrument::Backends::CaptureBackend.new
old_backend, StatsD.backend = StatsD.backend, mock_backend
block.call
mock_backend.collected_metrics
ensure
if old_backend.kind_of?(StatsD::Instrument::Backends::CaptureBackend)
old_backend.collected_metrics.concat(mock_backend.collected_metrics)
end
StatsD.backend = old_backend
end
end
| 30.733333 | 74 | 0.774403 |
91539ef2c5e34d0418eb3c014b72c06d27c09ad0 | 897 | # frozen_string_literal: true
class NotificationMailer < ApplicationMailer
helper :base
layout nil
def article(article, user)
@user = user
@blog = article.blog
@article = article
build_mail @blog, @user, "New article: #{article.title}"
end
def comment(comment, user)
@user = user
@blog = comment.blog
@comment = comment
build_mail @blog, @user, "New comment on #{comment.article.title}"
end
def notif_user(user)
@user = user
# TODO: Make user blog-dependent
@blog = Blog.first
build_mail @blog, @user, "Welcome to Publify"
end
private
def make_subject(blog, subject)
"[#{blog.blog_name}] #{subject}"
end
def build_mail(blog, user, subject)
headers["X-Mailer"] = "Publify #{PublifyCore::VERSION}"
mail(from: blog.email_from,
to: user.email,
subject: make_subject(blog, subject))
end
end
| 21.878049 | 70 | 0.654404 |
217139ef46ab7d7008edf7c15c05ac8143c36e5a | 62 | class Instrument < ApplicationRecord
belongs_to :band
end
| 15.5 | 36 | 0.790323 |
d52d3f7b0674dd82be0b96cc41645d48461cb7de | 38 | require File.join('omniauth', 'webex') | 38 | 38 | 0.736842 |
ff7d36984b43e4d52653289d8b63b1926e776c6c | 10,130 | class ContainerDashboardService < DashboardService
include ContainerServiceMixin
include Mixins::CheckedIdMixin
CPU_USAGE_PRECISION = 2 # 2 decimal points
def initialize(provider_id, controller)
@provider_id = provider_id
@ems = find_record_with_rbac(ManageIQ::Providers::ContainerManager, @provider_id) if @provider_id.present?
@resource = @ems || ManageIQ::Providers::ContainerManager.all
@controller = controller
end
def all_data
{
:status => status,
:providers => providers,
:alerts => alerts,
}.compact
end
def all_heatmaps_data
{
:heatmaps => heatmaps
}.compact
end
def ems_utilization_data
{
:ems_utilization => ems_utilization
}.compact
end
def network_metrics_data
{
:network_metrics => network_metrics
}.compact
end
def pod_metrics_data
{
:pod_metrics => pod_metrics
}.compact
end
def image_metrics_data
{
:image_metrics => image_metrics
}.compact
end
def status
routes_count = if @ems.present?
@ems.respond_to?(:container_routes) ? @ems.container_routes.count : 0 # ems might not have routes
else
ContainerRoute.count
end
{
:nodes => {
:count => @ems.present? ? @ems.container_nodes.count : ContainerNode.active.count,
:errorCount => 0,
:warningCount => 0,
:href => get_url_to_entity(:container_node)
},
:containers => {
:count => @ems.present? ? @ems.containers.count : Container.active.count,
:errorCount => 0,
:warningCount => 0,
:href => get_url_to_entity(:container)
},
:registries => {
:count => @ems.present? ? @ems.container_image_registries.count : ContainerImageRegistry.count,
:errorCount => 0,
:warningCount => 0,
:href => get_url_to_entity(:container_image_registry)
},
:projects => {
:count => @ems.present? ? @ems.container_projects.count : ContainerProject.active.count,
:errorCount => 0,
:warningCount => 0,
:href => get_url_to_entity(:container_project)
},
:pods => {
:count => @ems.present? ? @ems.container_groups.count : ContainerGroup.active.count,
:errorCount => 0,
:warningCount => 0,
:href => get_url_to_entity(:container_group)
},
:services => {
:count => @ems.present? ? @ems.container_services.count : ContainerService.count,
:errorCount => 0,
:warningCount => 0,
:href => get_url_to_entity(:container_service)
},
:images => {
:count => @ems.present? ? @ems.container_images.count : ContainerImage.active.count,
:errorCount => 0,
:warningCount => 0,
:href => get_url_to_entity(:container_image)
},
:routes => {
:count => routes_count,
:errorCount => 0,
:warningCount => 0,
:href => get_url_to_entity(:container_route)
}
}
end
def providers
provider_classes_to_ui_types = ManageIQ::Providers::ContainerManager.subclasses.each_with_object({}) do |subclass, h|
name = subclass.name.split('::')[2]
h[subclass.name] = name.to_sym
end
providers = @ems.present? ? {@ems.type => 1} : ManageIQ::Providers::ContainerManager.group(:type).count
result = {}
providers.each do |provider, count|
ui_type = provider_classes_to_ui_types[provider]
(result[ui_type] ||= build_provider_status(ui_type))[:count] += count
end
all_providers_info = @ems.present? ? nil : {:count => ManageIQ::Providers::ContainerManager.count, :href => '/ems_container/show_list'}
return result.values, all_providers_info
end
def alerts
providers = @ems.present? ? [@ems] : ManageIQ::Providers::ContainerManager.includes(:authentications)
has_alerts = providers.any? do |prov|
prov.monitoring_manager.present?
end
relation = MiqAlertStatus.where(:ems_id => providers.pluck(:id))
alerts_status = relation.present? && has_alerts ? relation.where(:resolved => [false, nil]).group(:severity).count.values_at('error', 'warning') : [nil, nil]
errors = alerts_status[0] || 0
warnings = alerts_status[1] || 0
errors_struct = errors.positive? ? {:iconClass => "pficon pficon-error-circle-o", :count => errors} : nil
warnings_struct = warnings.positive? ? {:iconClass => "pficon pficon-warning-triangle-o", :count => warnings} : nil
notifications = if (errors + warnings).positive?
[errors_struct, warnings_struct].compact
elsif alerts_status == [nil, nil]
[{}]
else
[{:iconClass => "pficon-large pficon-ok"}]
end
{
:count => (errors + warnings).positive? ? (errors + warnings) : nil,
:href => @controller.url_for_only_path(:action => 'show', :controller => :alerts_overview),
:notifications => notifications,
:dataAvailable => has_alerts
}
end
def build_provider_status(provider_type)
if @ems.present?
provider_status_icon = QuadiconHelper.provider_status("Valid", @ems.enabled?)[:fonticon]
provider_fileicon = @ems.decorate.try(:fileicon)
end
{
:count => 0,
:typeName => _(provider_type.to_s),
:iconImage => provider_fileicon ? ActionController::Base.helpers.image_path(provider_fileicon) : nil,
:statusIcon => provider_status_icon
}
end
def get_url_to_entity(entity)
if @ems.present?
@controller.polymorphic_url(@ems, :display => entity.to_s.pluralize)
else
@controller.url_for_only_path(:action => 'show_list', :controller => entity)
end
end
def realtime_heatmaps
node_ids = @ems.present? ? @ems.container_nodes : ContainerNode.active
metrics = Metric::Helper.latest_metrics(ContainerNode.name, REALTIME_TIME_RANGE.minutes.ago.utc, node_ids)
metrics = metrics.includes(:resource)
metrics = metrics.includes(:resource => [:ext_management_system]) if @ems.blank?
heatmaps_data(metrics)
end
def hourly_heatmaps
# Get latest hourly rollup for each node.
node_ids = @ems.present? ? @ems.container_nodes : ContainerNode.active
metrics = MetricRollup.latest_rollups(ContainerNode.name, node_ids)
metrics = metrics.where('timestamp > ?', 1.day.ago.utc).includes(:resource)
metrics = metrics.includes(:resource => [:ext_management_system]) if @ems.blank?
data = heatmaps_data(metrics)
data if data[:nodeCpuUsage]
end
def heatmaps_data(metrics)
node_cpu_usage = []
node_memory_usage = []
metrics.each do |m|
next if m.resource.nil? # Metrics are purged asynchronously and might be missing their node
provider_name = @ems.present? ? @ems.name : m.resource.ext_management_system.name
node_cpu_usage << {
:id => m.resource.id,
:node => m.resource.name,
:provider => provider_name,
:unit => _("Cores"),
:total => m.derived_vm_numvcpus.present? ? m.derived_vm_numvcpus.round : nil,
:percent => m.cpu_usage_rate_average.present? ? (m.cpu_usage_rate_average / 100.0).round(CPU_USAGE_PRECISION) : nil # pf accepts fractions 90% = 0.90
}
node_memory_usage << {
:id => m.resource.id,
:node => m.resource.name,
:provider => m.resource.ext_management_system.name,
:unit => _("GB"),
:total => m.derived_memory_available.present? ? m.derived_memory_available.round : nil,
:percent => m.mem_usage_absolute_average.present? ? (m.mem_usage_absolute_average / 100.0).round(CPU_USAGE_PRECISION) : nil # pf accepts fractions 90% = 0.90
}
end
{
:nodeCpuUsage => node_cpu_usage.presence,
:nodeMemoryUsage => node_memory_usage.presence,
:title => _("Node Utilization")
}
end
def heatmaps
hourly_heatmaps || realtime_heatmaps
end
def ems_utilization
daily_utilization || hourly_utilization || realtime_utilization || empty_utilization_trend_data
end
def network_metrics
daily_network_metrics || hourly_network_metrics || realtime_network_metrics || empty_network_trend_data
end
def hourly_image_metrics
hourly_image_metrics = Hash.new(0)
hourly_metrics.each do |m|
hour = m.timestamp.beginning_of_hour.utc
if m.stat_container_image_registration_rate.present?
hourly_image_metrics[hour] += m.stat_container_image_registration_rate
end
end
if hourly_image_metrics.size > 1
{
:dataAvailable => true,
:interval_name => "hourly",
:xy_data => trend_data(hourly_image_metrics)
}
end
end
def daily_image_metrics
daily_image_metrics = Hash.new(0)
daily_metrics.each do |m|
day = m.timestamp.beginning_of_day.utc
daily_image_metrics[day] += m.stat_container_image_registration_rate if m.stat_container_image_registration_rate.present?
end
if daily_image_metrics.size > 1
{
:dataAvailable => true,
:interval_name => "daily",
:xy_data => trend_data(daily_image_metrics)
}
end
end
def empty_metrics_data
{:dataAvailable => false}
end
def image_metrics
daily_image_metrics || hourly_image_metrics || empty_metrics_data
end
# ems has no realtime metrics but its nodes do.
def realtime_metrics
current_user = @controller.current_user
tp = TimeProfile.profile_for_user_tz(current_user.id, current_user.get_timezone) || TimeProfile.default_time_profile
Metric::Helper.find_for_interval_name('realtime', tp)
.where(:resource => @ems.try(:all_container_nodes) || ContainerNode.all)
.where('timestamp > ?', REALTIME_TIME_RANGE.minutes.ago.utc).order('timestamp')
end
end
| 34.222973 | 166 | 0.636032 |
08829e9b26afd42f8dd41fcc7e03b173f3235678 | 8,254 | #
# Author:: Bryan McLellan ([email protected])
# Copyright:: Copyright 2009-2016, Bryan McLellan
# License:: Apache License, Version 2.0
#
# 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_relative "../package"
require_relative "deb"
require_relative "../../resource/package"
class Chef
class Provider
class Package
class Dpkg < Chef::Provider::Package
include Chef::Provider::Package::Deb
DPKG_REMOVED = /^Status: deinstall ok config-files/.freeze
DPKG_INSTALLED = /^Status: install ok installed/.freeze
DPKG_VERSION = /^Version: (.+)$/.freeze
provides :dpkg_package
use_multipackage_api
use_package_name_for_source
def define_resource_requirements
super
requirements.assert(:install, :upgrade) do |a|
a.assertion { !resolved_source_array.compact.empty? }
a.failure_message Chef::Exceptions::Package, "#{new_resource} the source property is required for action :install or :upgrade"
end
requirements.assert(:install, :upgrade) do |a|
a.assertion { source_files_exist? }
a.failure_message Chef::Exceptions::Package, "#{new_resource} source file(s) do not exist: #{missing_sources}"
a.whyrun "Assuming they would have been previously created."
end
end
def load_current_resource
@current_resource = Chef::Resource::Package.new(new_resource.name)
current_resource.package_name(new_resource.package_name)
if source_files_exist?
@candidate_version = get_candidate_version
current_resource.package_name(get_package_name)
# if the source file exists then our package_name is right
current_resource.version(get_current_version_from(current_package_name_array))
elsif !installing?
# we can't do this if we're installing with no source, because our package_name
# is probably not right.
#
# if we're removing or purging we don't use source, and our package_name must
# be right so we can do this.
#
# we don't error here on the dpkg command since we'll handle the exception or
# the why-run message in define_resource_requirements.
current_resource.version(get_current_version_from(current_package_name_array))
end
current_resource
end
def install_package(name, version)
sources = name.map { |n| name_sources[n] }
logger.info("#{new_resource} installing package(s): #{name.join(" ")}")
run_noninteractive("dpkg", "-i", *options, *sources)
end
def remove_package(name, version)
logger.info("#{new_resource} removing package(s): #{name.join(" ")}")
run_noninteractive("dpkg", "-r", *options, *name)
end
def purge_package(name, version)
logger.info("#{new_resource} purging packages(s): #{name.join(" ")}")
run_noninteractive("dpkg", "-P", *options, *name)
end
def upgrade_package(name, version)
install_package(name, version)
end
# Override the superclass check. Multiple sources are required here.
def check_resource_semantics!; end
private
# compare 2 versions to each other to see which is newer.
# this differs from the standard package method because we
# need to be able to parse debian version strings which contain
# tildes which Gem cannot properly parse
#
# @return [Integer] 1 if v1 > v2. 0 if they're equal. -1 if v1 < v2
def version_compare(v1, v2)
if !shell_out("dpkg", "--compare-versions", v1.to_s, "gt", v2.to_s).error?
1
elsif !shell_out("dpkg", "--compare-versions", v1.to_s, "eq", v2.to_s).error?
0
else
-1
end
end
def read_current_version_of_package(package_name)
logger.trace("#{new_resource} checking install state of #{package_name}")
status = shell_out!("dpkg", "-s", package_name, returns: [0, 1])
package_installed = false
status.stdout.each_line do |line|
case line
when DPKG_REMOVED
# if we are 'purging' then we consider 'removed' to be 'installed'
package_installed = true if action == :purge
when DPKG_INSTALLED
package_installed = true
when DPKG_VERSION
if package_installed
logger.trace("#{new_resource} current version is #{$1}")
return $1
end
end
end
nil
end
def get_current_version_from(array)
array.map do |name|
read_current_version_of_package(name)
end
end
# Returns true if all sources exist. Returns false if any do not, or if no
# sources were specified.
#
# @return [Boolean] True if all sources exist
def source_files_exist?
resolved_source_array.all? { |s| s && ::File.exist?(s) }
end
# Helper to return all the names of the missing sources for error messages.
#
# @return [Array<String>] Array of missing sources
def missing_sources
resolved_source_array.select { |s| s.nil? || !::File.exist?(s) }
end
def current_package_name_array
[ current_resource.package_name ].flatten
end
# Helper to construct Hash of names-to-sources.
#
# @return [Hash] Mapping of package names to sources
def name_sources
@name_sources =
begin
Hash[*package_name_array.zip(resolved_source_array).flatten]
end
end
# Helper to construct Hash of names-to-package-information.
#
# @return [Hash] Mapping of package names to package information
def name_pkginfo
@name_pkginfo ||=
begin
pkginfos = resolved_source_array.map do |src|
logger.trace("#{new_resource} checking #{src} dpkg status")
status = shell_out!("dpkg-deb", "-W", src)
status.stdout
end
Hash[*package_name_array.zip(pkginfos).flatten]
end
end
def name_candidate_version
@name_candidate_version ||=
begin
Hash[name_pkginfo.map { |k, v| [k, v ? v.split("\t")[1].strip : nil] }]
end
end
def name_package_name
@name_package_name ||=
begin
Hash[name_pkginfo.map { |k, v| [k, v ? v.split("\t")[0] : nil] }]
end
end
# Return candidate version array from pkg-deb -W against the source file(s).
#
# @return [Array] Array of candidate versions read from the source files
def get_candidate_version
package_name_array.map { |name| name_candidate_version[name] }
end
# Return package names from the candidate source file(s).
#
# @return [Array] Array of actual package names read from the source files
def get_package_name
package_name_array.map { |name| name_package_name[name] }
end
# Since upgrade just calls install, this is a helper to determine
# if our action means that we'll be calling install_package.
#
# @return [Boolean] true if we're doing :install or :upgrade
def installing?
%i{install upgrade}.include?(action)
end
end
end
end
end
| 36.201754 | 138 | 0.607584 |
1a843f667fd3081df5e67c174a51facbf74b47a8 | 398 | require 'rails_helper'
RSpec.describe Category do
describe "should exclude sentinel category only" do
let!(:current_user) { create :user }
let!(:another_user) { create :user }
let!(:ucat) { create :category, user_id: current_user.id }
let!(:acat) { create :category, user_id: another_user.id }
it do
expect(current_user.categories.last).to eql(ucat)
end
end
end
| 26.533333 | 62 | 0.68593 |
e806161370badd9a781500de9477cb7b4c157b77 | 12,677 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'DAST profiles (GraphQL fixtures)' do
describe GraphQL::Query, type: :request do
include ApiHelpers
include GraphqlHelpers
include JavaScriptFixturesHelpers
include API::Helpers::GraphqlHelpers
include RepoHelpers
shared_examples 'dast_site_profiles.query.graphql' do |type|
path = 'security_configuration/dast_profiles/graphql/dast_site_profiles.query.graphql'
it "graphql/#{path}.#{type}.json" do
query = get_graphql_query_as_string(path, ee: true)
post_graphql(query, current_user: current_user, variables: {
fullPath: project.full_path,
first: 20
})
expect_graphql_errors_to_be_empty
expect(graphql_data_at(:project, :siteProfiles, :edges)).to have_attributes(size: dast_site_profiles.length)
end
end
shared_examples 'dast_scanner_profiles.query.graphql' do |type|
path = 'security_configuration/dast_profiles/graphql/dast_scanner_profiles.query.graphql'
it "graphql/#{path}.#{type}.json" do
query = get_graphql_query_as_string(path, ee: true)
post_graphql(query, current_user: current_user, variables: {
fullPath: project.full_path,
first: 20
})
expect_graphql_errors_to_be_empty
expect(graphql_data_at(:project, :scannerProfiles, :edges)).to have_attributes(size: dast_scanner_profiles.length)
end
end
let_it_be(:current_user) { create(:user) }
let_it_be(:project) { create(:project, :repository, :public) }
before do
stub_licensed_features(security_on_demand_scans: true)
project.add_developer(current_user)
end
describe 'dast_site_profiles' do
# DAST site validations
let_it_be(:dast_site_validation_pending) do
create(
:dast_site_validation,
state: :pending,
dast_site_token: create(
:dast_site_token,
project: project
)
)
end
let_it_be(:dast_site_validation_inprogress) do
create(
:dast_site_validation,
state: :inprogress,
dast_site_token: create(
:dast_site_token,
project: project
)
)
end
let_it_be(:dast_site_validation_passed) do
create(
:dast_site_validation,
state: :passed,
dast_site_token: create(
:dast_site_token,
project: project
)
)
end
let_it_be(:dast_site_validation_failed) do
create(
:dast_site_validation,
state: :failed,
dast_site_token: create(
:dast_site_token,
project: project
)
)
end
# DAST sites
let_it_be(:dast_site_pending) do
create(
:dast_site,
project: project,
url: 'http://pending.test',
dast_site_validation: dast_site_validation_pending
)
end
let_it_be(:dast_site_inprogress) do
create(
:dast_site,
project: project,
url: 'http://inprogress.test',
dast_site_validation: dast_site_validation_inprogress
)
end
let_it_be(:dast_site_passed) do
create(
:dast_site,
project: project,
url: 'http://passed.test',
dast_site_validation: dast_site_validation_passed
)
end
let_it_be(:dast_site_failed) do
create(
:dast_site,
project: project,
url: 'http://failed.test',
dast_site_validation: dast_site_validation_failed
)
end
let_it_be(:dast_site_none) do
create(
:dast_site,
project: project,
url: 'http://none.test',
dast_site_validation: nil
)
end
context 'basic site profiles' do
# DAST site profiles
let_it_be(:dast_site_profiles) do
[
create(
:dast_site_profile,
name: "Non-validated",
auth_username: "[email protected]",
project: project,
dast_site: dast_site_none
),
create(
:dast_site_profile,
name: "Validation failed",
auth_username: "[email protected]",
project: project,
dast_site: dast_site_failed
),
create(
:dast_site_profile,
name: "Validation passed",
auth_username: "[email protected]",
project: project,
dast_site: dast_site_passed
),
create(
:dast_site_profile,
name: "Validation in progress",
auth_username: "[email protected]",
project: project,
dast_site: dast_site_inprogress
),
create(
:dast_site_profile,
name: "Validation pending",
auth_username: "[email protected]",
project: project,
dast_site: dast_site_pending
)
]
end
it_behaves_like 'dast_site_profiles.query.graphql', "basic"
end
context 'dast site profile with secret variables' do
let(:response) { @site_profile.to_json }
let_it_be(:dast_site_profile) { create(:dast_site_profile, project: project) }
let_it_be(:request_headers_variable) { create(:dast_site_profile_secret_variable, :request_headers, dast_site_profile: dast_site_profile) }
let_it_be(:password_variable) { create(:dast_site_profile_secret_variable, :password, dast_site_profile: dast_site_profile) }
it "security_configuration/dast_profiles/dast_site_profile_with_secrets.json" do
query = %(
{
project(fullPath: "#{project.full_path}") {
dastSiteProfile(id: "#{Gitlab::GlobalId.as_global_id(dast_site_profile.id, model_name: 'DastSiteProfile')}") {
id
name: profileName
targetUrl
targetType
excludedUrls
requestHeaders
auth { enabled url username usernameField password passwordField }
referencedInSecurityPolicies
}
}
}
)
@site_profile = run_graphql!(
query: query,
context: { current_user: current_user },
transform: -> (result) { result.dig('data', 'project', 'dastSiteProfile') }
)
end
end
end
describe 'dast_scanner_profiles' do
# DAST scanner profiles
let_it_be(:dast_scanner_profiles) do
[
create(
:dast_scanner_profile,
name: "Active scanner",
spider_timeout: 5,
target_timeout: 10,
scan_type: 'active',
use_ajax_spider: true,
show_debug_messages: true,
project: project
),
create(
:dast_scanner_profile,
name: "Passive scanner",
spider_timeout: 5,
target_timeout: 10,
scan_type: 'passive',
project: project
)
]
end
it_behaves_like 'dast_scanner_profiles.query.graphql', "basic"
end
describe 'from policies' do
let_it_be(:policies_project) { create(:project, :repository) }
let_it_be(:security_orchestration_policy_configuration) do
create(
:security_orchestration_policy_configuration,
project: project,
security_policy_management_project: policies_project
)
end
let_it_be(:dast_site_profiles) do
[
create(
:dast_site_profile,
name: "From policy",
auth_username: "[email protected]",
project: project
)
]
end
let_it_be(:dast_scanner_profiles) do
[
create(
:dast_scanner_profile,
name: "Active scanner",
spider_timeout: 5,
target_timeout: 10,
scan_type: 'active',
use_ajax_spider: true,
show_debug_messages: true,
project: project
)
]
end
let(:policy1) do
build(:scan_execution_policy, rules: [{ type: 'pipeline', branches: %w[master] }], actions: [
{ scan: 'dast', site_profile: dast_site_profiles.first.name, scanner_profile: dast_scanner_profiles.first.name }
])
end
let(:policy_yaml) { build(:orchestration_policy_yaml, scan_execution_policy: [policy1]) }
before do
create_file_in_repo(policies_project, 'master', 'master', Security::OrchestrationPolicyConfiguration::POLICY_PATH, policy_yaml)
end
context "site profiles" do
it_behaves_like 'dast_site_profiles.query.graphql', "from_policies"
end
context "scanner profiles" do
it_behaves_like 'dast_scanner_profiles.query.graphql', "from_policies"
end
end
describe 'scheduled_dast_profiles' do
path = 'on_demand_scans/graphql/scheduled_dast_profiles.query.graphql'
let_it_be(:dast_profile) { create(:dast_profile, project: project) }
let_it_be(:dast_profile_schedule) do
create(:dast_profile_schedule, project: project,
dast_profile: dast_profile)
end
it "graphql/#{path}.json" do
query = get_graphql_query_as_string(path, ee: true)
post_graphql(query, current_user: current_user, variables: {
fullPath: project.full_path,
first: 20
})
expect_graphql_errors_to_be_empty
expect(graphql_data_at(:project, :pipelines, :nodes)).to have_attributes(size: 1)
end
end
describe 'dast_profiles' do
path = 'security_configuration/dast_profiles/graphql/dast_profiles.query.graphql'
let_it_be(:dast_profiles) do
[
create(:dast_profile, project: project),
create(:dast_profile, project: project)
]
end
before do
dast_profiles.first.branch_name = SecureRandom.hex
dast_profiles.first.save!(validate: false)
end
it "graphql/#{path}.json" do
query = get_graphql_query_as_string(path, ee: true)
post_graphql(query, current_user: current_user, variables: {
fullPath: project.full_path,
first: 20
})
expect_graphql_errors_to_be_empty
expect(graphql_data_at(:project, :dastProfiles, :edges)).to have_attributes(size: dast_profiles.length)
end
end
describe 'dast_site_validations' do
context 'failed site validations' do
path = 'security_configuration/dast_profiles/graphql/dast_failed_site_validations.query.graphql'
let_it_be(:dast_site_validation_https) do
create(
:dast_site_validation,
state: :failed,
dast_site_token: create(
:dast_site_token,
url: 'https://example.com',
project: project
)
)
end
let_it_be(:dast_site_validation_http) do
create(
:dast_site_validation,
state: :failed,
dast_site_token: create(
:dast_site_token,
url: 'http://example.com',
project: project
)
)
end
it "graphql/#{path}.json" do
query = get_graphql_query_as_string(path, ee: true)
post_graphql(query, current_user: current_user, variables: {
fullPath: project.full_path
})
expect_graphql_errors_to_be_empty
expect(graphql_data_at(:project, :validations, :nodes)).to have_attributes(size: 2)
end
end
end
describe 'dast_profiles' do
path = 'on_demand_scans/graphql/dast_profiles.query.graphql'
let_it_be(:dast_profiles) do
create_list(:dast_profile, 3, project: project)
end
it "graphql/#{path}.json" do
query = get_graphql_query_as_string(path, ee: true)
post_graphql(query, current_user: current_user, variables: {
fullPath: project.full_path,
first: 20
})
expect_graphql_errors_to_be_empty
expect(graphql_data_at(:project, :pipelines, :nodes)).to have_attributes(size: dast_profiles.size)
end
end
end
end
| 30.040284 | 147 | 0.595488 |
5d80fb086ece6781ab3711a520a334fd5ffca6bc | 6,593 | # frozen_string_literal: true
RSpec.describe RuboCop::Cop::Layout::EmptyLinesAroundModuleBody, :config do
subject(:cop) { described_class.new(config) }
let(:extra_begin) { 'Extra empty line detected at module body beginning.' }
let(:extra_end) { 'Extra empty line detected at module body end.' }
let(:missing_begin) { 'Empty line missing at module body beginning.' }
let(:missing_end) { 'Empty line missing at module body end.' }
let(:missing_def) { 'Empty line missing before first def definition' }
let(:missing_type) { 'Empty line missing before first module definition' }
context 'when EnforcedStyle is no_empty_lines' do
let(:cop_config) { { 'EnforcedStyle' => 'no_empty_lines' } }
it 'registers an offense for module body starting with a blank' do
inspect_source(<<-RUBY.strip_indent)
module SomeModule
do_something
end
RUBY
expect(cop.messages)
.to eq(['Extra empty line detected at module body beginning.'])
end
it 'registers an offense for module body ending with a blank' do
inspect_source(<<-RUBY.strip_indent)
module SomeModule
do_something
end
RUBY
expect(cop.messages)
.to eq(['Extra empty line detected at module body end.'])
end
it 'autocorrects beginning and end' do
new_source = autocorrect_source(<<-RUBY.strip_indent)
module SomeModule
do_something
end
RUBY
expect(new_source).to eq(<<-RUBY.strip_indent)
module SomeModule
do_something
end
RUBY
end
end
context 'when EnforcedStyle is empty_lines' do
let(:cop_config) { { 'EnforcedStyle' => 'empty_lines' } }
it 'registers an offense for module body not starting or ending with a ' \
'blank' do
inspect_source(<<-RUBY.strip_indent)
module SomeModule
do_something
end
RUBY
expect(cop.messages)
.to eq(['Empty line missing at module body beginning.',
'Empty line missing at module body end.'])
end
it 'registers an offense for module body not ending with a blank' do
expect_offense(<<-RUBY.strip_indent)
module SomeModule
do_something
end
^ Empty line missing at module body end.
RUBY
end
it 'autocorrects beginning and end' do
new_source = autocorrect_source(<<-RUBY.strip_indent)
module SomeModule
do_something
end
RUBY
expect(new_source).to eq(<<-RUBY.strip_indent)
module SomeModule
do_something
end
RUBY
end
it 'ignores modules with an empty body' do
source = "module A\nend"
corrected = autocorrect_source(source)
expect(corrected).to eq(source)
end
end
context 'when EnforcedStyle is empty_lines_except_namespace' do
let(:cop_config) { { 'EnforcedStyle' => 'empty_lines_except_namespace' } }
context 'when only child is class' do
it 'requires no empty lines for namespace' do
expect_no_offenses(<<-RUBY.strip_indent)
module Parent
module Child
do_something
end
end
RUBY
end
it 'registers offence for namespace body starting with a blank' do
inspect_source(<<-RUBY.strip_indent)
module Parent
module Child
do_something
end
end
RUBY
expect(cop.messages).to eq([extra_begin])
end
it 'registers offence for namespace body ending with a blank' do
inspect_source(<<-RUBY.strip_indent)
module Parent
module Child
do_something
end
end
RUBY
expect(cop.messages).to eq([extra_end])
end
it 'registers offences for namespaced module body not starting '\
'with a blank' do
inspect_source(<<-RUBY.strip_indent)
module Parent
module Child
do_something
end
end
RUBY
expect(cop.messages).to eq([missing_begin])
end
it 'registers offences for namespaced module body not ending '\
'with a blank' do
inspect_source(<<-RUBY.strip_indent)
module Parent
module Child
do_something
end
end
RUBY
expect(cop.messages).to eq([missing_end])
end
it 'autocorrects beginning and end' do
new_source = autocorrect_source(<<-RUBY.strip_indent)
module Parent
module Child
do_something
end
end
RUBY
expect(new_source).to eq(<<-RUBY.strip_indent)
module Parent
module Child
do_something
end
end
RUBY
end
end
context 'when only child is class' do
it 'requires no empty lines for namespace' do
expect_no_offenses(<<-RUBY.strip_indent)
module Parent
class SomeClass
do_something
end
end
RUBY
end
it 'registers offence for namespace body starting with a blank' do
inspect_source(<<-RUBY.strip_indent)
module Parent
class SomeClass
do_something
end
end
RUBY
expect(cop.messages).to eq([extra_begin])
end
it 'registers offence for namespace body ending with a blank' do
inspect_source(<<-RUBY.strip_indent)
module Parent
class SomeClass
do_something
end
end
RUBY
expect(cop.messages).to eq([extra_end])
end
end
context 'when has multiple child modules' do
it 'requires empty lines for namespace' do
expect_no_offenses(<<-RUBY.strip_indent)
module Parent
module Mom
do_something
end
module Dad
end
end
RUBY
end
it 'registers offences for namespace body starting '\
'and ending without a blank' do
inspect_source(<<-RUBY.strip_indent)
module Parent
module Mom
do_something
end
module Dad
end
end
RUBY
expect(cop.messages).to eq([missing_begin, missing_end])
end
end
end
include_examples 'empty_lines_around_class_or_module_body', 'module'
end
| 24.600746 | 78 | 0.586986 |
6293ab538ed581af12186b4eef442e6cafa80d0f | 211 | FactoryGirl.define do
factory :notification do
association :blog, :factory => :blog
email "[email protected]"
end
factory :invalid_notification, parent: :notification do |f|
f.email nil
end
end | 21.1 | 61 | 0.696682 |
bf8f35f4bf4b1395f9ac4c5eb03b7c18c9e78c4c | 9,200 | # -*- coding: binary -*-
require 'rex/socket'
require 'rex/proto/http'
require 'rex/proto/http/handler'
module Rex
module Proto
module Http
###
#
# Runtime extension of the HTTP clients that connect to the server.
#
###
module ServerClient
#
# Initialize a new request instance.
#
def init_cli(server)
self.request = Request.new
self.server = server
self.keepalive = false
end
#
# Resets the parsing state.
#
def reset_cli
self.request.reset
end
#
# Transmits a response and adds the appropriate headers.
#
def send_response(response)
# Set the connection to close or keep-alive depending on what the client
# can support.
response['Connection'] = (keepalive) ? 'Keep-Alive' : 'close'
# Add any other standard response headers.
server.add_response_headers(response)
# Send it off.
put(response.to_s)
end
#
# The current request context.
#
attr_accessor :request
#
# Boolean that indicates whether or not the connection supports keep-alive.
#
attr_accessor :keepalive
#
# A reference to the server the client is associated with.
#
attr_accessor :server
end
###
#
# Acts as an HTTP server, processing requests and dispatching them to
# registered procs. Some of this server was modeled after webrick.
#
###
class Server
include Proto
#
# A hash that associated a file extension with a mime type for use as the
# content type of responses.
#
ExtensionMimeTypes =
{
"rhtml" => "text/html",
"html" => "text/html",
"htm" => "text/htm",
"jpg" => "image/jpeg",
"jpeg" => "image/jpeg",
"gif" => "image/gif",
"png" => "image/png",
"bmp" => "image/bmp",
"txt" => "text/plain",
"css" => "text/css",
"ico" => "image/x-icon",
}
#
# The default server name that will be returned in the Server attribute of
# a response.
#
DefaultServer = "Rex"
#
# Initializes an HTTP server as listening on the provided port and
# hostname.
#
def initialize(port = 80, listen_host = '0.0.0.0', ssl = false, context = {},
comm = nil, ssl_cert = nil, ssl_compression = false,
ssl_cipher = nil)
self.listen_host = listen_host
self.listen_port = port
self.ssl = ssl
self.context = context
self.comm = comm
self.ssl_cert = ssl_cert
self.ssl_compression = ssl_compression
self.ssl_cipher = ssl_cipher
self.listener = nil
self.resources = {}
self.server_name = DefaultServer
end
# More readable inspect that only shows the url and resources
# @return [String]
def inspect
resources_str = resources.keys.map{|r| r.inspect }.join ", "
"#<#{self.class} http#{ssl ? "s" : ""}://#{listen_host}:#{listen_port} [ #{resources_str} ]>"
end
#
# Returns the hardcore alias for the HTTP service
#
def self.hardcore_alias(*args)
"#{(args[0] || '')}#{(args[1] || '')}"
end
#
# HTTP server.
#
def alias
super || "HTTP Server"
end
#
# Listens on the defined port and host and starts monitoring for clients.
#
def start
self.listener = Rex::Socket::TcpServer.create(
'LocalHost' => self.listen_host,
'LocalPort' => self.listen_port,
'Context' => self.context,
'SSL' => self.ssl,
'SSLCert' => self.ssl_cert,
'SSLCompression' => self.ssl_compression,
'SSLCipher' => self.ssl_cipher,
'Comm' => self.comm
)
# Register callbacks
self.listener.on_client_connect_proc = Proc.new { |cli|
on_client_connect(cli)
}
self.listener.on_client_data_proc = Proc.new { |cli|
on_client_data(cli)
}
self.listener.start
end
#
# Terminates the monitor thread and turns off the listener.
#
def stop
self.listener.stop
self.listener.close
end
#
# Waits for the HTTP service to terminate
#
def wait
self.listener.wait if self.listener
end
#
# Closes the supplied client, if valid.
#
def close_client(cli)
listener.close_client(cli)
end
#
# Mounts a directory or resource as being serviced by the supplied handler.
#
def mount(root, handler, long_call = false, *args)
resources[root] = [ handler, long_call, args ]
end
#
# Remove the mount point.
#
def unmount(root)
resources.delete(root)
end
#
# Adds a resource handler, such as one for /, which will be called whenever
# the resource is requested. The ``opts'' parameter can have any of the
# following:
#
# Proc (proc) - The procedure to call when a request comes in for this resource.
# LongCall (bool) - Hints to the server that this resource may have long
# request processing times.
#
def add_resource(name, opts)
if (resources[name])
raise RuntimeError,
"The supplied resource '#{name}' is already added.", caller
end
# If a procedure was passed, mount the resource with it.
if (opts['Proc'])
mount(name, Handler::Proc, false, opts['Proc'], opts['VirtualDirectory'])
else
raise ArgumentError, "You must specify a procedure."
end
end
#
# Removes the supplied resource handler.
#
def remove_resource(name)
self.resources.delete(name)
end
#
# Adds Server headers and stuff.
#
def add_response_headers(resp)
resp['Server'] = self.server_name if not resp['Server']
end
#
# Returns the mime type associated with the supplied file. Right now the
# set of mime types is fairly limited.
#
def mime_type(file)
type = nil
if (file =~ /\.(.+?)$/)
type = ExtensionMimeTypes[$1.downcase]
end
type || "text/plain"
end
#
# Sends a 404 error to the client for a given request.
#
def send_e404(cli, request)
resp = Response::E404.new
resp['Content-Type'] = 'text/html'
resp.body =
"<html><head>" +
"<title>404 Not Found</title>" +
"</head><body>" +
"<h1>Not found</h1>" +
"The requested URL #{html_escape(request.resource)} was not found on this server.<p><hr>" +
"</body></html>"
# Send the response to the client like what
cli.send_response(resp)
end
attr_accessor :listen_port, :listen_host, :server_name, :context, :comm
attr_accessor :ssl, :ssl_cert, :ssl_compression, :ssl_cipher
attr_accessor :listener, :resources
protected
#
# Extends new clients with the ServerClient module and initializes them.
#
def on_client_connect(cli)
cli.extend(ServerClient)
cli.init_cli(self)
end
#
# Processes data coming in from a client.
#
def on_client_data(cli)
begin
data = cli.read(65535)
raise ::EOFError if not data
raise ::EOFError if data.empty?
case cli.request.parse(data)
when Packet::ParseCode::Completed
dispatch_request(cli, cli.request)
cli.reset_cli
when Packet::ParseCode::Partial
# Return and wait for the on_client_data handler to be called again
# The Request object tracks the state of the request for us
return
when Packet::ParseCode::Error
close_client(cli)
end
rescue EOFError
if (cli.request.completed?)
dispatch_request(cli, cli.request)
cli.reset_cli
end
close_client(cli)
end
end
#
# Dispatches the supplied request for a given connection.
#
def dispatch_request(cli, request)
# Is the client requesting keep-alive?
if ((request['Connection']) and
(request['Connection'].downcase == 'Keep-Alive'.downcase))
cli.keepalive = true
end
# Search for the resource handler for the requested URL. This is pretty
# inefficient right now, but we can spruce it up later.
p = nil
len = 0
root = nil
resources.each_pair { |k, val|
if (request.resource =~ /^#{k}/ and k.length > len)
p = val
len = k.length
root = k
end
}
if (p)
# Create an instance of the handler for this resource
handler = p[0].new(self, *p[2])
# If the handler class requires a relative resource...
if (handler.relative_resource_required?)
# Substituted the mount point root in the request to make things
# relative to the mount point.
request.relative_resource = request.resource.gsub(/^#{root}/, '')
request.relative_resource = '/' + request.relative_resource if (request.relative_resource !~ /^\//)
end
# If we found the resource handler for this resource, call its
# procedure.
if (p[1] == true)
Rex::ThreadFactory.spawn("HTTPServerRequestHandler", false) {
handler.on_request(cli, request)
}
else
handler.on_request(cli, request)
end
else
elog("Failed to find handler for resource: #{request.resource}",
LogSource)
send_e404(cli, request)
end
# If keep-alive isn't enabled for this client, close the connection
if (cli.keepalive == false)
close_client(cli)
end
end
end
end
end
end
| 23.650386 | 107 | 0.625109 |
bf232cee5b8d60806d712a791357fdcc8c522ce4 | 2,528 |
require 'rails_helper'
RSpec.describe BidsController, type: :controller do
describe 'testing bids controller' do
before do
@user_seller = FactoryBot.create(:user)
@lot_pending = FactoryBot.create(:lot, user: @user_seller)
@lot_closed = FactoryBot.create(:lot, :closed, user: @user_seller)
@lot = FactoryBot.create(:lot, :in_process, user: @user_seller)
end
describe "if not authorized user" do
it "create action of bids forbidden" do
get :create, params: {lot_id: @lot.id, proposed_price: 10}
expect(response).to have_http_status(401)
end
end
describe 'authorised user' do
before do
request.headers.merge! @user_seller.create_new_auth_token
end
it 'if lot with current id not exists or not finded - exception "Lot not found"' do
expect {
post :create, params: {lot_id: 123456, proposed_price: 10}
}.to raise_error('Lot not found')
end
describe 'is seller of lot' do
it 'if user is seller of the lot - he cant create bid' do
expect {
post :create, params: {lot_id: @lot.id, proposed_price: 10}
}.to raise_error('Lot seller cant create bid')
end
end
describe 'is customer of lot' do
before do
login_user
end
it 'cant create bid if lot have :pending status' do
expect {
post :create, params: {lot_id: @lot_pending.id,
proposed_price: (@lot_pending.current_price + 10)}
}.to raise_error('Forbidden - lot status is not in_process')
end
it 'cant create bid if lot have :closed status' do
expect {
post :create, params: {lot_id: @lot_pending.id,
proposed_price: (@lot_closed.current_price + 10)}
}.to raise_error('Forbidden - lot status is not in_process')
end
it 'if bid have mistakes - response bid errors' do
@newbid = @user.bids.build(lot_id: @lot.id)
@newbid.valid?
post :create, params: {lot_id: @lot.id, user_id: @user.id}
expect(response.body).to eq(@newbid.errors.messages.to_json)
expect(response).to have_http_status(403)
end
it 'can create bid if lot have :in_process status' do
post :create, params: {lot_id: @lot.id,
proposed_price: (@lot.current_price + 10)}
expect(response).to have_http_status(200)
end
end
end
end
end
| 32 | 89 | 0.607991 |
d540ebf74e31386dc28e637fd0469b05f15ce76d | 1,203 | Given /^community "(.*?)" allows only organizations$/ do |community|
c = Community.where(ident: community).first
c.only_organizations = true
c.save!
end
Given /^I signup as an organization "(.*?)" with name "(.*?)"$/ do |org_username, org_display_name|
steps %Q{
Given I am on the signup page
When I fill in "person[username]" with "#{org_username}"
And I fill in "person[organization_name]" with "#{org_display_name}"
And I fill in "person_password1" with "test"
And I fill in "Confirm password" with "test"
And I fill in "Email address" with random email
And I check "person[terms]"
And I press "Create account"
}
end
Then /^there should be an organization account "(.*?)"$/ do |org_username|
o = Person.find_by_username(org_username)
o.is_organization.should be_truthy
end
Then /^I should see flash error$/ do
find(".flash-error").should be_visible
end
Given /^there is an organization "(.*?)"$/ do |org_username|
FactoryGirl.create(:person, :username => org_username, :is_organization => true)
end
Given /^"(.*?)" is not an organization$/ do |username|
user = Person.find_by_username(username)
user.is_organization = false
user.save!
end
| 31.657895 | 99 | 0.697423 |
ab4479819c09a16c914dff2614b9847c56f0652a | 1,112 | class Bcpp < Formula
desc "C(++) beautifier"
homepage "https://invisible-island.net/bcpp/"
url "ftp://ftp.invisible-island.net/bcpp/bcpp-20150811.tgz"
sha256 "6a18d68a09c4a0e8bf62d23d13ed7c8a62c98664a655f9d648bc466240ce97c3"
bottle do
cellar :any_skip_relocation
sha256 "ca36fc5ff5890cebc995c184c9cd80d441fe5dd407d9a9ce11d662ce88df7551" => :high_sierra
sha256 "c25d34a2e112bcdd0321d97629aa52cbfd594c1216876e759269df6ea3289e2f" => :sierra
sha256 "7494b0aa2c2e24050eea15913c7c6a443f5bfed2640a3e53ee5fb2a3260b6495" => :el_capitan
sha256 "d4f058c5d33b3cdffa2e844777bbd5aaa4f9b977f4cfe7ac9a31e4c0547161b0" => :yosemite
end
def install
system "./configure", "--prefix=#{prefix}", "--mandir=#{man}"
system "make", "install"
etc.install "bcpp.cfg"
end
test do
(testpath/"test.txt").write <<-EOS.undent
test
test
test
test
EOS
system bin/"bcpp", "test.txt", "-fnc", "#{etc}/bcpp.cfg"
assert_predicate testpath/"test.txt.orig", :exist?
assert_predicate testpath/"test.txt", :exist?
end
end
| 33.69697 | 93 | 0.705935 |
1cfcad4232fb683e2e0f9147ec3cddd86bce7e14 | 701 | class AddAbilityForAuctionToEndAt2359TheSameDay < ActiveRecord::Migration[5.2]
def up
auction_duration_description = <<~TEXT.squish
Number of hours for which an auction is created. You can also use 'end_of_day'
for auctions to end at the end of the same calendar day. Default: 24.
TEXT
setting = Setting.find_by(code: :auction_duration)
setting.update!(description: auction_duration_description)
end
def down
auction_duration_description = <<~TEXT.squish
Number of hours for which an auction is created. Default: 24
TEXT
setting = Setting.find_by(code: :auction_duration)
setting.update!(description: auction_duration_description)
end
end
| 31.863636 | 84 | 0.746077 |
ac1c052fd2fbdcc26f835d4d6462baa0189669b3 | 334 | class CreateCourses < ActiveRecord::Migration[6.0]
def up
create_table :courses do |t|
t.string :title, null: false, index: { unique: true }
t.text :content, null: false
t.integer :credit_hour, null: false, default: 0
t.timestamps null: false
end
end
def down
drop_table :courses
end
end
| 20.875 | 59 | 0.649701 |
ed626cf99063d398f855e9836ce390030f9f13af | 1,863 | module OpenActive
module Models
module Schema
class Course < ::OpenActive::Models::Schema::CreativeWork
# @!attribute type
# @return [String]
def type
"schema:Course"
end
# @return [String,OpenActive::Models::Schema::AlignmentObject,OpenActive::Models::Schema::Course,URI]
define_property :course_prerequisites, as: "coursePrerequisites", types: [
"string",
"OpenActive::Models::Schema::AlignmentObject",
"OpenActive::Models::Schema::Course",
"URI",
]
# @return [OpenActive::Models::Schema::CourseInstance,URI]
define_property :has_course_instance, as: "hasCourseInstance", types: [
"OpenActive::Models::Schema::CourseInstance",
"URI",
]
# @return [String]
define_property :course_code, as: "courseCode", types: [
"string",
]
# @return [URI,String,OpenActive::Models::Schema::EducationalOccupationalCredential]
define_property :occupational_credential_awarded, as: "occupationalCredentialAwarded", types: [
"URI",
"string",
"OpenActive::Models::Schema::EducationalOccupationalCredential",
]
# @return [OpenActive::Models::Schema::StructuredValue,int,URI,nil]
define_property :number_of_credits, as: "numberOfCredits", types: [
"OpenActive::Models::Schema::StructuredValue",
"int",
"URI",
"null",
]
# @return [URI,String,OpenActive::Models::Schema::EducationalOccupationalCredential]
define_property :educational_credential_awarded, as: "educationalCredentialAwarded", types: [
"URI",
"string",
"OpenActive::Models::Schema::EducationalOccupationalCredential",
]
end
end
end
end
| 33.872727 | 109 | 0.6146 |
6204474736beb4879f8d142fcae2484a6a7396ad | 471 | require 'fog/telefonica'
require 'time'
auth_url = "http://10.0.0.101:5000/v2.0/tokens"
username = 'admin'
password = 'D78JVyRnzJG8j7Mb6fgpeUMp7'
@connection_params = {
:telefonica_auth_url => auth_url,
:telefonica_username => username,
:telefonica_api_key => password,
}
puts "### SERVICE CONNECTION ###"
event_service = Fog::Event::Telefonica.new(@connection_params)
p event_service
puts "### LIST EVENTS ###"
p event_service.events.all
| 20.478261 | 62 | 0.698514 |
1d055650523b5723230a08a647d2016fe493d67d | 398 | cask 'amidst' do
version '4.2'
sha256 'dcc3692207ab4b386bc74a2be087bcd3b52f641a7f0cf505c166a7d8eccb0946'
url "https://github.com/toolbox4minecraft/amidst/releases/download/v#{version}/amidst-v#{version.dots_to_hyphens}.zip"
appcast 'https://github.com/toolbox4minecraft/amidst/releases.atom'
name 'amidst'
homepage 'https://github.com/toolbox4minecraft/amidst'
app 'Amidst.app'
end
| 33.166667 | 120 | 0.786432 |
d5329b89b1b266e5c48d1cc3467c868041766c91 | 301 | class Navigator < ActiveRecord::Base
belongs_to :navigatable, polymorphic: true
belongs_to :block, touch: true
validates_presence_of :name, :block_id, :navigatable_id, :navigatable_type
def self.list(block_id)
includes(:navigatable).where(block_id: block_id).order("position")
end
end
| 27.363636 | 76 | 0.767442 |
d5286c44a98672381cb296fcaf91491106fe811d | 386 | # == Schema Information
#
# Table name: environments
#
# id :integer not null, primary key
# name :string(255)
# description :string(255)
# application_id :integer
# created_at :datetime
# updated_at :datetime
#
require 'test_helper'
class EnvironmentTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 19.3 | 57 | 0.629534 |
1a61f3449467ba477fcd93e03a2305a23efac7dd | 3,759 | require 'test_helper'
class DomainConstraintsTest < ActiveSupport::TestCase
def setup
ThreeScale::DevDomain.stubs(enabled?: false)
end
class BuyerDomainConstraintsTest < DomainConstraintsTest
setup do
ThreeScale.config.stubs(tenant_mode: 'multitenant')
@domain = 'domain.example.com'
@request = mock
@request.stubs(:host).returns(@domain)
end
attr_reader :domain, :request
test 'master domain is not a buyer domain' do
request.stubs(:host).returns(master_account.domain)
refute BuyerDomainConstraint.matches?(request)
end
test 'multitenant accepting buyer domain' do
FactoryBot.create(:simple_provider, domain: domain)
assert Account.exists?(domain: domain)
assert BuyerDomainConstraint.matches?(request)
end
test 'multitenant not recognizing a non-existent buyer domain' do
refute Account.exists?(domain: domain)
refute BuyerDomainConstraint.matches?(request)
end
test 'multitenant not recognizing a buyer domain of a provider scheduled for deletion' do
provider = FactoryBot.create(:simple_provider, domain: domain)
provider.schedule_for_deletion!
assert Account.exists?(domain: domain)
refute BuyerDomainConstraint.matches?(request)
end
end
class ProviderDomainConstraintTest < DomainConstraintsTest
setup do
ThreeScale.config.stubs(tenant_mode: 'multitenant')
@self_domain = 'admin.example.com'
@request = mock
@request.stubs(:host).returns(@self_domain)
AuthenticatedSystem::Request.any_instance.stubs(:zync?).returns(false)
end
attr_reader :self_domain, :request
test 'multitenant accepting provider domain' do
FactoryBot.create(:simple_provider, self_domain: self_domain)
assert Account.exists?(self_domain: self_domain)
assert ProviderDomainConstraint.matches?(request)
end
test 'multitenant not recognizing a non-existent provider domain' do
refute Account.exists?(self_domain: self_domain)
refute ProviderDomainConstraint.matches?(request)
end
test 'multitenant not recognizing a domain of a provider scheduled for deletion' do
provider = FactoryBot.create(:simple_provider, self_domain: self_domain)
provider.schedule_for_deletion!
assert Account.exists?(self_domain: self_domain)
refute ProviderDomainConstraint.matches?(request)
end
test 'multitenant recognizing a domain of a provider scheduled for deletion if the request comes from Zync' do
provider = FactoryBot.create(:simple_provider, self_domain: self_domain)
provider.schedule_for_deletion!
AuthenticatedSystem::Request.any_instance.stubs(:zync?).returns(true)
assert Account.exists?(self_domain: self_domain)
assert ProviderDomainConstraint.matches?(request)
end
test 'master domain' do
master = master_account
request = mock
request.expects(:host).returns(master.domain)
refute ProviderDomainConstraint.matches?(request)
end
end
class MasterDomainConstraintTest < DomainConstraintsTest
test 'master domain' do
master = master_account
request = mock
request.expects(:host).returns(master.domain)
assert MasterDomainConstraint.matches?(request)
end
test 'accepts any domain on premises' do
ThreeScale.config.stubs(onpremises: true)
ThreeScale.config.stubs(tenant_mode: 'master')
master = master_account
request = mock
request.stubs(:host).returns(master.domain)
assert MasterDomainConstraint.matches?(request)
request.stubs(:host).returns('different' + master.domain)
assert MasterDomainConstraint.matches?(request)
end
end
end
| 31.588235 | 114 | 0.727321 |
015245bba48bc8fff567010fadcda5faf9f5f642 | 608 | require 'chefspec'
require 'chefspec/berkshelf'
# Spec helper for np-web
module SpecHelper
@@runner = {} # rubocop:disable Style/ClassVars
def common_stubs
stub_command('which nginx').and_return('/usr/bin/nginx')
stub_data_bag_item('certificates', 'nginx-default').and_return(
'cert' => 'some_cert',
'key' => 'some_key',
)
end
def memoized_runner(recipe)
@@runner[recipe] ||= begin
runner = ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '20.04')
runner.converge recipe
end
end
end
RSpec.configure do |config|
config.include SpecHelper
end
| 21.714286 | 77 | 0.680921 |
1dd5f7f86f95a070ff1d7291a315e755730daf53 | 1,762 | require "spec_helper"
describe RoutesListController do
before do
@user_id = rand(999999).to_s
end
before :each do
request.env["HTTP_ACCEPT"] = 'application/json'
end
it "should not list any routes for not logged in users" do
get :smoke_test_routes
expect(response.status).to eq(403)
expect(response.body.blank?).to be_truthy
end
it "should not list any routes for non-superusers" do
User::Auth.stub(:where).and_return([User::Auth.new(uid: @user_id, is_superuser: false, active: true)])
session[:user_id] = @user_id
get :smoke_test_routes
expect(response.status).to eq(403)
expect(response.body.blank?).to be_truthy
end
it 'should not list any routes for viewers' do
allow(Settings.features).to receive(:reauthentication).and_return(false)
viewer_id = random_id
allow(User::Auth).to receive(:get) do |uid|
if uid == @user_id
User::Auth.new(uid: @user_id, is_superuser: true, active: true)
else
User::Auth.new(uid: uid, is_superuser: false, active: true)
end
end
session[:user_id] = @user_id
session[:original_user_id] = viewer_id
get :smoke_test_routes
expect(response.status).to eq(403)
expect(response.body.blank?).to be_truthy
end
it "should list some /api/ routes for superusers" do
User::Auth.stub(:where).and_return([User::Auth.new(uid: @user_id, is_superuser: true, active: true)])
session[:user_id] = @user_id
get :smoke_test_routes
assert_response :success
json_response = JSON.parse(response.body)
json_response['routes'].present?.should be_truthy
bad_entries = json_response['routes'].select {|route| !route.start_with? '/api/' }
expect(bad_entries.empty?).to be_truthy
end
end
| 31.464286 | 106 | 0.696368 |
62c8ecf3fb89bf23ef0f649a4c37a9accac45521 | 2,099 | # Copyright:: (c) Autotelik Media Ltd 2015
# Author :: Tom Statter
# Date :: Feb 2015
# License:: MIT
#
# Details:: Read mappings and provide cache type services for source=>destination mappings
#
require 'erubis'
module DataShift
module Exporters
class Configuration < DataShift::Configuration
# @param [Boolean] Stop processing and abort if a row fails to export
# Default is false
# @return [Boolean]
#
attr_accessor :abort_on_failure
# @param [Char] Char to use as the column delimter for csv format
# @return [Char]
#
attr_accessor :csv_delimiter
# @param [Boolean] Export association data in single column in JSON format
# @return [Boolean]
#
attr_accessor :json
# @param [String] Name for worksheet, otherwise uses Class name
# @return [String]
#
attr_accessor :sheet_name
def initialize
super
@abort_on_failure = false
@csv_delimiter = ','
@json = false
@sheet_name = ''
end
# @return [DataShift::Exporters::Configuration] DataShift's current configuration
def self.call
@configuration ||= Exporters::Configuration.new
end
def self.reset
@configuration = Exporters::Configuration.new
end
# Set DataShift's configure
# @param config [DataShift::Exporters::Configuration]
class << self
attr_writer :configuration
end
# Modify DataShift's current Export configuration
# ```
# DataShift::Exporters::Configuration.configure do |config|
# config.abort_on_failure = false
# end
# ```
def self.configure
yield call
end
# Modify DataShift's current Export configuration from an options hash
def self.from_hash( options )
DataShift::Configuration.from_hash(options)
DataShift::Exporters::Configuration.configure do |config|
config.csv_delimiter = options[:csv_delimiter] if(options[:csv_delimiter])
end
end
end
end
end
| 24.694118 | 92 | 0.633635 |
ed1b42880b11368893608102e4066cccb65ffdd5 | 1,581 | #
# Be sure to run `pod lib lint KKPodTest.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'KKPodTest'
s.version = '0.0.4'
s.summary = 'lees A short description of KKPodTest.'
# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!
s.description = <<-DESC
TODO: Add long description of the pod here.
DESC
s.homepage = 'https://github.com/LeeZC/KKPodTest.git'
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'lzc' => '[email protected]' }
s.source = { :git => 'https://github.com/LeeZC/KKPodTest.git', :tag => s.version.to_s }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
s.ios.deployment_target = '9.0'
s.source_files = 'KKPodTest/Classes/**/*'
# s.resource_bundles = {
# 'KKPodTest' => ['KKPodTest/Assets/*.png']
# }
# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
# s.dependency 'AFNetworking', '~> 2.3'
end
| 36.767442 | 99 | 0.633144 |
e293b5cfbf13e09eb5b100e54e377108d95214f1 | 656 | # frozen_string_literal: true
require "rake"
RSpec.describe "timestamp_migrator_undo_extension" do
def create_migrator
Sequel::TimestampMigrator.new(DB, "spec/files/migrations")
end
before { create_migrator.run }
specify do
expect(DB.tables).to include(:first_table, :second_table)
create_migrator.undo(1549624163)
expect(DB.tables).not_to include(:first_table)
end
context "with missing migration" do
it "raises proper error" do
expect { create_migrator.undo(20201202130630) }.to raise_error(
Sequel::Migrator::Error, "Migration 20201202130630 does not exist in the filesystem"
)
end
end
end
| 25.230769 | 92 | 0.733232 |
e834ec96857f2d6b3661b90ab2257b55ab20eb32 | 294 | require "rails_helper"
RSpec.describe "pages/home.html.erb", type: :view do
it "displays the gov banner" do
assign(:search, {})
render template: "pages/home", layout: "layouts/application"
expect(rendered).to match "An official website of the United States government"
end
end
| 29.4 | 83 | 0.721088 |
e985a6464a92402ce7d62755d70d220731559966 | 4,068 | #
# Copyright (c) 2009-2011 RightScale 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 File.expand_path('../../spec_helper', __FILE__)
require File.normalize_path(File.join(File.dirname(__FILE__), '..', '..', 'lib', 'instance'))
require File.normalize_path(File.join(File.dirname(__FILE__), '..', '..', 'lib', 'instance', 'cook'))
require File.normalize_path(File.join(File.dirname(__FILE__), '..', '..', 'lib', 'clouds'))
require File.normalize_path(File.join(File.dirname(__FILE__), '..', '..', 'lib', 'chef', 'right_providers'))
shared_examples_for 'generates cookbook for chef runner' do
before(:all) do
create_cookbook
end
after(:all) do
cleanup
end
end
shared_examples_for 'mocks logging' do
require File.normalize_path(File.join(File.dirname(__FILE__), 'mock_auditor_proxy'))
include RightScale::Test::MockAuditorProxy
# Asserts that the given text appears somewhere in the log for the given level.
#
# === Parameters
# level(String|Token):: logger level to find
# str_to_match(String):: literal text to find
#
# === Returns
# result(true|false):: true if found text
def log_should_contain_text(level, str_to_match, invert_should=false)
# remove newlines and spaces to handle any line-wrapping weirdness (in Windows), etc.
expected_message = Regexp.escape(str_to_match.gsub(/\s+/, ''))
# un-escape the escaped regex strings
expected_message.gsub!("\\.\\*", ".*")
# should contain the expected exception
kind = (level.to_s + '_text').to_sym
logged_output = @logger.send(kind)
actual_message = logged_output.gsub(/\s+/, '')
if invert_should
actual_message.should_not match(expected_message)
else
actual_message.should match(expected_message)
end
end
# Asserts that the given text does not appear somewhere in the log for the given level.
#
# === Parameters
# level(String|Token):: logger level to find
# str_to_match(String):: literal text to find
#
# === Returns
# result(true|false):: true if found text
def log_should_not_contain_text(level, str_to_match)
log_should_contain_text(level, str_to_match, invert_should=true)
end
# Asserts the given logger level has no logged messages.
#
# === Parameters
# level(String|Token):: logger level to find
#
# === Returns
# result(true|false):: true if found any logged messages
def log_should_be_empty(level)
kind = (level.to_s + '_text').to_sym
@logger.send(kind).strip.should == ''
end
before(:each) do
@logger = RightScale::Test::MockLogger.new
mock_chef_log(@logger)
mock_right_link_log(@logger)
@auditor = flexmock(RightScale::AuditStub.instance)
@auditor.should_receive(:create_new_section).and_return { |m| @logger.audit_section << m }
@auditor.should_receive(:append_info).and_return { |m| @logger.audit_info << m }
@auditor.should_receive(:append_output).and_return { |m| @logger.audit_output << m }
@auditor.should_receive(:update_status).and_return { |m| @logger.audit_status << m }
end
end
| 38.377358 | 108 | 0.721976 |
61689be4de21d7d5bf7068964cb6fdc8cb4ca38b | 1,917 | #
# Cookbook Name:: cfncluster
# Recipe:: _compute_base_config
#
# Copyright 2013-2015 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "LICENSE.txt" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and
# limitations under the License.
# Created shared mount point
directory node['cfncluster']['cfn_shared_dir'] do
mode '1777'
owner 'root'
group 'root'
recursive true
action :create
end
node.default['cfncluster']['cfn_master'] = node['cfncluster']['cfn_master'].split('.')[0]
nfs_master = node['cfncluster']['cfn_master']
# Mount shared volume over NFS
mount node['cfncluster']['cfn_shared_dir'] do
device "#{nfs_master}:#{node['cfncluster']['cfn_shared_dir']}"
fstype 'nfs'
options 'hard,intr,noatime,vers=3,_netdev'
action %i[mount enable]
end
# Mount /home over NFS
mount '/home' do
device "#{nfs_master}:/home"
fstype 'nfs'
options 'hard,intr,noatime,vers=3,_netdev'
action %i[mount enable]
end
# Configure Ganglia
template '/etc/ganglia/gmond.conf' do
source 'gmond.conf.erb'
owner 'root'
group 'root'
mode '0644'
end
service node['cfncluster']['ganglia']['gmond_service'] do
supports restart: true
action %i[enable restart]
end
# Setup cluster user
user node['cfncluster']['cfn_cluster_user'] do
supports manage_home: false
comment 'cfncluster user'
home "/home/#{node['cfncluster']['cfn_cluster_user']}"
shell '/bin/bash'
end
# Install nodewatcher.cfg
template '/etc/nodewatcher.cfg' do
source 'nodewatcher.cfg.erb'
owner 'root'
group 'root'
mode '0644'
end
| 26.260274 | 121 | 0.725091 |
ab518b3281d7f0fe563e02c85e0976b492b3d8cb | 12,608 | module Neo4j
module ActiveNode
module Query
# rubocop:disable Metrics/ModuleLength
module QueryProxyMethods
# rubocop:enable Metrics/ModuleLength
FIRST = 'HEAD'
LAST = 'LAST'
def rels
fail 'Cannot get rels without a relationship variable.' if !@rel_var
pluck(@rel_var)
end
def rel
rels.first
end
def as(node_var)
new_link(node_var)
end
# Give ability to call `#find` on associations to get a scoped find
# Doesn't pass through via `method_missing` because Enumerable has a `#find` method
def find(*args)
scoping { @model.find(*args) }
end
def first(target = nil)
first_and_last(FIRST, target)
end
def last(target = nil)
first_and_last(LAST, target)
end
def order_property
# This should maybe be based on a setting in the association
# rather than a hardcoded `nil`
model ? model.id_property_name : nil
end
def distinct
new_link.tap do |e|
e.instance_variable_set(:@distinct, true)
end
end
def propagate_context(query_proxy)
query_proxy.instance_variable_set(:@distinct, @distinct)
end
# @return [Integer] number of nodes of this class
def count(distinct = nil, target = nil)
return 0 if unpersisted_start_object?
fail(Neo4j::InvalidParameterError, ':count accepts the `:distinct` symbol or nil as a parameter') unless distinct.nil? || distinct == :distinct
query_with_target(target) do |var|
q = ensure_distinct(var, !distinct.nil?)
limited_query = self.query.clause?(:limit) ? self.query.break.with(var) : self.query.reorder
limited_query.pluck("count(#{q}) AS #{var}").first
end
end
def size
result_cache? ? result_cache_for.length : count
end
delegate :length, to: :to_a
# TODO: update this with public API methods if/when they are exposed
def limit_value
return unless self.query.clause?(:limit)
limit_clause = self.query.send(:clauses).find { |clause| clause.is_a?(Neo4j::Core::QueryClauses::LimitClause) }
limit_clause.instance_variable_get(:@arg)
end
def empty?(target = nil)
return true if unpersisted_start_object?
query_with_target(target) { |var| !self.exists?(nil, var) }
end
alias blank? empty?
# @param [Neo4j::ActiveNode, Neo4j::Node, String] other An instance of a Neo4j.rb model, a Neo4j-core node, or a string uuid
# @param [String, Symbol] target An identifier of a link in the Cypher chain
# @return [Boolean]
def include?(other, target = nil)
query_with_target(target) do |var|
where_filter = if other.respond_to?(:neo_id) || association_id_key == :neo_id
"ID(#{var}) = {other_node_id}"
else
"#{var}.#{association_id_key} = {other_node_id}"
end
node_id = other.respond_to?(:neo_id) ? other.neo_id : other
self.where(where_filter).params(other_node_id: node_id).query.reorder.return("count(#{var}) as count").first.count > 0
end
end
def exists?(node_condition = nil, target = nil)
unless [Integer, String, Hash, NilClass].any? { |c| node_condition.is_a?(c) }
fail(Neo4j::InvalidParameterError, ':exists? only accepts ids or conditions')
end
query_with_target(target) do |var|
start_q = exists_query_start(node_condition, var)
result = start_q.query.reorder.return("ID(#{var}) AS proof_of_life LIMIT 1").first
!!result
end
end
# Shorthand for `MATCH (start)-[r]-(other_node) WHERE ID(other_node) = #{other_node.neo_id}`
# The `node` param can be a persisted ActiveNode instance, any string or integer, or nil.
# When it's a node, it'll use the object's neo_id, which is fastest. When not nil, it'll figure out the
# primary key of that model. When nil, it uses `1 = 2` to prevent matching all records, which is the default
# behavior when nil is passed to `where` in QueryProxy.
# @param [#neo_id, String, Enumerable] node A node, a string representing a node's ID, or an enumerable of nodes or IDs.
# @return [Neo4j::ActiveNode::Query::QueryProxy] A QueryProxy object upon which you can build.
def match_to(node)
first_node = node.is_a?(Array) ? node.first : node
where_arg = if first_node.respond_to?(:neo_id)
{neo_id: node.is_a?(Array) ? node.map(&:neo_id) : node}
elsif !node.nil?
{association_id_key => node.is_a?(Array) ? ids_array(node) : node}
else
# support for null object pattern
'1 = 2'
end
self.where(where_arg)
end
# Gives you the first relationship between the last link of a QueryProxy chain and a given node
# Shorthand for `MATCH (start)-[r]-(other_node) WHERE ID(other_node) = #{other_node.neo_id} RETURN r`
# @param [#neo_id, String, Enumerable] node An object to be sent to `match_to`. See params for that method.
# @return A relationship (ActiveRel, CypherRelationship, EmbeddedRelationship) or nil.
def first_rel_to(node)
self.match_to(node).limit(1).pluck(rel_var).first
end
# Returns all relationships across a QueryProxy chain between a given node or array of nodes and the preceeding link.
# @param [#neo_id, String, Enumerable] node An object to be sent to `match_to`. See params for that method.
# @return An enumerable of relationship objects.
def rels_to(node)
self.match_to(node).pluck(rel_var)
end
alias all_rels_to rels_to
# When called, this method returns a single node that satisfies the match specified in the params hash.
# If no existing node is found to satisfy the match, one is created or associated as expected.
def find_or_create_by(params)
fail 'Method invalid when called on Class objects' unless source_object
result = self.where(params).first
return result unless result.nil?
Neo4j::ActiveBase.run_transaction do
node = model.create(params)
self << node
return node
end
end
def find_or_initialize_by(attributes, &block)
find_by(attributes) || initialize_by_current_chain_params(attributes, &block)
end
def first_or_initialize(attributes = {}, &block)
first || initialize_by_current_chain_params(attributes, &block)
end
# A shortcut for attaching a new, optional match to the end of a QueryProxy chain.
def optional(association, node_var = nil, rel_var = nil)
self.send(association, node_var, rel_var, optional: true)
end
# Takes an Array of ActiveNode models and applies the appropriate WHERE clause
# So for a `Teacher` model inheriting from a `Person` model and an `Article` model
# if you called .as_models([Teacher, Article])
# The where clause would look something like:
#
# .. code-block:: cypher
#
# WHERE (node_var:Teacher:Person OR node_var:Article)
def as_models(models)
where_clause = models.map do |model|
"`#{identity}`:" + model.mapped_label_names.map do |mapped_label_name|
"`#{mapped_label_name}`"
end.join(':')
end.join(' OR ')
where("(#{where_clause})")
end
# Matches all nodes having at least a relation
#
# @example Load all people having a friend
# Person.all.having_rel(:friends).to_a # => Returns a list of `Person`
#
# @example Load all people having a best friend
# Person.all.having_rel(:friends, best: true).to_a # => Returns a list of `Person`
#
# @return [QueryProxy] A new QueryProxy
def having_rel(association_name, rel_properties = {})
association = association_or_fail(association_name)
where("(#{identity})#{association.arrow_cypher(nil, rel_properties)}()")
end
# Matches all nodes not having a certain relation
#
# @example Load all people not having friends
# Person.all.not_having_rel(:friends).to_a # => Returns a list of `Person`
#
# @example Load all people not having best friends
# Person.all.not_having_rel(:friends, best: true).to_a # => Returns a list of `Person`
#
# @return [QueryProxy] A new QueryProxy
def not_having_rel(association_name, rel_properties = {})
association = association_or_fail(association_name)
where_not("(#{identity})#{association.arrow_cypher(nil, rel_properties)}()")
end
private
def association_or_fail(association_name)
model.associations[association_name] || fail(ArgumentError, "No such association #{association_name}")
end
def find_inverse_association!(model, source, association)
model.associations.values.find do |reverse_association|
association.inverse_of?(reverse_association) ||
reverse_association.inverse_of?(association) ||
inverse_relation_of?(source, association, model, reverse_association)
end || fail("Could not find reverse association for #{@context}")
end
def inverse_relation_of?(source, source_association, target, target_association)
source_association.direction != target_association.direction &&
source == target_association.target_class &&
target == source_association.target_class &&
source_association.relationship_class_name == target_association.relationship_class_name
end
def initialize_by_current_chain_params(params = {})
result = new(where_clause_params.merge(params))
inverse_association = find_inverse_association!(model, source_object.class, association) if source_object
result.tap do |m|
yield(m) if block_given?
m.public_send(inverse_association.name) << source_object if inverse_association
end
end
def where_clause_params
query.clauses.select { |c| c.is_a?(Neo4j::Core::QueryClauses::WhereClause) && c.arg.is_a?(Hash) }
.map! { |e| e.arg[identity] }.compact.inject { |a, b| a.merge(b) } || {}
end
def first_and_last(func, target)
new_query, pluck_proc = if self.query.clause?(:order)
[self.query.with(identity),
proc { |var| "#{func}(COLLECT(#{var})) as #{var}" }]
else
[self.order(order_property).limit(1),
proc { |var| var }]
end
query_with_target(target) do |var|
final_pluck = pluck_proc.call(var)
new_query.pluck(final_pluck)
end.first
end
# @return [String] The primary key of a the current QueryProxy's model or target class
def association_id_key
self.association.nil? ? model.primary_key : self.association.target_class.primary_key
end
# @param [Enumerable] node An enumerable of nodes or ids.
# @return [Array] An array after having `id` called on each object
def ids_array(node)
node.first.respond_to?(:id) ? node.map(&:id) : node
end
def query_with_target(target)
yield(target || identity)
end
def exists_query_start(condition, target)
case condition
when Integer
self.where("ID(#{target}) = {exists_condition}").params(exists_condition: condition)
when Hash
self.where(condition.keys.first => condition.values.first)
when String
self.where(model.primary_key => condition)
else
self
end
end
end
end
end
end
| 41.748344 | 153 | 0.603823 |
7976ec221b3492adc050661983cdec760c65c8ff | 270 | # frozen_string_literal: true
require "test_helper"
# Tests to assure external pages are accessible.
class ExternalControllerTest < ActionDispatch::IntegrationTest
test "should get privacy policy" do
get privacy_policy_url
assert_response :success
end
end
| 22.5 | 62 | 0.796296 |
26a5d4829de54634dd533cfa424e390746846cb7 | 656 | module I18n
module Gettext
PLURAL_SEPARATOR = "\001"
CONTEXT_SEPARATOR = "\004"
autoload :Helpers, 'i18n/gettext/helpers'
@@plural_keys = { :en => [:one, :other] }
class << self
# returns an array of plural keys for the given locale so that we can
# convert from gettext's integer-index based style
# TODO move this information to the pluralization module
def plural_keys(locale)
@@plural_keys[locale] || @@plural_keys[:en]
end
def extract_scope(msgid, separator)
scope = msgid.to_s.split(separator)
msgid = scope.pop
[scope, msgid]
end
end
end
end
| 25.230769 | 75 | 0.629573 |
e2d9fe749ddca30b1a372ba858c28120688c05c3 | 751 | class Ability
include Hydra::Ability
include Hyrax::Ability
self.ability_logic += %i[
everyone_can_create_curation_concerns
group_permissions
superadmin_permissions
]
# Define any customized permissions here.
def custom_permissions
can [:create], Account
end
def admin_permissions
return unless admin?
return if superadmin?
super
can [:manage], [Site, Role, User]
can [:read, :update], Account do |account|
account == Site.account
end
end
def group_permissions
return unless admin?
can :manage, Hyku::Group
end
def superadmin_permissions
return unless superadmin?
can :manage, :all
end
def superadmin?
current_user.has_role? :superadmin
end
end
| 17.068182 | 46 | 0.693742 |
e2215d3dd746cbb384884c5d82a3a512f8f3631c | 1,022 | module Zoomus
module Actions
module Report
def report_getaccountreport(*args)
options = Utils.extract_options!(args)
Utils.require_params([:from, :to], options)
Utils.process_datetime_params!([:from, :to], options)
Utils.parse_response self.class.post("/report/getaccountreport", :query => options)
end
def report_getaudioreport(*args)
options = Utils.extract_options!(args)
Utils.require_params([:from, :to], options)
Utils.process_datetime_params!([:from, :to], options)
Utils.parse_response self.class.post("/report/getaudioreport", :query => options)
end
def report_getuserreport(*args)
options = Utils.extract_options!(args)
Utils.require_params([:user_id, :from, :to], options)
Utils.process_datetime_params!([:from, :to], options)
Utils.parse_response self.class.post("/report/getuserreport", :query => options)
end
Utils.define_bang_methods(self)
end
end
end
| 32.967742 | 91 | 0.665362 |
62e5a6a8c21b4346e3591fc474a5dc7b62792e39 | 347 | # frozen_string_literal: true
# fruit_prices = {
# banana: 1.05
# }
fruit_prices = Hash.new('Not found')
fruit_prices[:banana] = 1.05
fruit_prices[:orange] = 0.69
fruit_prices[:kiwi] = 10.99
p(fruit_prices[:steak])
p(fruit_prices[:celery])
p(fruit_prices[:mushrooms])
p(fruit_prices[:banana])
p(fruit_prices[:orange])
p(fruit_prices[:kiwi])
| 18.263158 | 36 | 0.717579 |
797cc42a03c507454ae2534fcee2992926435446 | 978 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::WordDiff::Segments::Chunk do
subject(:chunk) { described_class.new(line) }
let(:line) { ' Hello' }
describe '#removed?' do
subject { chunk.removed? }
it { is_expected.to be_falsey }
context 'when line starts with "-"' do
let(:line) { '-Removed' }
it { is_expected.to be_truthy }
end
end
describe '#added?' do
subject { chunk.added? }
it { is_expected.to be_falsey }
context 'when line starts with "+"' do
let(:line) { '+Added' }
it { is_expected.to be_truthy }
end
end
describe '#to_s' do
subject { chunk.to_s }
it 'removes lead string modifier' do
is_expected.to eq('Hello')
end
context 'when chunk is empty' do
let(:line) { '' }
it { is_expected.to eq('') }
end
end
describe '#length' do
subject { chunk.length }
it { is_expected.to eq('Hello'.length) }
end
end
| 18.111111 | 51 | 0.605317 |
e2408a91cfefd8bc3482d7b78987b4477251dccf | 707 | require 'spec_helper'
describe "RailsAdmin Basic Bulk Action" do
subject { page }
before(:each) do
@players = 2.times.map { FactoryGirl.create :player }
end
describe "bulk_delete" do
it "shows names of to-be-deleted players" do
page.driver.post(bulk_action_path(:bulk_action => 'bulk_delete', :model_name => "player", :bulk_ids => @players.map(&:id)))
@players.each { |player| should have_content(player.name) }
end
end
describe "bulk_export" do
it "shows form for export" do
visit index_path(:model_name => "player")
click_link "Export found Players"
@players.each { |player| should have_content("Select fields to export") }
end
end
end
| 27.192308 | 129 | 0.676096 |
b9e3723d8d2e539174d90a63bd85bb86bee40e03 | 1,241 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
Gem::Specification.new do |spec|
spec.name = 'aws-sdk-dax'
spec.version = File.read(File.expand_path('../VERSION', __FILE__)).strip
spec.summary = 'AWS SDK for Ruby - Amazon DAX'
spec.description = 'Official AWS Ruby gem for Amazon DynamoDB Accelerator (DAX) (Amazon DAX). This gem is part of the AWS SDK for Ruby.'
spec.author = 'Amazon Web Services'
spec.homepage = 'https://github.com/aws/aws-sdk-ruby'
spec.license = 'Apache-2.0'
spec.email = ['[email protected]']
spec.require_paths = ['lib']
spec.files = Dir['LICENSE.txt', 'CHANGELOG.md', 'VERSION', 'lib/**/*.rb']
spec.metadata = {
'source_code_uri' => 'https://github.com/aws/aws-sdk-ruby/tree/version-3/gems/aws-sdk-dax',
'changelog_uri' => 'https://github.com/aws/aws-sdk-ruby/tree/version-3/gems/aws-sdk-dax/CHANGELOG.md'
}
spec.add_dependency('aws-sdk-core', '~> 3', '>= 3.112.0')
spec.add_dependency('aws-sigv4', '~> 1.1')
end
| 38.78125 | 140 | 0.662369 |
bbf2e140cf18e9f99aa9aeecdc9fffc006319a28 | 553 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Nanites::Compounds::MatchNoneCompound do
it_behaves_like :ClassLoader
it_behaves_like :Compound, [NoneCommand.new, SomeCommand.new]
let :command_queue do
[NoneCommand.new, SomeCommand.new]
end
context 'when executed' do
it 'has only None results in the context' do
compound = described_class.new *command_queue
context = compound.execute!
context.each_value do |value|
expect(value.option.none?).to be_truthy
end
end
end
end
| 23.041667 | 63 | 0.725136 |
28643fb7eaa6b16f54091848073ff495c3feca32 | 38 | ClerkRails::Engine.routes.draw do
end
| 12.666667 | 33 | 0.815789 |
3301cad91cdd7c1ebda0d77f5e83adb5c9bd9704 | 430 | module Hbc
class CLI
class Base
def self.command_name
@command_name ||= name.sub(/^.*:/, "").gsub(/(.)([A-Z])/, '\1_\2').downcase
end
def self.visible
true
end
def self.cask_tokens_from(args)
args.reject { |a| a.empty? || a.chars.first == "-" }
end
def self.help
nil
end
def self.needs_init?
false
end
end
end
end
| 16.538462 | 83 | 0.497674 |
5dd731f2ab98235afd4d981a8bc60dc4eae87ef6 | 1,086 | # rubocop:disable Style/AsciiComments
# Module mixed into Field that encapsulates all the style logic (single,
# multiple, required, optional, etc.).
module Field::Style
CHOICES = {
"single" => "Single value – optional",
"single-required" => "Single value – required",
"multiple" => "Multiple values – optional",
"multiple-required" => "Multiple values – at least one",
# TODO: uncomment once ordering behavior is supported
# "multiple-ordered" => "Multiple ordered values – optional",
# "multiple-ordered-required" => "Multiple ordered values – at least one"
}.freeze
def style_choices
CHOICES.select do |key, _name|
key =~ /single/ || allows_multiple?
end
end
# TODO: test
def style=(key)
return if key.blank?
self.required = !!(key =~ /required/)
self.multiple = !!(key =~ /multiple/)
self.ordered = !!(key =~ /ordered/)
end
def style
key = []
key << (multiple? ? "multiple" : "single")
key << "ordered" if multiple? && ordered?
key << "required" if required?
key.join("-")
end
end
| 27.846154 | 77 | 0.632597 |
62a2b49c4fc47259d83659f77219db581def7193 | 401,897 | # WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
require 'seahorse/client/plugins/content_length.rb'
require 'aws-sdk-core/plugins/credentials_configuration.rb'
require 'aws-sdk-core/plugins/logging.rb'
require 'aws-sdk-core/plugins/param_converter.rb'
require 'aws-sdk-core/plugins/param_validator.rb'
require 'aws-sdk-core/plugins/user_agent.rb'
require 'aws-sdk-core/plugins/helpful_socket_errors.rb'
require 'aws-sdk-core/plugins/retry_errors.rb'
require 'aws-sdk-core/plugins/global_configuration.rb'
require 'aws-sdk-core/plugins/regional_endpoint.rb'
require 'aws-sdk-core/plugins/endpoint_discovery.rb'
require 'aws-sdk-core/plugins/endpoint_pattern.rb'
require 'aws-sdk-core/plugins/response_paging.rb'
require 'aws-sdk-core/plugins/stub_responses.rb'
require 'aws-sdk-core/plugins/idempotency_token.rb'
require 'aws-sdk-core/plugins/jsonvalue_converter.rb'
require 'aws-sdk-core/plugins/client_metrics_plugin.rb'
require 'aws-sdk-core/plugins/client_metrics_send_plugin.rb'
require 'aws-sdk-core/plugins/signature_v4.rb'
require 'aws-sdk-core/plugins/protocols/rest_json.rb'
Aws::Plugins::GlobalConfiguration.add_identifier(:pinpoint)
module Aws::Pinpoint
class Client < Seahorse::Client::Base
include Aws::ClientStubs
@identifier = :pinpoint
set_api(ClientApi::API)
add_plugin(Seahorse::Client::Plugins::ContentLength)
add_plugin(Aws::Plugins::CredentialsConfiguration)
add_plugin(Aws::Plugins::Logging)
add_plugin(Aws::Plugins::ParamConverter)
add_plugin(Aws::Plugins::ParamValidator)
add_plugin(Aws::Plugins::UserAgent)
add_plugin(Aws::Plugins::HelpfulSocketErrors)
add_plugin(Aws::Plugins::RetryErrors)
add_plugin(Aws::Plugins::GlobalConfiguration)
add_plugin(Aws::Plugins::RegionalEndpoint)
add_plugin(Aws::Plugins::EndpointDiscovery)
add_plugin(Aws::Plugins::EndpointPattern)
add_plugin(Aws::Plugins::ResponsePaging)
add_plugin(Aws::Plugins::StubResponses)
add_plugin(Aws::Plugins::IdempotencyToken)
add_plugin(Aws::Plugins::JsonvalueConverter)
add_plugin(Aws::Plugins::ClientMetricsPlugin)
add_plugin(Aws::Plugins::ClientMetricsSendPlugin)
add_plugin(Aws::Plugins::SignatureV4)
add_plugin(Aws::Plugins::Protocols::RestJson)
# @overload initialize(options)
# @param [Hash] options
# @option options [required, Aws::CredentialProvider] :credentials
# Your AWS credentials. This can be an instance of any one of the
# following classes:
#
# * `Aws::Credentials` - Used for configuring static, non-refreshing
# credentials.
#
# * `Aws::InstanceProfileCredentials` - Used for loading credentials
# from an EC2 IMDS on an EC2 instance.
#
# * `Aws::SharedCredentials` - Used for loading credentials from a
# shared file, such as `~/.aws/config`.
#
# * `Aws::AssumeRoleCredentials` - Used when you need to assume a role.
#
# When `:credentials` are not configured directly, the following
# locations will be searched for credentials:
#
# * `Aws.config[:credentials]`
# * The `:access_key_id`, `:secret_access_key`, and `:session_token` options.
# * ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']
# * `~/.aws/credentials`
# * `~/.aws/config`
# * EC2 IMDS instance profile - When used by default, the timeouts are
# very aggressive. Construct and pass an instance of
# `Aws::InstanceProfileCredentails` to enable retries and extended
# timeouts.
#
# @option options [required, String] :region
# The AWS region to connect to. The configured `:region` is
# used to determine the service `:endpoint`. When not passed,
# a default `:region` is search for in the following locations:
#
# * `Aws.config[:region]`
# * `ENV['AWS_REGION']`
# * `ENV['AMAZON_REGION']`
# * `ENV['AWS_DEFAULT_REGION']`
# * `~/.aws/credentials`
# * `~/.aws/config`
#
# @option options [String] :access_key_id
#
# @option options [Boolean] :active_endpoint_cache (false)
# When set to `true`, a thread polling for endpoints will be running in
# the background every 60 secs (default). Defaults to `false`.
#
# @option options [Boolean] :client_side_monitoring (false)
# When `true`, client-side metrics will be collected for all API requests from
# this client.
#
# @option options [String] :client_side_monitoring_client_id ("")
# Allows you to provide an identifier for this client which will be attached to
# all generated client side metrics. Defaults to an empty string.
#
# @option options [Integer] :client_side_monitoring_port (31000)
# Required for publishing client metrics. The port that the client side monitoring
# agent is running on, where client metrics will be published via UDP.
#
# @option options [Aws::ClientSideMonitoring::Publisher] :client_side_monitoring_publisher (Aws::ClientSideMonitoring::Publisher)
# Allows you to provide a custom client-side monitoring publisher class. By default,
# will use the Client Side Monitoring Agent Publisher.
#
# @option options [Boolean] :convert_params (true)
# When `true`, an attempt is made to coerce request parameters into
# the required types.
#
# @option options [Boolean] :disable_host_prefix_injection (false)
# Set to true to disable SDK automatically adding host prefix
# to default service endpoint when available.
#
# @option options [String] :endpoint
# The client endpoint is normally constructed from the `:region`
# option. You should only configure an `:endpoint` when connecting
# to test endpoints. This should be avalid HTTP(S) URI.
#
# @option options [Integer] :endpoint_cache_max_entries (1000)
# Used for the maximum size limit of the LRU cache storing endpoints data
# for endpoint discovery enabled operations. Defaults to 1000.
#
# @option options [Integer] :endpoint_cache_max_threads (10)
# Used for the maximum threads in use for polling endpoints to be cached, defaults to 10.
#
# @option options [Integer] :endpoint_cache_poll_interval (60)
# When :endpoint_discovery and :active_endpoint_cache is enabled,
# Use this option to config the time interval in seconds for making
# requests fetching endpoints information. Defaults to 60 sec.
#
# @option options [Boolean] :endpoint_discovery (false)
# When set to `true`, endpoint discovery will be enabled for operations when available. Defaults to `false`.
#
# @option options [Aws::Log::Formatter] :log_formatter (Aws::Log::Formatter.default)
# The log formatter.
#
# @option options [Symbol] :log_level (:info)
# The log level to send messages to the `:logger` at.
#
# @option options [Logger] :logger
# The Logger instance to send log messages to. If this option
# is not set, logging will be disabled.
#
# @option options [String] :profile ("default")
# Used when loading credentials from the shared credentials file
# at HOME/.aws/credentials. When not specified, 'default' is used.
#
# @option options [Float] :retry_base_delay (0.3)
# The base delay in seconds used by the default backoff function.
#
# @option options [Symbol] :retry_jitter (:none)
# A delay randomiser function used by the default backoff function. Some predefined functions can be referenced by name - :none, :equal, :full, otherwise a Proc that takes and returns a number.
#
# @see https://www.awsarchitectureblog.com/2015/03/backoff.html
#
# @option options [Integer] :retry_limit (3)
# The maximum number of times to retry failed requests. Only
# ~ 500 level server errors and certain ~ 400 level client errors
# are retried. Generally, these are throttling errors, data
# checksum errors, networking errors, timeout errors and auth
# errors from expired credentials.
#
# @option options [Integer] :retry_max_delay (0)
# The maximum number of seconds to delay between retries (0 for no limit) used by the default backoff function.
#
# @option options [String] :secret_access_key
#
# @option options [String] :session_token
#
# @option options [Boolean] :stub_responses (false)
# Causes the client to return stubbed responses. By default
# fake responses are generated and returned. You can specify
# the response data to return or errors to raise by calling
# {ClientStubs#stub_responses}. See {ClientStubs} for more information.
#
# ** Please note ** When response stubbing is enabled, no HTTP
# requests are made, and retries are disabled.
#
# @option options [Boolean] :validate_params (true)
# When `true`, request parameters are validated before
# sending the request.
#
def initialize(*args)
super
end
# @!group API Operations
# Creates or updates an app.
#
# @option params [required, Types::CreateApplicationRequest] :create_application_request
# Application Request.
#
# @return [Types::CreateAppResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::CreateAppResponse#application_response #application_response} => Types::ApplicationResponse
#
# @example Request syntax with placeholder values
#
# resp = client.create_app({
# create_application_request: { # required
# name: "__string",
# },
# })
#
# @example Response structure
#
# resp.application_response.id #=> String
# resp.application_response.name #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/CreateApp AWS API Documentation
#
# @overload create_app(params = {})
# @param [Hash] params ({})
def create_app(params = {}, options = {})
req = build_request(:create_app, params)
req.send_request(options)
end
# Creates or updates a campaign.
#
# @option params [required, String] :application_id
#
# @option params [required, Types::WriteCampaignRequest] :write_campaign_request
# Used to create a campaign.
#
# @return [Types::CreateCampaignResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::CreateCampaignResponse#campaign_response #campaign_response} => Types::CampaignResponse
#
# @example Request syntax with placeholder values
#
# resp = client.create_campaign({
# application_id: "__string", # required
# write_campaign_request: { # required
# additional_treatments: [
# {
# message_configuration: {
# adm_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# image_icon_url: "__string",
# image_small_icon_url: "__string",
# image_url: "__string",
# json_body: "__string",
# media_url: "__string",
# raw_content: "__string",
# silent_push: false,
# time_to_live: 1,
# title: "__string",
# url: "__string",
# },
# apns_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# image_icon_url: "__string",
# image_small_icon_url: "__string",
# image_url: "__string",
# json_body: "__string",
# media_url: "__string",
# raw_content: "__string",
# silent_push: false,
# time_to_live: 1,
# title: "__string",
# url: "__string",
# },
# baidu_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# image_icon_url: "__string",
# image_small_icon_url: "__string",
# image_url: "__string",
# json_body: "__string",
# media_url: "__string",
# raw_content: "__string",
# silent_push: false,
# time_to_live: 1,
# title: "__string",
# url: "__string",
# },
# default_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# image_icon_url: "__string",
# image_small_icon_url: "__string",
# image_url: "__string",
# json_body: "__string",
# media_url: "__string",
# raw_content: "__string",
# silent_push: false,
# time_to_live: 1,
# title: "__string",
# url: "__string",
# },
# email_message: {
# body: "__string",
# from_address: "__string",
# html_body: "__string",
# title: "__string",
# },
# gcm_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# image_icon_url: "__string",
# image_small_icon_url: "__string",
# image_url: "__string",
# json_body: "__string",
# media_url: "__string",
# raw_content: "__string",
# silent_push: false,
# time_to_live: 1,
# title: "__string",
# url: "__string",
# },
# sms_message: {
# body: "__string",
# message_type: "TRANSACTIONAL", # accepts TRANSACTIONAL, PROMOTIONAL
# sender_id: "__string",
# },
# },
# schedule: {
# end_time: "__string",
# event_filter: {
# dimensions: {
# attributes: {
# "__string" => {
# attribute_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# },
# event_type: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# metrics: {
# "__string" => {
# comparison_operator: "__string",
# value: 1.0,
# },
# },
# },
# filter_type: "SYSTEM", # accepts SYSTEM, ENDPOINT
# },
# frequency: "ONCE", # accepts ONCE, HOURLY, DAILY, WEEKLY, MONTHLY, EVENT
# is_local_time: false,
# quiet_time: {
# end: "__string",
# start: "__string",
# },
# start_time: "__string",
# timezone: "__string",
# },
# size_percent: 1,
# treatment_description: "__string",
# treatment_name: "__string",
# },
# ],
# description: "__string",
# holdout_percent: 1,
# hook: {
# lambda_function_name: "__string",
# mode: "DELIVERY", # accepts DELIVERY, FILTER
# web_url: "__string",
# },
# is_paused: false,
# limits: {
# daily: 1,
# maximum_duration: 1,
# messages_per_second: 1,
# total: 1,
# },
# message_configuration: {
# adm_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# image_icon_url: "__string",
# image_small_icon_url: "__string",
# image_url: "__string",
# json_body: "__string",
# media_url: "__string",
# raw_content: "__string",
# silent_push: false,
# time_to_live: 1,
# title: "__string",
# url: "__string",
# },
# apns_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# image_icon_url: "__string",
# image_small_icon_url: "__string",
# image_url: "__string",
# json_body: "__string",
# media_url: "__string",
# raw_content: "__string",
# silent_push: false,
# time_to_live: 1,
# title: "__string",
# url: "__string",
# },
# baidu_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# image_icon_url: "__string",
# image_small_icon_url: "__string",
# image_url: "__string",
# json_body: "__string",
# media_url: "__string",
# raw_content: "__string",
# silent_push: false,
# time_to_live: 1,
# title: "__string",
# url: "__string",
# },
# default_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# image_icon_url: "__string",
# image_small_icon_url: "__string",
# image_url: "__string",
# json_body: "__string",
# media_url: "__string",
# raw_content: "__string",
# silent_push: false,
# time_to_live: 1,
# title: "__string",
# url: "__string",
# },
# email_message: {
# body: "__string",
# from_address: "__string",
# html_body: "__string",
# title: "__string",
# },
# gcm_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# image_icon_url: "__string",
# image_small_icon_url: "__string",
# image_url: "__string",
# json_body: "__string",
# media_url: "__string",
# raw_content: "__string",
# silent_push: false,
# time_to_live: 1,
# title: "__string",
# url: "__string",
# },
# sms_message: {
# body: "__string",
# message_type: "TRANSACTIONAL", # accepts TRANSACTIONAL, PROMOTIONAL
# sender_id: "__string",
# },
# },
# name: "__string",
# schedule: {
# end_time: "__string",
# event_filter: {
# dimensions: {
# attributes: {
# "__string" => {
# attribute_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# },
# event_type: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# metrics: {
# "__string" => {
# comparison_operator: "__string",
# value: 1.0,
# },
# },
# },
# filter_type: "SYSTEM", # accepts SYSTEM, ENDPOINT
# },
# frequency: "ONCE", # accepts ONCE, HOURLY, DAILY, WEEKLY, MONTHLY, EVENT
# is_local_time: false,
# quiet_time: {
# end: "__string",
# start: "__string",
# },
# start_time: "__string",
# timezone: "__string",
# },
# segment_id: "__string",
# segment_version: 1,
# treatment_description: "__string",
# treatment_name: "__string",
# },
# })
#
# @example Response structure
#
# resp.campaign_response.additional_treatments #=> Array
# resp.campaign_response.additional_treatments[0].id #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.image_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.image_small_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.image_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.json_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.media_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.raw_content #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.silent_push #=> Boolean
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.time_to_live #=> Integer
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.image_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.image_small_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.image_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.json_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.media_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.raw_content #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.silent_push #=> Boolean
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.time_to_live #=> Integer
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.image_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.image_small_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.image_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.json_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.media_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.raw_content #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.silent_push #=> Boolean
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.time_to_live #=> Integer
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.image_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.image_small_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.image_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.json_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.media_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.raw_content #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.silent_push #=> Boolean
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.time_to_live #=> Integer
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.email_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.email_message.from_address #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.email_message.html_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.email_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.image_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.image_small_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.image_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.json_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.media_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.raw_content #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.silent_push #=> Boolean
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.time_to_live #=> Integer
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.sms_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.sms_message.message_type #=> String, one of "TRANSACTIONAL", "PROMOTIONAL"
# resp.campaign_response.additional_treatments[0].message_configuration.sms_message.sender_id #=> String
# resp.campaign_response.additional_treatments[0].schedule.end_time #=> String
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.attributes #=> Hash
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.attributes["__string"].values #=> Array
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.attributes["__string"].values[0] #=> String
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.event_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.event_type.values #=> Array
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.event_type.values[0] #=> String
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.metrics #=> Hash
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.metrics["__string"].comparison_operator #=> String
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.metrics["__string"].value #=> Float
# resp.campaign_response.additional_treatments[0].schedule.event_filter.filter_type #=> String, one of "SYSTEM", "ENDPOINT"
# resp.campaign_response.additional_treatments[0].schedule.frequency #=> String, one of "ONCE", "HOURLY", "DAILY", "WEEKLY", "MONTHLY", "EVENT"
# resp.campaign_response.additional_treatments[0].schedule.is_local_time #=> Boolean
# resp.campaign_response.additional_treatments[0].schedule.quiet_time.end #=> String
# resp.campaign_response.additional_treatments[0].schedule.quiet_time.start #=> String
# resp.campaign_response.additional_treatments[0].schedule.start_time #=> String
# resp.campaign_response.additional_treatments[0].schedule.timezone #=> String
# resp.campaign_response.additional_treatments[0].size_percent #=> Integer
# resp.campaign_response.additional_treatments[0].state.campaign_status #=> String, one of "SCHEDULED", "EXECUTING", "PENDING_NEXT_RUN", "COMPLETED", "PAUSED", "DELETED"
# resp.campaign_response.additional_treatments[0].treatment_description #=> String
# resp.campaign_response.additional_treatments[0].treatment_name #=> String
# resp.campaign_response.application_id #=> String
# resp.campaign_response.creation_date #=> String
# resp.campaign_response.default_state.campaign_status #=> String, one of "SCHEDULED", "EXECUTING", "PENDING_NEXT_RUN", "COMPLETED", "PAUSED", "DELETED"
# resp.campaign_response.description #=> String
# resp.campaign_response.holdout_percent #=> Integer
# resp.campaign_response.hook.lambda_function_name #=> String
# resp.campaign_response.hook.mode #=> String, one of "DELIVERY", "FILTER"
# resp.campaign_response.hook.web_url #=> String
# resp.campaign_response.id #=> String
# resp.campaign_response.is_paused #=> Boolean
# resp.campaign_response.last_modified_date #=> String
# resp.campaign_response.limits.daily #=> Integer
# resp.campaign_response.limits.maximum_duration #=> Integer
# resp.campaign_response.limits.messages_per_second #=> Integer
# resp.campaign_response.limits.total #=> Integer
# resp.campaign_response.message_configuration.adm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.message_configuration.adm_message.body #=> String
# resp.campaign_response.message_configuration.adm_message.image_icon_url #=> String
# resp.campaign_response.message_configuration.adm_message.image_small_icon_url #=> String
# resp.campaign_response.message_configuration.adm_message.image_url #=> String
# resp.campaign_response.message_configuration.adm_message.json_body #=> String
# resp.campaign_response.message_configuration.adm_message.media_url #=> String
# resp.campaign_response.message_configuration.adm_message.raw_content #=> String
# resp.campaign_response.message_configuration.adm_message.silent_push #=> Boolean
# resp.campaign_response.message_configuration.adm_message.time_to_live #=> Integer
# resp.campaign_response.message_configuration.adm_message.title #=> String
# resp.campaign_response.message_configuration.adm_message.url #=> String
# resp.campaign_response.message_configuration.apns_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.message_configuration.apns_message.body #=> String
# resp.campaign_response.message_configuration.apns_message.image_icon_url #=> String
# resp.campaign_response.message_configuration.apns_message.image_small_icon_url #=> String
# resp.campaign_response.message_configuration.apns_message.image_url #=> String
# resp.campaign_response.message_configuration.apns_message.json_body #=> String
# resp.campaign_response.message_configuration.apns_message.media_url #=> String
# resp.campaign_response.message_configuration.apns_message.raw_content #=> String
# resp.campaign_response.message_configuration.apns_message.silent_push #=> Boolean
# resp.campaign_response.message_configuration.apns_message.time_to_live #=> Integer
# resp.campaign_response.message_configuration.apns_message.title #=> String
# resp.campaign_response.message_configuration.apns_message.url #=> String
# resp.campaign_response.message_configuration.baidu_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.message_configuration.baidu_message.body #=> String
# resp.campaign_response.message_configuration.baidu_message.image_icon_url #=> String
# resp.campaign_response.message_configuration.baidu_message.image_small_icon_url #=> String
# resp.campaign_response.message_configuration.baidu_message.image_url #=> String
# resp.campaign_response.message_configuration.baidu_message.json_body #=> String
# resp.campaign_response.message_configuration.baidu_message.media_url #=> String
# resp.campaign_response.message_configuration.baidu_message.raw_content #=> String
# resp.campaign_response.message_configuration.baidu_message.silent_push #=> Boolean
# resp.campaign_response.message_configuration.baidu_message.time_to_live #=> Integer
# resp.campaign_response.message_configuration.baidu_message.title #=> String
# resp.campaign_response.message_configuration.baidu_message.url #=> String
# resp.campaign_response.message_configuration.default_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.message_configuration.default_message.body #=> String
# resp.campaign_response.message_configuration.default_message.image_icon_url #=> String
# resp.campaign_response.message_configuration.default_message.image_small_icon_url #=> String
# resp.campaign_response.message_configuration.default_message.image_url #=> String
# resp.campaign_response.message_configuration.default_message.json_body #=> String
# resp.campaign_response.message_configuration.default_message.media_url #=> String
# resp.campaign_response.message_configuration.default_message.raw_content #=> String
# resp.campaign_response.message_configuration.default_message.silent_push #=> Boolean
# resp.campaign_response.message_configuration.default_message.time_to_live #=> Integer
# resp.campaign_response.message_configuration.default_message.title #=> String
# resp.campaign_response.message_configuration.default_message.url #=> String
# resp.campaign_response.message_configuration.email_message.body #=> String
# resp.campaign_response.message_configuration.email_message.from_address #=> String
# resp.campaign_response.message_configuration.email_message.html_body #=> String
# resp.campaign_response.message_configuration.email_message.title #=> String
# resp.campaign_response.message_configuration.gcm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.message_configuration.gcm_message.body #=> String
# resp.campaign_response.message_configuration.gcm_message.image_icon_url #=> String
# resp.campaign_response.message_configuration.gcm_message.image_small_icon_url #=> String
# resp.campaign_response.message_configuration.gcm_message.image_url #=> String
# resp.campaign_response.message_configuration.gcm_message.json_body #=> String
# resp.campaign_response.message_configuration.gcm_message.media_url #=> String
# resp.campaign_response.message_configuration.gcm_message.raw_content #=> String
# resp.campaign_response.message_configuration.gcm_message.silent_push #=> Boolean
# resp.campaign_response.message_configuration.gcm_message.time_to_live #=> Integer
# resp.campaign_response.message_configuration.gcm_message.title #=> String
# resp.campaign_response.message_configuration.gcm_message.url #=> String
# resp.campaign_response.message_configuration.sms_message.body #=> String
# resp.campaign_response.message_configuration.sms_message.message_type #=> String, one of "TRANSACTIONAL", "PROMOTIONAL"
# resp.campaign_response.message_configuration.sms_message.sender_id #=> String
# resp.campaign_response.name #=> String
# resp.campaign_response.schedule.end_time #=> String
# resp.campaign_response.schedule.event_filter.dimensions.attributes #=> Hash
# resp.campaign_response.schedule.event_filter.dimensions.attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaign_response.schedule.event_filter.dimensions.attributes["__string"].values #=> Array
# resp.campaign_response.schedule.event_filter.dimensions.attributes["__string"].values[0] #=> String
# resp.campaign_response.schedule.event_filter.dimensions.event_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaign_response.schedule.event_filter.dimensions.event_type.values #=> Array
# resp.campaign_response.schedule.event_filter.dimensions.event_type.values[0] #=> String
# resp.campaign_response.schedule.event_filter.dimensions.metrics #=> Hash
# resp.campaign_response.schedule.event_filter.dimensions.metrics["__string"].comparison_operator #=> String
# resp.campaign_response.schedule.event_filter.dimensions.metrics["__string"].value #=> Float
# resp.campaign_response.schedule.event_filter.filter_type #=> String, one of "SYSTEM", "ENDPOINT"
# resp.campaign_response.schedule.frequency #=> String, one of "ONCE", "HOURLY", "DAILY", "WEEKLY", "MONTHLY", "EVENT"
# resp.campaign_response.schedule.is_local_time #=> Boolean
# resp.campaign_response.schedule.quiet_time.end #=> String
# resp.campaign_response.schedule.quiet_time.start #=> String
# resp.campaign_response.schedule.start_time #=> String
# resp.campaign_response.schedule.timezone #=> String
# resp.campaign_response.segment_id #=> String
# resp.campaign_response.segment_version #=> Integer
# resp.campaign_response.state.campaign_status #=> String, one of "SCHEDULED", "EXECUTING", "PENDING_NEXT_RUN", "COMPLETED", "PAUSED", "DELETED"
# resp.campaign_response.treatment_description #=> String
# resp.campaign_response.treatment_name #=> String
# resp.campaign_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/CreateCampaign AWS API Documentation
#
# @overload create_campaign(params = {})
# @param [Hash] params ({})
def create_campaign(params = {}, options = {})
req = build_request(:create_campaign, params)
req.send_request(options)
end
# Creates an export job.
#
# @option params [required, String] :application_id
#
# @option params [required, Types::ExportJobRequest] :export_job_request
# Export job request.
#
# @return [Types::CreateExportJobResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::CreateExportJobResponse#export_job_response #export_job_response} => Types::ExportJobResponse
#
# @example Request syntax with placeholder values
#
# resp = client.create_export_job({
# application_id: "__string", # required
# export_job_request: { # required
# role_arn: "__string",
# s3_url_prefix: "__string",
# segment_id: "__string",
# segment_version: 1,
# },
# })
#
# @example Response structure
#
# resp.export_job_response.application_id #=> String
# resp.export_job_response.completed_pieces #=> Integer
# resp.export_job_response.completion_date #=> String
# resp.export_job_response.creation_date #=> String
# resp.export_job_response.definition.role_arn #=> String
# resp.export_job_response.definition.s3_url_prefix #=> String
# resp.export_job_response.definition.segment_id #=> String
# resp.export_job_response.definition.segment_version #=> Integer
# resp.export_job_response.failed_pieces #=> Integer
# resp.export_job_response.failures #=> Array
# resp.export_job_response.failures[0] #=> String
# resp.export_job_response.id #=> String
# resp.export_job_response.job_status #=> String, one of "CREATED", "INITIALIZING", "PROCESSING", "COMPLETING", "COMPLETED", "FAILING", "FAILED"
# resp.export_job_response.total_failures #=> Integer
# resp.export_job_response.total_pieces #=> Integer
# resp.export_job_response.total_processed #=> Integer
# resp.export_job_response.type #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/CreateExportJob AWS API Documentation
#
# @overload create_export_job(params = {})
# @param [Hash] params ({})
def create_export_job(params = {}, options = {})
req = build_request(:create_export_job, params)
req.send_request(options)
end
# Creates or updates an import job.
#
# @option params [required, String] :application_id
#
# @option params [required, Types::ImportJobRequest] :import_job_request
# Import job request.
#
# @return [Types::CreateImportJobResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::CreateImportJobResponse#import_job_response #import_job_response} => Types::ImportJobResponse
#
# @example Request syntax with placeholder values
#
# resp = client.create_import_job({
# application_id: "__string", # required
# import_job_request: { # required
# define_segment: false,
# external_id: "__string",
# format: "CSV", # accepts CSV, JSON
# register_endpoints: false,
# role_arn: "__string",
# s3_url: "__string",
# segment_id: "__string",
# segment_name: "__string",
# },
# })
#
# @example Response structure
#
# resp.import_job_response.application_id #=> String
# resp.import_job_response.completed_pieces #=> Integer
# resp.import_job_response.completion_date #=> String
# resp.import_job_response.creation_date #=> String
# resp.import_job_response.definition.define_segment #=> Boolean
# resp.import_job_response.definition.external_id #=> String
# resp.import_job_response.definition.format #=> String, one of "CSV", "JSON"
# resp.import_job_response.definition.register_endpoints #=> Boolean
# resp.import_job_response.definition.role_arn #=> String
# resp.import_job_response.definition.s3_url #=> String
# resp.import_job_response.definition.segment_id #=> String
# resp.import_job_response.definition.segment_name #=> String
# resp.import_job_response.failed_pieces #=> Integer
# resp.import_job_response.failures #=> Array
# resp.import_job_response.failures[0] #=> String
# resp.import_job_response.id #=> String
# resp.import_job_response.job_status #=> String, one of "CREATED", "INITIALIZING", "PROCESSING", "COMPLETING", "COMPLETED", "FAILING", "FAILED"
# resp.import_job_response.total_failures #=> Integer
# resp.import_job_response.total_pieces #=> Integer
# resp.import_job_response.total_processed #=> Integer
# resp.import_job_response.type #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/CreateImportJob AWS API Documentation
#
# @overload create_import_job(params = {})
# @param [Hash] params ({})
def create_import_job(params = {}, options = {})
req = build_request(:create_import_job, params)
req.send_request(options)
end
# Used to create or update a segment.
#
# @option params [required, String] :application_id
#
# @option params [required, Types::WriteSegmentRequest] :write_segment_request
# Segment definition.
#
# @return [Types::CreateSegmentResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::CreateSegmentResponse#segment_response #segment_response} => Types::SegmentResponse
#
# @example Request syntax with placeholder values
#
# resp = client.create_segment({
# application_id: "__string", # required
# write_segment_request: { # required
# dimensions: {
# attributes: {
# "__string" => {
# attribute_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# },
# behavior: {
# recency: {
# duration: "HR_24", # accepts HR_24, DAY_7, DAY_14, DAY_30
# recency_type: "ACTIVE", # accepts ACTIVE, INACTIVE
# },
# },
# demographic: {
# app_version: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# channel: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# device_type: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# make: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# model: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# platform: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# },
# location: {
# country: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# gps_point: {
# coordinates: {
# latitude: 1.0,
# longitude: 1.0,
# },
# range_in_kilometers: 1.0,
# },
# },
# metrics: {
# "__string" => {
# comparison_operator: "__string",
# value: 1.0,
# },
# },
# user_attributes: {
# "__string" => {
# attribute_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# },
# },
# name: "__string",
# segment_groups: {
# groups: [
# {
# dimensions: [
# {
# attributes: {
# "__string" => {
# attribute_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# },
# behavior: {
# recency: {
# duration: "HR_24", # accepts HR_24, DAY_7, DAY_14, DAY_30
# recency_type: "ACTIVE", # accepts ACTIVE, INACTIVE
# },
# },
# demographic: {
# app_version: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# channel: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# device_type: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# make: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# model: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# platform: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# },
# location: {
# country: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# gps_point: {
# coordinates: {
# latitude: 1.0,
# longitude: 1.0,
# },
# range_in_kilometers: 1.0,
# },
# },
# metrics: {
# "__string" => {
# comparison_operator: "__string",
# value: 1.0,
# },
# },
# user_attributes: {
# "__string" => {
# attribute_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# },
# },
# ],
# source_segments: [
# {
# id: "__string",
# version: 1,
# },
# ],
# source_type: "ALL", # accepts ALL, ANY, NONE
# type: "ALL", # accepts ALL, ANY, NONE
# },
# ],
# include: "ALL", # accepts ALL, ANY, NONE
# },
# },
# })
#
# @example Response structure
#
# resp.segment_response.application_id #=> String
# resp.segment_response.creation_date #=> String
# resp.segment_response.dimensions.attributes #=> Hash
# resp.segment_response.dimensions.attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.attributes["__string"].values #=> Array
# resp.segment_response.dimensions.attributes["__string"].values[0] #=> String
# resp.segment_response.dimensions.behavior.recency.duration #=> String, one of "HR_24", "DAY_7", "DAY_14", "DAY_30"
# resp.segment_response.dimensions.behavior.recency.recency_type #=> String, one of "ACTIVE", "INACTIVE"
# resp.segment_response.dimensions.demographic.app_version.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.app_version.values #=> Array
# resp.segment_response.dimensions.demographic.app_version.values[0] #=> String
# resp.segment_response.dimensions.demographic.channel.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.channel.values #=> Array
# resp.segment_response.dimensions.demographic.channel.values[0] #=> String
# resp.segment_response.dimensions.demographic.device_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.device_type.values #=> Array
# resp.segment_response.dimensions.demographic.device_type.values[0] #=> String
# resp.segment_response.dimensions.demographic.make.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.make.values #=> Array
# resp.segment_response.dimensions.demographic.make.values[0] #=> String
# resp.segment_response.dimensions.demographic.model.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.model.values #=> Array
# resp.segment_response.dimensions.demographic.model.values[0] #=> String
# resp.segment_response.dimensions.demographic.platform.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.platform.values #=> Array
# resp.segment_response.dimensions.demographic.platform.values[0] #=> String
# resp.segment_response.dimensions.location.country.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.location.country.values #=> Array
# resp.segment_response.dimensions.location.country.values[0] #=> String
# resp.segment_response.dimensions.location.gps_point.coordinates.latitude #=> Float
# resp.segment_response.dimensions.location.gps_point.coordinates.longitude #=> Float
# resp.segment_response.dimensions.location.gps_point.range_in_kilometers #=> Float
# resp.segment_response.dimensions.metrics #=> Hash
# resp.segment_response.dimensions.metrics["__string"].comparison_operator #=> String
# resp.segment_response.dimensions.metrics["__string"].value #=> Float
# resp.segment_response.dimensions.user_attributes #=> Hash
# resp.segment_response.dimensions.user_attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.user_attributes["__string"].values #=> Array
# resp.segment_response.dimensions.user_attributes["__string"].values[0] #=> String
# resp.segment_response.id #=> String
# resp.segment_response.import_definition.channel_counts #=> Hash
# resp.segment_response.import_definition.channel_counts["__string"] #=> Integer
# resp.segment_response.import_definition.external_id #=> String
# resp.segment_response.import_definition.format #=> String, one of "CSV", "JSON"
# resp.segment_response.import_definition.role_arn #=> String
# resp.segment_response.import_definition.s3_url #=> String
# resp.segment_response.import_definition.size #=> Integer
# resp.segment_response.last_modified_date #=> String
# resp.segment_response.name #=> String
# resp.segment_response.segment_groups.groups #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].attributes #=> Hash
# resp.segment_response.segment_groups.groups[0].dimensions[0].attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].attributes["__string"].values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].attributes["__string"].values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].behavior.recency.duration #=> String, one of "HR_24", "DAY_7", "DAY_14", "DAY_30"
# resp.segment_response.segment_groups.groups[0].dimensions[0].behavior.recency.recency_type #=> String, one of "ACTIVE", "INACTIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.app_version.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.app_version.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.app_version.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.channel.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.channel.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.channel.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.device_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.device_type.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.device_type.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.make.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.make.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.make.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.model.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.model.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.model.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.platform.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.platform.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.platform.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.country.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.country.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.country.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.gps_point.coordinates.latitude #=> Float
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.gps_point.coordinates.longitude #=> Float
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.gps_point.range_in_kilometers #=> Float
# resp.segment_response.segment_groups.groups[0].dimensions[0].metrics #=> Hash
# resp.segment_response.segment_groups.groups[0].dimensions[0].metrics["__string"].comparison_operator #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].metrics["__string"].value #=> Float
# resp.segment_response.segment_groups.groups[0].dimensions[0].user_attributes #=> Hash
# resp.segment_response.segment_groups.groups[0].dimensions[0].user_attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].user_attributes["__string"].values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].user_attributes["__string"].values[0] #=> String
# resp.segment_response.segment_groups.groups[0].source_segments #=> Array
# resp.segment_response.segment_groups.groups[0].source_segments[0].id #=> String
# resp.segment_response.segment_groups.groups[0].source_segments[0].version #=> Integer
# resp.segment_response.segment_groups.groups[0].source_type #=> String, one of "ALL", "ANY", "NONE"
# resp.segment_response.segment_groups.groups[0].type #=> String, one of "ALL", "ANY", "NONE"
# resp.segment_response.segment_groups.include #=> String, one of "ALL", "ANY", "NONE"
# resp.segment_response.segment_type #=> String, one of "DIMENSIONAL", "IMPORT"
# resp.segment_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/CreateSegment AWS API Documentation
#
# @overload create_segment(params = {})
# @param [Hash] params ({})
def create_segment(params = {}, options = {})
req = build_request(:create_segment, params)
req.send_request(options)
end
# Delete an ADM channel.
#
# @option params [required, String] :application_id
#
# @return [Types::DeleteAdmChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::DeleteAdmChannelResponse#adm_channel_response #adm_channel_response} => Types::ADMChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.delete_adm_channel({
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.adm_channel_response.application_id #=> String
# resp.adm_channel_response.creation_date #=> String
# resp.adm_channel_response.enabled #=> Boolean
# resp.adm_channel_response.has_credential #=> Boolean
# resp.adm_channel_response.id #=> String
# resp.adm_channel_response.is_archived #=> Boolean
# resp.adm_channel_response.last_modified_by #=> String
# resp.adm_channel_response.last_modified_date #=> String
# resp.adm_channel_response.platform #=> String
# resp.adm_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/DeleteAdmChannel AWS API Documentation
#
# @overload delete_adm_channel(params = {})
# @param [Hash] params ({})
def delete_adm_channel(params = {}, options = {})
req = build_request(:delete_adm_channel, params)
req.send_request(options)
end
# Deletes the APNs channel for an app.
#
# @option params [required, String] :application_id
#
# @return [Types::DeleteApnsChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::DeleteApnsChannelResponse#apns_channel_response #apns_channel_response} => Types::APNSChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.delete_apns_channel({
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.apns_channel_response.application_id #=> String
# resp.apns_channel_response.creation_date #=> String
# resp.apns_channel_response.default_authentication_method #=> String
# resp.apns_channel_response.enabled #=> Boolean
# resp.apns_channel_response.has_credential #=> Boolean
# resp.apns_channel_response.has_token_key #=> Boolean
# resp.apns_channel_response.id #=> String
# resp.apns_channel_response.is_archived #=> Boolean
# resp.apns_channel_response.last_modified_by #=> String
# resp.apns_channel_response.last_modified_date #=> String
# resp.apns_channel_response.platform #=> String
# resp.apns_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/DeleteApnsChannel AWS API Documentation
#
# @overload delete_apns_channel(params = {})
# @param [Hash] params ({})
def delete_apns_channel(params = {}, options = {})
req = build_request(:delete_apns_channel, params)
req.send_request(options)
end
# Delete an APNS sandbox channel.
#
# @option params [required, String] :application_id
#
# @return [Types::DeleteApnsSandboxChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::DeleteApnsSandboxChannelResponse#apns_sandbox_channel_response #apns_sandbox_channel_response} => Types::APNSSandboxChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.delete_apns_sandbox_channel({
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.apns_sandbox_channel_response.application_id #=> String
# resp.apns_sandbox_channel_response.creation_date #=> String
# resp.apns_sandbox_channel_response.default_authentication_method #=> String
# resp.apns_sandbox_channel_response.enabled #=> Boolean
# resp.apns_sandbox_channel_response.has_credential #=> Boolean
# resp.apns_sandbox_channel_response.has_token_key #=> Boolean
# resp.apns_sandbox_channel_response.id #=> String
# resp.apns_sandbox_channel_response.is_archived #=> Boolean
# resp.apns_sandbox_channel_response.last_modified_by #=> String
# resp.apns_sandbox_channel_response.last_modified_date #=> String
# resp.apns_sandbox_channel_response.platform #=> String
# resp.apns_sandbox_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/DeleteApnsSandboxChannel AWS API Documentation
#
# @overload delete_apns_sandbox_channel(params = {})
# @param [Hash] params ({})
def delete_apns_sandbox_channel(params = {}, options = {})
req = build_request(:delete_apns_sandbox_channel, params)
req.send_request(options)
end
# Delete an APNS VoIP channel
#
# @option params [required, String] :application_id
#
# @return [Types::DeleteApnsVoipChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::DeleteApnsVoipChannelResponse#apns_voip_channel_response #apns_voip_channel_response} => Types::APNSVoipChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.delete_apns_voip_channel({
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.apns_voip_channel_response.application_id #=> String
# resp.apns_voip_channel_response.creation_date #=> String
# resp.apns_voip_channel_response.default_authentication_method #=> String
# resp.apns_voip_channel_response.enabled #=> Boolean
# resp.apns_voip_channel_response.has_credential #=> Boolean
# resp.apns_voip_channel_response.has_token_key #=> Boolean
# resp.apns_voip_channel_response.id #=> String
# resp.apns_voip_channel_response.is_archived #=> Boolean
# resp.apns_voip_channel_response.last_modified_by #=> String
# resp.apns_voip_channel_response.last_modified_date #=> String
# resp.apns_voip_channel_response.platform #=> String
# resp.apns_voip_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/DeleteApnsVoipChannel AWS API Documentation
#
# @overload delete_apns_voip_channel(params = {})
# @param [Hash] params ({})
def delete_apns_voip_channel(params = {}, options = {})
req = build_request(:delete_apns_voip_channel, params)
req.send_request(options)
end
# Delete an APNS VoIP sandbox channel
#
# @option params [required, String] :application_id
#
# @return [Types::DeleteApnsVoipSandboxChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::DeleteApnsVoipSandboxChannelResponse#apns_voip_sandbox_channel_response #apns_voip_sandbox_channel_response} => Types::APNSVoipSandboxChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.delete_apns_voip_sandbox_channel({
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.apns_voip_sandbox_channel_response.application_id #=> String
# resp.apns_voip_sandbox_channel_response.creation_date #=> String
# resp.apns_voip_sandbox_channel_response.default_authentication_method #=> String
# resp.apns_voip_sandbox_channel_response.enabled #=> Boolean
# resp.apns_voip_sandbox_channel_response.has_credential #=> Boolean
# resp.apns_voip_sandbox_channel_response.has_token_key #=> Boolean
# resp.apns_voip_sandbox_channel_response.id #=> String
# resp.apns_voip_sandbox_channel_response.is_archived #=> Boolean
# resp.apns_voip_sandbox_channel_response.last_modified_by #=> String
# resp.apns_voip_sandbox_channel_response.last_modified_date #=> String
# resp.apns_voip_sandbox_channel_response.platform #=> String
# resp.apns_voip_sandbox_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/DeleteApnsVoipSandboxChannel AWS API Documentation
#
# @overload delete_apns_voip_sandbox_channel(params = {})
# @param [Hash] params ({})
def delete_apns_voip_sandbox_channel(params = {}, options = {})
req = build_request(:delete_apns_voip_sandbox_channel, params)
req.send_request(options)
end
# Deletes an app.
#
# @option params [required, String] :application_id
#
# @return [Types::DeleteAppResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::DeleteAppResponse#application_response #application_response} => Types::ApplicationResponse
#
# @example Request syntax with placeholder values
#
# resp = client.delete_app({
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.application_response.id #=> String
# resp.application_response.name #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/DeleteApp AWS API Documentation
#
# @overload delete_app(params = {})
# @param [Hash] params ({})
def delete_app(params = {}, options = {})
req = build_request(:delete_app, params)
req.send_request(options)
end
# Delete a BAIDU GCM channel
#
# @option params [required, String] :application_id
#
# @return [Types::DeleteBaiduChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::DeleteBaiduChannelResponse#baidu_channel_response #baidu_channel_response} => Types::BaiduChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.delete_baidu_channel({
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.baidu_channel_response.application_id #=> String
# resp.baidu_channel_response.creation_date #=> String
# resp.baidu_channel_response.credential #=> String
# resp.baidu_channel_response.enabled #=> Boolean
# resp.baidu_channel_response.has_credential #=> Boolean
# resp.baidu_channel_response.id #=> String
# resp.baidu_channel_response.is_archived #=> Boolean
# resp.baidu_channel_response.last_modified_by #=> String
# resp.baidu_channel_response.last_modified_date #=> String
# resp.baidu_channel_response.platform #=> String
# resp.baidu_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/DeleteBaiduChannel AWS API Documentation
#
# @overload delete_baidu_channel(params = {})
# @param [Hash] params ({})
def delete_baidu_channel(params = {}, options = {})
req = build_request(:delete_baidu_channel, params)
req.send_request(options)
end
# Deletes a campaign.
#
# @option params [required, String] :application_id
#
# @option params [required, String] :campaign_id
#
# @return [Types::DeleteCampaignResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::DeleteCampaignResponse#campaign_response #campaign_response} => Types::CampaignResponse
#
# @example Request syntax with placeholder values
#
# resp = client.delete_campaign({
# application_id: "__string", # required
# campaign_id: "__string", # required
# })
#
# @example Response structure
#
# resp.campaign_response.additional_treatments #=> Array
# resp.campaign_response.additional_treatments[0].id #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.image_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.image_small_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.image_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.json_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.media_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.raw_content #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.silent_push #=> Boolean
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.time_to_live #=> Integer
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.image_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.image_small_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.image_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.json_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.media_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.raw_content #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.silent_push #=> Boolean
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.time_to_live #=> Integer
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.image_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.image_small_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.image_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.json_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.media_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.raw_content #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.silent_push #=> Boolean
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.time_to_live #=> Integer
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.image_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.image_small_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.image_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.json_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.media_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.raw_content #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.silent_push #=> Boolean
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.time_to_live #=> Integer
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.email_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.email_message.from_address #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.email_message.html_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.email_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.image_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.image_small_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.image_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.json_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.media_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.raw_content #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.silent_push #=> Boolean
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.time_to_live #=> Integer
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.sms_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.sms_message.message_type #=> String, one of "TRANSACTIONAL", "PROMOTIONAL"
# resp.campaign_response.additional_treatments[0].message_configuration.sms_message.sender_id #=> String
# resp.campaign_response.additional_treatments[0].schedule.end_time #=> String
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.attributes #=> Hash
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.attributes["__string"].values #=> Array
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.attributes["__string"].values[0] #=> String
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.event_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.event_type.values #=> Array
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.event_type.values[0] #=> String
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.metrics #=> Hash
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.metrics["__string"].comparison_operator #=> String
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.metrics["__string"].value #=> Float
# resp.campaign_response.additional_treatments[0].schedule.event_filter.filter_type #=> String, one of "SYSTEM", "ENDPOINT"
# resp.campaign_response.additional_treatments[0].schedule.frequency #=> String, one of "ONCE", "HOURLY", "DAILY", "WEEKLY", "MONTHLY", "EVENT"
# resp.campaign_response.additional_treatments[0].schedule.is_local_time #=> Boolean
# resp.campaign_response.additional_treatments[0].schedule.quiet_time.end #=> String
# resp.campaign_response.additional_treatments[0].schedule.quiet_time.start #=> String
# resp.campaign_response.additional_treatments[0].schedule.start_time #=> String
# resp.campaign_response.additional_treatments[0].schedule.timezone #=> String
# resp.campaign_response.additional_treatments[0].size_percent #=> Integer
# resp.campaign_response.additional_treatments[0].state.campaign_status #=> String, one of "SCHEDULED", "EXECUTING", "PENDING_NEXT_RUN", "COMPLETED", "PAUSED", "DELETED"
# resp.campaign_response.additional_treatments[0].treatment_description #=> String
# resp.campaign_response.additional_treatments[0].treatment_name #=> String
# resp.campaign_response.application_id #=> String
# resp.campaign_response.creation_date #=> String
# resp.campaign_response.default_state.campaign_status #=> String, one of "SCHEDULED", "EXECUTING", "PENDING_NEXT_RUN", "COMPLETED", "PAUSED", "DELETED"
# resp.campaign_response.description #=> String
# resp.campaign_response.holdout_percent #=> Integer
# resp.campaign_response.hook.lambda_function_name #=> String
# resp.campaign_response.hook.mode #=> String, one of "DELIVERY", "FILTER"
# resp.campaign_response.hook.web_url #=> String
# resp.campaign_response.id #=> String
# resp.campaign_response.is_paused #=> Boolean
# resp.campaign_response.last_modified_date #=> String
# resp.campaign_response.limits.daily #=> Integer
# resp.campaign_response.limits.maximum_duration #=> Integer
# resp.campaign_response.limits.messages_per_second #=> Integer
# resp.campaign_response.limits.total #=> Integer
# resp.campaign_response.message_configuration.adm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.message_configuration.adm_message.body #=> String
# resp.campaign_response.message_configuration.adm_message.image_icon_url #=> String
# resp.campaign_response.message_configuration.adm_message.image_small_icon_url #=> String
# resp.campaign_response.message_configuration.adm_message.image_url #=> String
# resp.campaign_response.message_configuration.adm_message.json_body #=> String
# resp.campaign_response.message_configuration.adm_message.media_url #=> String
# resp.campaign_response.message_configuration.adm_message.raw_content #=> String
# resp.campaign_response.message_configuration.adm_message.silent_push #=> Boolean
# resp.campaign_response.message_configuration.adm_message.time_to_live #=> Integer
# resp.campaign_response.message_configuration.adm_message.title #=> String
# resp.campaign_response.message_configuration.adm_message.url #=> String
# resp.campaign_response.message_configuration.apns_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.message_configuration.apns_message.body #=> String
# resp.campaign_response.message_configuration.apns_message.image_icon_url #=> String
# resp.campaign_response.message_configuration.apns_message.image_small_icon_url #=> String
# resp.campaign_response.message_configuration.apns_message.image_url #=> String
# resp.campaign_response.message_configuration.apns_message.json_body #=> String
# resp.campaign_response.message_configuration.apns_message.media_url #=> String
# resp.campaign_response.message_configuration.apns_message.raw_content #=> String
# resp.campaign_response.message_configuration.apns_message.silent_push #=> Boolean
# resp.campaign_response.message_configuration.apns_message.time_to_live #=> Integer
# resp.campaign_response.message_configuration.apns_message.title #=> String
# resp.campaign_response.message_configuration.apns_message.url #=> String
# resp.campaign_response.message_configuration.baidu_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.message_configuration.baidu_message.body #=> String
# resp.campaign_response.message_configuration.baidu_message.image_icon_url #=> String
# resp.campaign_response.message_configuration.baidu_message.image_small_icon_url #=> String
# resp.campaign_response.message_configuration.baidu_message.image_url #=> String
# resp.campaign_response.message_configuration.baidu_message.json_body #=> String
# resp.campaign_response.message_configuration.baidu_message.media_url #=> String
# resp.campaign_response.message_configuration.baidu_message.raw_content #=> String
# resp.campaign_response.message_configuration.baidu_message.silent_push #=> Boolean
# resp.campaign_response.message_configuration.baidu_message.time_to_live #=> Integer
# resp.campaign_response.message_configuration.baidu_message.title #=> String
# resp.campaign_response.message_configuration.baidu_message.url #=> String
# resp.campaign_response.message_configuration.default_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.message_configuration.default_message.body #=> String
# resp.campaign_response.message_configuration.default_message.image_icon_url #=> String
# resp.campaign_response.message_configuration.default_message.image_small_icon_url #=> String
# resp.campaign_response.message_configuration.default_message.image_url #=> String
# resp.campaign_response.message_configuration.default_message.json_body #=> String
# resp.campaign_response.message_configuration.default_message.media_url #=> String
# resp.campaign_response.message_configuration.default_message.raw_content #=> String
# resp.campaign_response.message_configuration.default_message.silent_push #=> Boolean
# resp.campaign_response.message_configuration.default_message.time_to_live #=> Integer
# resp.campaign_response.message_configuration.default_message.title #=> String
# resp.campaign_response.message_configuration.default_message.url #=> String
# resp.campaign_response.message_configuration.email_message.body #=> String
# resp.campaign_response.message_configuration.email_message.from_address #=> String
# resp.campaign_response.message_configuration.email_message.html_body #=> String
# resp.campaign_response.message_configuration.email_message.title #=> String
# resp.campaign_response.message_configuration.gcm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.message_configuration.gcm_message.body #=> String
# resp.campaign_response.message_configuration.gcm_message.image_icon_url #=> String
# resp.campaign_response.message_configuration.gcm_message.image_small_icon_url #=> String
# resp.campaign_response.message_configuration.gcm_message.image_url #=> String
# resp.campaign_response.message_configuration.gcm_message.json_body #=> String
# resp.campaign_response.message_configuration.gcm_message.media_url #=> String
# resp.campaign_response.message_configuration.gcm_message.raw_content #=> String
# resp.campaign_response.message_configuration.gcm_message.silent_push #=> Boolean
# resp.campaign_response.message_configuration.gcm_message.time_to_live #=> Integer
# resp.campaign_response.message_configuration.gcm_message.title #=> String
# resp.campaign_response.message_configuration.gcm_message.url #=> String
# resp.campaign_response.message_configuration.sms_message.body #=> String
# resp.campaign_response.message_configuration.sms_message.message_type #=> String, one of "TRANSACTIONAL", "PROMOTIONAL"
# resp.campaign_response.message_configuration.sms_message.sender_id #=> String
# resp.campaign_response.name #=> String
# resp.campaign_response.schedule.end_time #=> String
# resp.campaign_response.schedule.event_filter.dimensions.attributes #=> Hash
# resp.campaign_response.schedule.event_filter.dimensions.attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaign_response.schedule.event_filter.dimensions.attributes["__string"].values #=> Array
# resp.campaign_response.schedule.event_filter.dimensions.attributes["__string"].values[0] #=> String
# resp.campaign_response.schedule.event_filter.dimensions.event_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaign_response.schedule.event_filter.dimensions.event_type.values #=> Array
# resp.campaign_response.schedule.event_filter.dimensions.event_type.values[0] #=> String
# resp.campaign_response.schedule.event_filter.dimensions.metrics #=> Hash
# resp.campaign_response.schedule.event_filter.dimensions.metrics["__string"].comparison_operator #=> String
# resp.campaign_response.schedule.event_filter.dimensions.metrics["__string"].value #=> Float
# resp.campaign_response.schedule.event_filter.filter_type #=> String, one of "SYSTEM", "ENDPOINT"
# resp.campaign_response.schedule.frequency #=> String, one of "ONCE", "HOURLY", "DAILY", "WEEKLY", "MONTHLY", "EVENT"
# resp.campaign_response.schedule.is_local_time #=> Boolean
# resp.campaign_response.schedule.quiet_time.end #=> String
# resp.campaign_response.schedule.quiet_time.start #=> String
# resp.campaign_response.schedule.start_time #=> String
# resp.campaign_response.schedule.timezone #=> String
# resp.campaign_response.segment_id #=> String
# resp.campaign_response.segment_version #=> Integer
# resp.campaign_response.state.campaign_status #=> String, one of "SCHEDULED", "EXECUTING", "PENDING_NEXT_RUN", "COMPLETED", "PAUSED", "DELETED"
# resp.campaign_response.treatment_description #=> String
# resp.campaign_response.treatment_name #=> String
# resp.campaign_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/DeleteCampaign AWS API Documentation
#
# @overload delete_campaign(params = {})
# @param [Hash] params ({})
def delete_campaign(params = {}, options = {})
req = build_request(:delete_campaign, params)
req.send_request(options)
end
# Delete an email channel.
#
# @option params [required, String] :application_id
#
# @return [Types::DeleteEmailChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::DeleteEmailChannelResponse#email_channel_response #email_channel_response} => Types::EmailChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.delete_email_channel({
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.email_channel_response.application_id #=> String
# resp.email_channel_response.configuration_set #=> String
# resp.email_channel_response.creation_date #=> String
# resp.email_channel_response.enabled #=> Boolean
# resp.email_channel_response.from_address #=> String
# resp.email_channel_response.has_credential #=> Boolean
# resp.email_channel_response.id #=> String
# resp.email_channel_response.identity #=> String
# resp.email_channel_response.is_archived #=> Boolean
# resp.email_channel_response.last_modified_by #=> String
# resp.email_channel_response.last_modified_date #=> String
# resp.email_channel_response.messages_per_second #=> Integer
# resp.email_channel_response.platform #=> String
# resp.email_channel_response.role_arn #=> String
# resp.email_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/DeleteEmailChannel AWS API Documentation
#
# @overload delete_email_channel(params = {})
# @param [Hash] params ({})
def delete_email_channel(params = {}, options = {})
req = build_request(:delete_email_channel, params)
req.send_request(options)
end
# Deletes an endpoint.
#
# @option params [required, String] :application_id
#
# @option params [required, String] :endpoint_id
#
# @return [Types::DeleteEndpointResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::DeleteEndpointResponse#endpoint_response #endpoint_response} => Types::EndpointResponse
#
# @example Request syntax with placeholder values
#
# resp = client.delete_endpoint({
# application_id: "__string", # required
# endpoint_id: "__string", # required
# })
#
# @example Response structure
#
# resp.endpoint_response.address #=> String
# resp.endpoint_response.application_id #=> String
# resp.endpoint_response.attributes #=> Hash
# resp.endpoint_response.attributes["__string"] #=> Array
# resp.endpoint_response.attributes["__string"][0] #=> String
# resp.endpoint_response.channel_type #=> String, one of "GCM", "APNS", "APNS_SANDBOX", "APNS_VOIP", "APNS_VOIP_SANDBOX", "ADM", "SMS", "VOICE", "EMAIL", "BAIDU", "CUSTOM"
# resp.endpoint_response.cohort_id #=> String
# resp.endpoint_response.creation_date #=> String
# resp.endpoint_response.demographic.app_version #=> String
# resp.endpoint_response.demographic.locale #=> String
# resp.endpoint_response.demographic.make #=> String
# resp.endpoint_response.demographic.model #=> String
# resp.endpoint_response.demographic.model_version #=> String
# resp.endpoint_response.demographic.platform #=> String
# resp.endpoint_response.demographic.platform_version #=> String
# resp.endpoint_response.demographic.timezone #=> String
# resp.endpoint_response.effective_date #=> String
# resp.endpoint_response.endpoint_status #=> String
# resp.endpoint_response.id #=> String
# resp.endpoint_response.location.city #=> String
# resp.endpoint_response.location.country #=> String
# resp.endpoint_response.location.latitude #=> Float
# resp.endpoint_response.location.longitude #=> Float
# resp.endpoint_response.location.postal_code #=> String
# resp.endpoint_response.location.region #=> String
# resp.endpoint_response.metrics #=> Hash
# resp.endpoint_response.metrics["__string"] #=> Float
# resp.endpoint_response.opt_out #=> String
# resp.endpoint_response.request_id #=> String
# resp.endpoint_response.user.user_attributes #=> Hash
# resp.endpoint_response.user.user_attributes["__string"] #=> Array
# resp.endpoint_response.user.user_attributes["__string"][0] #=> String
# resp.endpoint_response.user.user_id #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/DeleteEndpoint AWS API Documentation
#
# @overload delete_endpoint(params = {})
# @param [Hash] params ({})
def delete_endpoint(params = {}, options = {})
req = build_request(:delete_endpoint, params)
req.send_request(options)
end
# Deletes the event stream for an app.
#
# @option params [required, String] :application_id
#
# @return [Types::DeleteEventStreamResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::DeleteEventStreamResponse#event_stream #event_stream} => Types::EventStream
#
# @example Request syntax with placeholder values
#
# resp = client.delete_event_stream({
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.event_stream.application_id #=> String
# resp.event_stream.destination_stream_arn #=> String
# resp.event_stream.external_id #=> String
# resp.event_stream.last_modified_date #=> String
# resp.event_stream.last_updated_by #=> String
# resp.event_stream.role_arn #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/DeleteEventStream AWS API Documentation
#
# @overload delete_event_stream(params = {})
# @param [Hash] params ({})
def delete_event_stream(params = {}, options = {})
req = build_request(:delete_event_stream, params)
req.send_request(options)
end
# Deletes the GCM channel for an app.
#
# @option params [required, String] :application_id
#
# @return [Types::DeleteGcmChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::DeleteGcmChannelResponse#gcm_channel_response #gcm_channel_response} => Types::GCMChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.delete_gcm_channel({
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.gcm_channel_response.application_id #=> String
# resp.gcm_channel_response.creation_date #=> String
# resp.gcm_channel_response.credential #=> String
# resp.gcm_channel_response.enabled #=> Boolean
# resp.gcm_channel_response.has_credential #=> Boolean
# resp.gcm_channel_response.id #=> String
# resp.gcm_channel_response.is_archived #=> Boolean
# resp.gcm_channel_response.last_modified_by #=> String
# resp.gcm_channel_response.last_modified_date #=> String
# resp.gcm_channel_response.platform #=> String
# resp.gcm_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/DeleteGcmChannel AWS API Documentation
#
# @overload delete_gcm_channel(params = {})
# @param [Hash] params ({})
def delete_gcm_channel(params = {}, options = {})
req = build_request(:delete_gcm_channel, params)
req.send_request(options)
end
# Deletes a segment.
#
# @option params [required, String] :application_id
#
# @option params [required, String] :segment_id
#
# @return [Types::DeleteSegmentResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::DeleteSegmentResponse#segment_response #segment_response} => Types::SegmentResponse
#
# @example Request syntax with placeholder values
#
# resp = client.delete_segment({
# application_id: "__string", # required
# segment_id: "__string", # required
# })
#
# @example Response structure
#
# resp.segment_response.application_id #=> String
# resp.segment_response.creation_date #=> String
# resp.segment_response.dimensions.attributes #=> Hash
# resp.segment_response.dimensions.attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.attributes["__string"].values #=> Array
# resp.segment_response.dimensions.attributes["__string"].values[0] #=> String
# resp.segment_response.dimensions.behavior.recency.duration #=> String, one of "HR_24", "DAY_7", "DAY_14", "DAY_30"
# resp.segment_response.dimensions.behavior.recency.recency_type #=> String, one of "ACTIVE", "INACTIVE"
# resp.segment_response.dimensions.demographic.app_version.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.app_version.values #=> Array
# resp.segment_response.dimensions.demographic.app_version.values[0] #=> String
# resp.segment_response.dimensions.demographic.channel.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.channel.values #=> Array
# resp.segment_response.dimensions.demographic.channel.values[0] #=> String
# resp.segment_response.dimensions.demographic.device_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.device_type.values #=> Array
# resp.segment_response.dimensions.demographic.device_type.values[0] #=> String
# resp.segment_response.dimensions.demographic.make.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.make.values #=> Array
# resp.segment_response.dimensions.demographic.make.values[0] #=> String
# resp.segment_response.dimensions.demographic.model.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.model.values #=> Array
# resp.segment_response.dimensions.demographic.model.values[0] #=> String
# resp.segment_response.dimensions.demographic.platform.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.platform.values #=> Array
# resp.segment_response.dimensions.demographic.platform.values[0] #=> String
# resp.segment_response.dimensions.location.country.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.location.country.values #=> Array
# resp.segment_response.dimensions.location.country.values[0] #=> String
# resp.segment_response.dimensions.location.gps_point.coordinates.latitude #=> Float
# resp.segment_response.dimensions.location.gps_point.coordinates.longitude #=> Float
# resp.segment_response.dimensions.location.gps_point.range_in_kilometers #=> Float
# resp.segment_response.dimensions.metrics #=> Hash
# resp.segment_response.dimensions.metrics["__string"].comparison_operator #=> String
# resp.segment_response.dimensions.metrics["__string"].value #=> Float
# resp.segment_response.dimensions.user_attributes #=> Hash
# resp.segment_response.dimensions.user_attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.user_attributes["__string"].values #=> Array
# resp.segment_response.dimensions.user_attributes["__string"].values[0] #=> String
# resp.segment_response.id #=> String
# resp.segment_response.import_definition.channel_counts #=> Hash
# resp.segment_response.import_definition.channel_counts["__string"] #=> Integer
# resp.segment_response.import_definition.external_id #=> String
# resp.segment_response.import_definition.format #=> String, one of "CSV", "JSON"
# resp.segment_response.import_definition.role_arn #=> String
# resp.segment_response.import_definition.s3_url #=> String
# resp.segment_response.import_definition.size #=> Integer
# resp.segment_response.last_modified_date #=> String
# resp.segment_response.name #=> String
# resp.segment_response.segment_groups.groups #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].attributes #=> Hash
# resp.segment_response.segment_groups.groups[0].dimensions[0].attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].attributes["__string"].values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].attributes["__string"].values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].behavior.recency.duration #=> String, one of "HR_24", "DAY_7", "DAY_14", "DAY_30"
# resp.segment_response.segment_groups.groups[0].dimensions[0].behavior.recency.recency_type #=> String, one of "ACTIVE", "INACTIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.app_version.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.app_version.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.app_version.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.channel.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.channel.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.channel.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.device_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.device_type.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.device_type.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.make.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.make.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.make.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.model.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.model.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.model.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.platform.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.platform.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.platform.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.country.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.country.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.country.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.gps_point.coordinates.latitude #=> Float
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.gps_point.coordinates.longitude #=> Float
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.gps_point.range_in_kilometers #=> Float
# resp.segment_response.segment_groups.groups[0].dimensions[0].metrics #=> Hash
# resp.segment_response.segment_groups.groups[0].dimensions[0].metrics["__string"].comparison_operator #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].metrics["__string"].value #=> Float
# resp.segment_response.segment_groups.groups[0].dimensions[0].user_attributes #=> Hash
# resp.segment_response.segment_groups.groups[0].dimensions[0].user_attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].user_attributes["__string"].values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].user_attributes["__string"].values[0] #=> String
# resp.segment_response.segment_groups.groups[0].source_segments #=> Array
# resp.segment_response.segment_groups.groups[0].source_segments[0].id #=> String
# resp.segment_response.segment_groups.groups[0].source_segments[0].version #=> Integer
# resp.segment_response.segment_groups.groups[0].source_type #=> String, one of "ALL", "ANY", "NONE"
# resp.segment_response.segment_groups.groups[0].type #=> String, one of "ALL", "ANY", "NONE"
# resp.segment_response.segment_groups.include #=> String, one of "ALL", "ANY", "NONE"
# resp.segment_response.segment_type #=> String, one of "DIMENSIONAL", "IMPORT"
# resp.segment_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/DeleteSegment AWS API Documentation
#
# @overload delete_segment(params = {})
# @param [Hash] params ({})
def delete_segment(params = {}, options = {})
req = build_request(:delete_segment, params)
req.send_request(options)
end
# Delete an SMS channel.
#
# @option params [required, String] :application_id
#
# @return [Types::DeleteSmsChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::DeleteSmsChannelResponse#sms_channel_response #sms_channel_response} => Types::SMSChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.delete_sms_channel({
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.sms_channel_response.application_id #=> String
# resp.sms_channel_response.creation_date #=> String
# resp.sms_channel_response.enabled #=> Boolean
# resp.sms_channel_response.has_credential #=> Boolean
# resp.sms_channel_response.id #=> String
# resp.sms_channel_response.is_archived #=> Boolean
# resp.sms_channel_response.last_modified_by #=> String
# resp.sms_channel_response.last_modified_date #=> String
# resp.sms_channel_response.platform #=> String
# resp.sms_channel_response.promotional_messages_per_second #=> Integer
# resp.sms_channel_response.sender_id #=> String
# resp.sms_channel_response.short_code #=> String
# resp.sms_channel_response.transactional_messages_per_second #=> Integer
# resp.sms_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/DeleteSmsChannel AWS API Documentation
#
# @overload delete_sms_channel(params = {})
# @param [Hash] params ({})
def delete_sms_channel(params = {}, options = {})
req = build_request(:delete_sms_channel, params)
req.send_request(options)
end
# Deletes endpoints that are associated with a User ID.
#
# @option params [required, String] :application_id
#
# @option params [required, String] :user_id
#
# @return [Types::DeleteUserEndpointsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::DeleteUserEndpointsResponse#endpoints_response #endpoints_response} => Types::EndpointsResponse
#
# @example Request syntax with placeholder values
#
# resp = client.delete_user_endpoints({
# application_id: "__string", # required
# user_id: "__string", # required
# })
#
# @example Response structure
#
# resp.endpoints_response.item #=> Array
# resp.endpoints_response.item[0].address #=> String
# resp.endpoints_response.item[0].application_id #=> String
# resp.endpoints_response.item[0].attributes #=> Hash
# resp.endpoints_response.item[0].attributes["__string"] #=> Array
# resp.endpoints_response.item[0].attributes["__string"][0] #=> String
# resp.endpoints_response.item[0].channel_type #=> String, one of "GCM", "APNS", "APNS_SANDBOX", "APNS_VOIP", "APNS_VOIP_SANDBOX", "ADM", "SMS", "VOICE", "EMAIL", "BAIDU", "CUSTOM"
# resp.endpoints_response.item[0].cohort_id #=> String
# resp.endpoints_response.item[0].creation_date #=> String
# resp.endpoints_response.item[0].demographic.app_version #=> String
# resp.endpoints_response.item[0].demographic.locale #=> String
# resp.endpoints_response.item[0].demographic.make #=> String
# resp.endpoints_response.item[0].demographic.model #=> String
# resp.endpoints_response.item[0].demographic.model_version #=> String
# resp.endpoints_response.item[0].demographic.platform #=> String
# resp.endpoints_response.item[0].demographic.platform_version #=> String
# resp.endpoints_response.item[0].demographic.timezone #=> String
# resp.endpoints_response.item[0].effective_date #=> String
# resp.endpoints_response.item[0].endpoint_status #=> String
# resp.endpoints_response.item[0].id #=> String
# resp.endpoints_response.item[0].location.city #=> String
# resp.endpoints_response.item[0].location.country #=> String
# resp.endpoints_response.item[0].location.latitude #=> Float
# resp.endpoints_response.item[0].location.longitude #=> Float
# resp.endpoints_response.item[0].location.postal_code #=> String
# resp.endpoints_response.item[0].location.region #=> String
# resp.endpoints_response.item[0].metrics #=> Hash
# resp.endpoints_response.item[0].metrics["__string"] #=> Float
# resp.endpoints_response.item[0].opt_out #=> String
# resp.endpoints_response.item[0].request_id #=> String
# resp.endpoints_response.item[0].user.user_attributes #=> Hash
# resp.endpoints_response.item[0].user.user_attributes["__string"] #=> Array
# resp.endpoints_response.item[0].user.user_attributes["__string"][0] #=> String
# resp.endpoints_response.item[0].user.user_id #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/DeleteUserEndpoints AWS API Documentation
#
# @overload delete_user_endpoints(params = {})
# @param [Hash] params ({})
def delete_user_endpoints(params = {}, options = {})
req = build_request(:delete_user_endpoints, params)
req.send_request(options)
end
# Delete an Voice channel
#
# @option params [required, String] :application_id
#
# @return [Types::DeleteVoiceChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::DeleteVoiceChannelResponse#voice_channel_response #voice_channel_response} => Types::VoiceChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.delete_voice_channel({
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.voice_channel_response.application_id #=> String
# resp.voice_channel_response.creation_date #=> String
# resp.voice_channel_response.enabled #=> Boolean
# resp.voice_channel_response.has_credential #=> Boolean
# resp.voice_channel_response.id #=> String
# resp.voice_channel_response.is_archived #=> Boolean
# resp.voice_channel_response.last_modified_by #=> String
# resp.voice_channel_response.last_modified_date #=> String
# resp.voice_channel_response.platform #=> String
# resp.voice_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/DeleteVoiceChannel AWS API Documentation
#
# @overload delete_voice_channel(params = {})
# @param [Hash] params ({})
def delete_voice_channel(params = {}, options = {})
req = build_request(:delete_voice_channel, params)
req.send_request(options)
end
# Get an ADM channel.
#
# @option params [required, String] :application_id
#
# @return [Types::GetAdmChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetAdmChannelResponse#adm_channel_response #adm_channel_response} => Types::ADMChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_adm_channel({
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.adm_channel_response.application_id #=> String
# resp.adm_channel_response.creation_date #=> String
# resp.adm_channel_response.enabled #=> Boolean
# resp.adm_channel_response.has_credential #=> Boolean
# resp.adm_channel_response.id #=> String
# resp.adm_channel_response.is_archived #=> Boolean
# resp.adm_channel_response.last_modified_by #=> String
# resp.adm_channel_response.last_modified_date #=> String
# resp.adm_channel_response.platform #=> String
# resp.adm_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetAdmChannel AWS API Documentation
#
# @overload get_adm_channel(params = {})
# @param [Hash] params ({})
def get_adm_channel(params = {}, options = {})
req = build_request(:get_adm_channel, params)
req.send_request(options)
end
# Returns information about the APNs channel for an app.
#
# @option params [required, String] :application_id
#
# @return [Types::GetApnsChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetApnsChannelResponse#apns_channel_response #apns_channel_response} => Types::APNSChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_apns_channel({
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.apns_channel_response.application_id #=> String
# resp.apns_channel_response.creation_date #=> String
# resp.apns_channel_response.default_authentication_method #=> String
# resp.apns_channel_response.enabled #=> Boolean
# resp.apns_channel_response.has_credential #=> Boolean
# resp.apns_channel_response.has_token_key #=> Boolean
# resp.apns_channel_response.id #=> String
# resp.apns_channel_response.is_archived #=> Boolean
# resp.apns_channel_response.last_modified_by #=> String
# resp.apns_channel_response.last_modified_date #=> String
# resp.apns_channel_response.platform #=> String
# resp.apns_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetApnsChannel AWS API Documentation
#
# @overload get_apns_channel(params = {})
# @param [Hash] params ({})
def get_apns_channel(params = {}, options = {})
req = build_request(:get_apns_channel, params)
req.send_request(options)
end
# Get an APNS sandbox channel.
#
# @option params [required, String] :application_id
#
# @return [Types::GetApnsSandboxChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetApnsSandboxChannelResponse#apns_sandbox_channel_response #apns_sandbox_channel_response} => Types::APNSSandboxChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_apns_sandbox_channel({
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.apns_sandbox_channel_response.application_id #=> String
# resp.apns_sandbox_channel_response.creation_date #=> String
# resp.apns_sandbox_channel_response.default_authentication_method #=> String
# resp.apns_sandbox_channel_response.enabled #=> Boolean
# resp.apns_sandbox_channel_response.has_credential #=> Boolean
# resp.apns_sandbox_channel_response.has_token_key #=> Boolean
# resp.apns_sandbox_channel_response.id #=> String
# resp.apns_sandbox_channel_response.is_archived #=> Boolean
# resp.apns_sandbox_channel_response.last_modified_by #=> String
# resp.apns_sandbox_channel_response.last_modified_date #=> String
# resp.apns_sandbox_channel_response.platform #=> String
# resp.apns_sandbox_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetApnsSandboxChannel AWS API Documentation
#
# @overload get_apns_sandbox_channel(params = {})
# @param [Hash] params ({})
def get_apns_sandbox_channel(params = {}, options = {})
req = build_request(:get_apns_sandbox_channel, params)
req.send_request(options)
end
# Get an APNS VoIP channel
#
# @option params [required, String] :application_id
#
# @return [Types::GetApnsVoipChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetApnsVoipChannelResponse#apns_voip_channel_response #apns_voip_channel_response} => Types::APNSVoipChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_apns_voip_channel({
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.apns_voip_channel_response.application_id #=> String
# resp.apns_voip_channel_response.creation_date #=> String
# resp.apns_voip_channel_response.default_authentication_method #=> String
# resp.apns_voip_channel_response.enabled #=> Boolean
# resp.apns_voip_channel_response.has_credential #=> Boolean
# resp.apns_voip_channel_response.has_token_key #=> Boolean
# resp.apns_voip_channel_response.id #=> String
# resp.apns_voip_channel_response.is_archived #=> Boolean
# resp.apns_voip_channel_response.last_modified_by #=> String
# resp.apns_voip_channel_response.last_modified_date #=> String
# resp.apns_voip_channel_response.platform #=> String
# resp.apns_voip_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetApnsVoipChannel AWS API Documentation
#
# @overload get_apns_voip_channel(params = {})
# @param [Hash] params ({})
def get_apns_voip_channel(params = {}, options = {})
req = build_request(:get_apns_voip_channel, params)
req.send_request(options)
end
# Get an APNS VoIPSandbox channel
#
# @option params [required, String] :application_id
#
# @return [Types::GetApnsVoipSandboxChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetApnsVoipSandboxChannelResponse#apns_voip_sandbox_channel_response #apns_voip_sandbox_channel_response} => Types::APNSVoipSandboxChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_apns_voip_sandbox_channel({
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.apns_voip_sandbox_channel_response.application_id #=> String
# resp.apns_voip_sandbox_channel_response.creation_date #=> String
# resp.apns_voip_sandbox_channel_response.default_authentication_method #=> String
# resp.apns_voip_sandbox_channel_response.enabled #=> Boolean
# resp.apns_voip_sandbox_channel_response.has_credential #=> Boolean
# resp.apns_voip_sandbox_channel_response.has_token_key #=> Boolean
# resp.apns_voip_sandbox_channel_response.id #=> String
# resp.apns_voip_sandbox_channel_response.is_archived #=> Boolean
# resp.apns_voip_sandbox_channel_response.last_modified_by #=> String
# resp.apns_voip_sandbox_channel_response.last_modified_date #=> String
# resp.apns_voip_sandbox_channel_response.platform #=> String
# resp.apns_voip_sandbox_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetApnsVoipSandboxChannel AWS API Documentation
#
# @overload get_apns_voip_sandbox_channel(params = {})
# @param [Hash] params ({})
def get_apns_voip_sandbox_channel(params = {}, options = {})
req = build_request(:get_apns_voip_sandbox_channel, params)
req.send_request(options)
end
# Returns information about an app.
#
# @option params [required, String] :application_id
#
# @return [Types::GetAppResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetAppResponse#application_response #application_response} => Types::ApplicationResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_app({
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.application_response.id #=> String
# resp.application_response.name #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetApp AWS API Documentation
#
# @overload get_app(params = {})
# @param [Hash] params ({})
def get_app(params = {}, options = {})
req = build_request(:get_app, params)
req.send_request(options)
end
# Used to request the settings for an app.
#
# @option params [required, String] :application_id
#
# @return [Types::GetApplicationSettingsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetApplicationSettingsResponse#application_settings_resource #application_settings_resource} => Types::ApplicationSettingsResource
#
# @example Request syntax with placeholder values
#
# resp = client.get_application_settings({
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.application_settings_resource.application_id #=> String
# resp.application_settings_resource.campaign_hook.lambda_function_name #=> String
# resp.application_settings_resource.campaign_hook.mode #=> String, one of "DELIVERY", "FILTER"
# resp.application_settings_resource.campaign_hook.web_url #=> String
# resp.application_settings_resource.last_modified_date #=> String
# resp.application_settings_resource.limits.daily #=> Integer
# resp.application_settings_resource.limits.maximum_duration #=> Integer
# resp.application_settings_resource.limits.messages_per_second #=> Integer
# resp.application_settings_resource.limits.total #=> Integer
# resp.application_settings_resource.quiet_time.end #=> String
# resp.application_settings_resource.quiet_time.start #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetApplicationSettings AWS API Documentation
#
# @overload get_application_settings(params = {})
# @param [Hash] params ({})
def get_application_settings(params = {}, options = {})
req = build_request(:get_application_settings, params)
req.send_request(options)
end
# Returns information about your apps.
#
# @option params [String] :page_size
#
# @option params [String] :token
#
# @return [Types::GetAppsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetAppsResponse#applications_response #applications_response} => Types::ApplicationsResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_apps({
# page_size: "__string",
# token: "__string",
# })
#
# @example Response structure
#
# resp.applications_response.item #=> Array
# resp.applications_response.item[0].id #=> String
# resp.applications_response.item[0].name #=> String
# resp.applications_response.next_token #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetApps AWS API Documentation
#
# @overload get_apps(params = {})
# @param [Hash] params ({})
def get_apps(params = {}, options = {})
req = build_request(:get_apps, params)
req.send_request(options)
end
# Get a BAIDU GCM channel
#
# @option params [required, String] :application_id
#
# @return [Types::GetBaiduChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetBaiduChannelResponse#baidu_channel_response #baidu_channel_response} => Types::BaiduChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_baidu_channel({
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.baidu_channel_response.application_id #=> String
# resp.baidu_channel_response.creation_date #=> String
# resp.baidu_channel_response.credential #=> String
# resp.baidu_channel_response.enabled #=> Boolean
# resp.baidu_channel_response.has_credential #=> Boolean
# resp.baidu_channel_response.id #=> String
# resp.baidu_channel_response.is_archived #=> Boolean
# resp.baidu_channel_response.last_modified_by #=> String
# resp.baidu_channel_response.last_modified_date #=> String
# resp.baidu_channel_response.platform #=> String
# resp.baidu_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetBaiduChannel AWS API Documentation
#
# @overload get_baidu_channel(params = {})
# @param [Hash] params ({})
def get_baidu_channel(params = {}, options = {})
req = build_request(:get_baidu_channel, params)
req.send_request(options)
end
# Returns information about a campaign.
#
# @option params [required, String] :application_id
#
# @option params [required, String] :campaign_id
#
# @return [Types::GetCampaignResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetCampaignResponse#campaign_response #campaign_response} => Types::CampaignResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_campaign({
# application_id: "__string", # required
# campaign_id: "__string", # required
# })
#
# @example Response structure
#
# resp.campaign_response.additional_treatments #=> Array
# resp.campaign_response.additional_treatments[0].id #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.image_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.image_small_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.image_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.json_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.media_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.raw_content #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.silent_push #=> Boolean
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.time_to_live #=> Integer
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.image_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.image_small_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.image_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.json_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.media_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.raw_content #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.silent_push #=> Boolean
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.time_to_live #=> Integer
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.image_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.image_small_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.image_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.json_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.media_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.raw_content #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.silent_push #=> Boolean
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.time_to_live #=> Integer
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.image_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.image_small_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.image_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.json_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.media_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.raw_content #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.silent_push #=> Boolean
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.time_to_live #=> Integer
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.email_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.email_message.from_address #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.email_message.html_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.email_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.image_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.image_small_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.image_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.json_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.media_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.raw_content #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.silent_push #=> Boolean
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.time_to_live #=> Integer
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.sms_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.sms_message.message_type #=> String, one of "TRANSACTIONAL", "PROMOTIONAL"
# resp.campaign_response.additional_treatments[0].message_configuration.sms_message.sender_id #=> String
# resp.campaign_response.additional_treatments[0].schedule.end_time #=> String
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.attributes #=> Hash
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.attributes["__string"].values #=> Array
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.attributes["__string"].values[0] #=> String
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.event_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.event_type.values #=> Array
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.event_type.values[0] #=> String
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.metrics #=> Hash
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.metrics["__string"].comparison_operator #=> String
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.metrics["__string"].value #=> Float
# resp.campaign_response.additional_treatments[0].schedule.event_filter.filter_type #=> String, one of "SYSTEM", "ENDPOINT"
# resp.campaign_response.additional_treatments[0].schedule.frequency #=> String, one of "ONCE", "HOURLY", "DAILY", "WEEKLY", "MONTHLY", "EVENT"
# resp.campaign_response.additional_treatments[0].schedule.is_local_time #=> Boolean
# resp.campaign_response.additional_treatments[0].schedule.quiet_time.end #=> String
# resp.campaign_response.additional_treatments[0].schedule.quiet_time.start #=> String
# resp.campaign_response.additional_treatments[0].schedule.start_time #=> String
# resp.campaign_response.additional_treatments[0].schedule.timezone #=> String
# resp.campaign_response.additional_treatments[0].size_percent #=> Integer
# resp.campaign_response.additional_treatments[0].state.campaign_status #=> String, one of "SCHEDULED", "EXECUTING", "PENDING_NEXT_RUN", "COMPLETED", "PAUSED", "DELETED"
# resp.campaign_response.additional_treatments[0].treatment_description #=> String
# resp.campaign_response.additional_treatments[0].treatment_name #=> String
# resp.campaign_response.application_id #=> String
# resp.campaign_response.creation_date #=> String
# resp.campaign_response.default_state.campaign_status #=> String, one of "SCHEDULED", "EXECUTING", "PENDING_NEXT_RUN", "COMPLETED", "PAUSED", "DELETED"
# resp.campaign_response.description #=> String
# resp.campaign_response.holdout_percent #=> Integer
# resp.campaign_response.hook.lambda_function_name #=> String
# resp.campaign_response.hook.mode #=> String, one of "DELIVERY", "FILTER"
# resp.campaign_response.hook.web_url #=> String
# resp.campaign_response.id #=> String
# resp.campaign_response.is_paused #=> Boolean
# resp.campaign_response.last_modified_date #=> String
# resp.campaign_response.limits.daily #=> Integer
# resp.campaign_response.limits.maximum_duration #=> Integer
# resp.campaign_response.limits.messages_per_second #=> Integer
# resp.campaign_response.limits.total #=> Integer
# resp.campaign_response.message_configuration.adm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.message_configuration.adm_message.body #=> String
# resp.campaign_response.message_configuration.adm_message.image_icon_url #=> String
# resp.campaign_response.message_configuration.adm_message.image_small_icon_url #=> String
# resp.campaign_response.message_configuration.adm_message.image_url #=> String
# resp.campaign_response.message_configuration.adm_message.json_body #=> String
# resp.campaign_response.message_configuration.adm_message.media_url #=> String
# resp.campaign_response.message_configuration.adm_message.raw_content #=> String
# resp.campaign_response.message_configuration.adm_message.silent_push #=> Boolean
# resp.campaign_response.message_configuration.adm_message.time_to_live #=> Integer
# resp.campaign_response.message_configuration.adm_message.title #=> String
# resp.campaign_response.message_configuration.adm_message.url #=> String
# resp.campaign_response.message_configuration.apns_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.message_configuration.apns_message.body #=> String
# resp.campaign_response.message_configuration.apns_message.image_icon_url #=> String
# resp.campaign_response.message_configuration.apns_message.image_small_icon_url #=> String
# resp.campaign_response.message_configuration.apns_message.image_url #=> String
# resp.campaign_response.message_configuration.apns_message.json_body #=> String
# resp.campaign_response.message_configuration.apns_message.media_url #=> String
# resp.campaign_response.message_configuration.apns_message.raw_content #=> String
# resp.campaign_response.message_configuration.apns_message.silent_push #=> Boolean
# resp.campaign_response.message_configuration.apns_message.time_to_live #=> Integer
# resp.campaign_response.message_configuration.apns_message.title #=> String
# resp.campaign_response.message_configuration.apns_message.url #=> String
# resp.campaign_response.message_configuration.baidu_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.message_configuration.baidu_message.body #=> String
# resp.campaign_response.message_configuration.baidu_message.image_icon_url #=> String
# resp.campaign_response.message_configuration.baidu_message.image_small_icon_url #=> String
# resp.campaign_response.message_configuration.baidu_message.image_url #=> String
# resp.campaign_response.message_configuration.baidu_message.json_body #=> String
# resp.campaign_response.message_configuration.baidu_message.media_url #=> String
# resp.campaign_response.message_configuration.baidu_message.raw_content #=> String
# resp.campaign_response.message_configuration.baidu_message.silent_push #=> Boolean
# resp.campaign_response.message_configuration.baidu_message.time_to_live #=> Integer
# resp.campaign_response.message_configuration.baidu_message.title #=> String
# resp.campaign_response.message_configuration.baidu_message.url #=> String
# resp.campaign_response.message_configuration.default_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.message_configuration.default_message.body #=> String
# resp.campaign_response.message_configuration.default_message.image_icon_url #=> String
# resp.campaign_response.message_configuration.default_message.image_small_icon_url #=> String
# resp.campaign_response.message_configuration.default_message.image_url #=> String
# resp.campaign_response.message_configuration.default_message.json_body #=> String
# resp.campaign_response.message_configuration.default_message.media_url #=> String
# resp.campaign_response.message_configuration.default_message.raw_content #=> String
# resp.campaign_response.message_configuration.default_message.silent_push #=> Boolean
# resp.campaign_response.message_configuration.default_message.time_to_live #=> Integer
# resp.campaign_response.message_configuration.default_message.title #=> String
# resp.campaign_response.message_configuration.default_message.url #=> String
# resp.campaign_response.message_configuration.email_message.body #=> String
# resp.campaign_response.message_configuration.email_message.from_address #=> String
# resp.campaign_response.message_configuration.email_message.html_body #=> String
# resp.campaign_response.message_configuration.email_message.title #=> String
# resp.campaign_response.message_configuration.gcm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.message_configuration.gcm_message.body #=> String
# resp.campaign_response.message_configuration.gcm_message.image_icon_url #=> String
# resp.campaign_response.message_configuration.gcm_message.image_small_icon_url #=> String
# resp.campaign_response.message_configuration.gcm_message.image_url #=> String
# resp.campaign_response.message_configuration.gcm_message.json_body #=> String
# resp.campaign_response.message_configuration.gcm_message.media_url #=> String
# resp.campaign_response.message_configuration.gcm_message.raw_content #=> String
# resp.campaign_response.message_configuration.gcm_message.silent_push #=> Boolean
# resp.campaign_response.message_configuration.gcm_message.time_to_live #=> Integer
# resp.campaign_response.message_configuration.gcm_message.title #=> String
# resp.campaign_response.message_configuration.gcm_message.url #=> String
# resp.campaign_response.message_configuration.sms_message.body #=> String
# resp.campaign_response.message_configuration.sms_message.message_type #=> String, one of "TRANSACTIONAL", "PROMOTIONAL"
# resp.campaign_response.message_configuration.sms_message.sender_id #=> String
# resp.campaign_response.name #=> String
# resp.campaign_response.schedule.end_time #=> String
# resp.campaign_response.schedule.event_filter.dimensions.attributes #=> Hash
# resp.campaign_response.schedule.event_filter.dimensions.attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaign_response.schedule.event_filter.dimensions.attributes["__string"].values #=> Array
# resp.campaign_response.schedule.event_filter.dimensions.attributes["__string"].values[0] #=> String
# resp.campaign_response.schedule.event_filter.dimensions.event_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaign_response.schedule.event_filter.dimensions.event_type.values #=> Array
# resp.campaign_response.schedule.event_filter.dimensions.event_type.values[0] #=> String
# resp.campaign_response.schedule.event_filter.dimensions.metrics #=> Hash
# resp.campaign_response.schedule.event_filter.dimensions.metrics["__string"].comparison_operator #=> String
# resp.campaign_response.schedule.event_filter.dimensions.metrics["__string"].value #=> Float
# resp.campaign_response.schedule.event_filter.filter_type #=> String, one of "SYSTEM", "ENDPOINT"
# resp.campaign_response.schedule.frequency #=> String, one of "ONCE", "HOURLY", "DAILY", "WEEKLY", "MONTHLY", "EVENT"
# resp.campaign_response.schedule.is_local_time #=> Boolean
# resp.campaign_response.schedule.quiet_time.end #=> String
# resp.campaign_response.schedule.quiet_time.start #=> String
# resp.campaign_response.schedule.start_time #=> String
# resp.campaign_response.schedule.timezone #=> String
# resp.campaign_response.segment_id #=> String
# resp.campaign_response.segment_version #=> Integer
# resp.campaign_response.state.campaign_status #=> String, one of "SCHEDULED", "EXECUTING", "PENDING_NEXT_RUN", "COMPLETED", "PAUSED", "DELETED"
# resp.campaign_response.treatment_description #=> String
# resp.campaign_response.treatment_name #=> String
# resp.campaign_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetCampaign AWS API Documentation
#
# @overload get_campaign(params = {})
# @param [Hash] params ({})
def get_campaign(params = {}, options = {})
req = build_request(:get_campaign, params)
req.send_request(options)
end
# Returns information about the activity performed by a campaign.
#
# @option params [required, String] :application_id
#
# @option params [required, String] :campaign_id
#
# @option params [String] :page_size
#
# @option params [String] :token
#
# @return [Types::GetCampaignActivitiesResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetCampaignActivitiesResponse#activities_response #activities_response} => Types::ActivitiesResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_campaign_activities({
# application_id: "__string", # required
# campaign_id: "__string", # required
# page_size: "__string",
# token: "__string",
# })
#
# @example Response structure
#
# resp.activities_response.item #=> Array
# resp.activities_response.item[0].application_id #=> String
# resp.activities_response.item[0].campaign_id #=> String
# resp.activities_response.item[0].end #=> String
# resp.activities_response.item[0].id #=> String
# resp.activities_response.item[0].result #=> String
# resp.activities_response.item[0].scheduled_start #=> String
# resp.activities_response.item[0].start #=> String
# resp.activities_response.item[0].state #=> String
# resp.activities_response.item[0].successful_endpoint_count #=> Integer
# resp.activities_response.item[0].timezones_completed_count #=> Integer
# resp.activities_response.item[0].timezones_total_count #=> Integer
# resp.activities_response.item[0].total_endpoint_count #=> Integer
# resp.activities_response.item[0].treatment_id #=> String
# resp.activities_response.next_token #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetCampaignActivities AWS API Documentation
#
# @overload get_campaign_activities(params = {})
# @param [Hash] params ({})
def get_campaign_activities(params = {}, options = {})
req = build_request(:get_campaign_activities, params)
req.send_request(options)
end
# Returns information about a specific version of a campaign.
#
# @option params [required, String] :application_id
#
# @option params [required, String] :campaign_id
#
# @option params [required, String] :version
#
# @return [Types::GetCampaignVersionResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetCampaignVersionResponse#campaign_response #campaign_response} => Types::CampaignResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_campaign_version({
# application_id: "__string", # required
# campaign_id: "__string", # required
# version: "__string", # required
# })
#
# @example Response structure
#
# resp.campaign_response.additional_treatments #=> Array
# resp.campaign_response.additional_treatments[0].id #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.image_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.image_small_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.image_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.json_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.media_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.raw_content #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.silent_push #=> Boolean
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.time_to_live #=> Integer
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.image_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.image_small_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.image_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.json_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.media_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.raw_content #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.silent_push #=> Boolean
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.time_to_live #=> Integer
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.image_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.image_small_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.image_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.json_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.media_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.raw_content #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.silent_push #=> Boolean
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.time_to_live #=> Integer
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.image_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.image_small_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.image_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.json_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.media_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.raw_content #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.silent_push #=> Boolean
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.time_to_live #=> Integer
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.email_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.email_message.from_address #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.email_message.html_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.email_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.image_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.image_small_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.image_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.json_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.media_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.raw_content #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.silent_push #=> Boolean
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.time_to_live #=> Integer
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.sms_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.sms_message.message_type #=> String, one of "TRANSACTIONAL", "PROMOTIONAL"
# resp.campaign_response.additional_treatments[0].message_configuration.sms_message.sender_id #=> String
# resp.campaign_response.additional_treatments[0].schedule.end_time #=> String
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.attributes #=> Hash
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.attributes["__string"].values #=> Array
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.attributes["__string"].values[0] #=> String
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.event_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.event_type.values #=> Array
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.event_type.values[0] #=> String
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.metrics #=> Hash
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.metrics["__string"].comparison_operator #=> String
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.metrics["__string"].value #=> Float
# resp.campaign_response.additional_treatments[0].schedule.event_filter.filter_type #=> String, one of "SYSTEM", "ENDPOINT"
# resp.campaign_response.additional_treatments[0].schedule.frequency #=> String, one of "ONCE", "HOURLY", "DAILY", "WEEKLY", "MONTHLY", "EVENT"
# resp.campaign_response.additional_treatments[0].schedule.is_local_time #=> Boolean
# resp.campaign_response.additional_treatments[0].schedule.quiet_time.end #=> String
# resp.campaign_response.additional_treatments[0].schedule.quiet_time.start #=> String
# resp.campaign_response.additional_treatments[0].schedule.start_time #=> String
# resp.campaign_response.additional_treatments[0].schedule.timezone #=> String
# resp.campaign_response.additional_treatments[0].size_percent #=> Integer
# resp.campaign_response.additional_treatments[0].state.campaign_status #=> String, one of "SCHEDULED", "EXECUTING", "PENDING_NEXT_RUN", "COMPLETED", "PAUSED", "DELETED"
# resp.campaign_response.additional_treatments[0].treatment_description #=> String
# resp.campaign_response.additional_treatments[0].treatment_name #=> String
# resp.campaign_response.application_id #=> String
# resp.campaign_response.creation_date #=> String
# resp.campaign_response.default_state.campaign_status #=> String, one of "SCHEDULED", "EXECUTING", "PENDING_NEXT_RUN", "COMPLETED", "PAUSED", "DELETED"
# resp.campaign_response.description #=> String
# resp.campaign_response.holdout_percent #=> Integer
# resp.campaign_response.hook.lambda_function_name #=> String
# resp.campaign_response.hook.mode #=> String, one of "DELIVERY", "FILTER"
# resp.campaign_response.hook.web_url #=> String
# resp.campaign_response.id #=> String
# resp.campaign_response.is_paused #=> Boolean
# resp.campaign_response.last_modified_date #=> String
# resp.campaign_response.limits.daily #=> Integer
# resp.campaign_response.limits.maximum_duration #=> Integer
# resp.campaign_response.limits.messages_per_second #=> Integer
# resp.campaign_response.limits.total #=> Integer
# resp.campaign_response.message_configuration.adm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.message_configuration.adm_message.body #=> String
# resp.campaign_response.message_configuration.adm_message.image_icon_url #=> String
# resp.campaign_response.message_configuration.adm_message.image_small_icon_url #=> String
# resp.campaign_response.message_configuration.adm_message.image_url #=> String
# resp.campaign_response.message_configuration.adm_message.json_body #=> String
# resp.campaign_response.message_configuration.adm_message.media_url #=> String
# resp.campaign_response.message_configuration.adm_message.raw_content #=> String
# resp.campaign_response.message_configuration.adm_message.silent_push #=> Boolean
# resp.campaign_response.message_configuration.adm_message.time_to_live #=> Integer
# resp.campaign_response.message_configuration.adm_message.title #=> String
# resp.campaign_response.message_configuration.adm_message.url #=> String
# resp.campaign_response.message_configuration.apns_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.message_configuration.apns_message.body #=> String
# resp.campaign_response.message_configuration.apns_message.image_icon_url #=> String
# resp.campaign_response.message_configuration.apns_message.image_small_icon_url #=> String
# resp.campaign_response.message_configuration.apns_message.image_url #=> String
# resp.campaign_response.message_configuration.apns_message.json_body #=> String
# resp.campaign_response.message_configuration.apns_message.media_url #=> String
# resp.campaign_response.message_configuration.apns_message.raw_content #=> String
# resp.campaign_response.message_configuration.apns_message.silent_push #=> Boolean
# resp.campaign_response.message_configuration.apns_message.time_to_live #=> Integer
# resp.campaign_response.message_configuration.apns_message.title #=> String
# resp.campaign_response.message_configuration.apns_message.url #=> String
# resp.campaign_response.message_configuration.baidu_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.message_configuration.baidu_message.body #=> String
# resp.campaign_response.message_configuration.baidu_message.image_icon_url #=> String
# resp.campaign_response.message_configuration.baidu_message.image_small_icon_url #=> String
# resp.campaign_response.message_configuration.baidu_message.image_url #=> String
# resp.campaign_response.message_configuration.baidu_message.json_body #=> String
# resp.campaign_response.message_configuration.baidu_message.media_url #=> String
# resp.campaign_response.message_configuration.baidu_message.raw_content #=> String
# resp.campaign_response.message_configuration.baidu_message.silent_push #=> Boolean
# resp.campaign_response.message_configuration.baidu_message.time_to_live #=> Integer
# resp.campaign_response.message_configuration.baidu_message.title #=> String
# resp.campaign_response.message_configuration.baidu_message.url #=> String
# resp.campaign_response.message_configuration.default_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.message_configuration.default_message.body #=> String
# resp.campaign_response.message_configuration.default_message.image_icon_url #=> String
# resp.campaign_response.message_configuration.default_message.image_small_icon_url #=> String
# resp.campaign_response.message_configuration.default_message.image_url #=> String
# resp.campaign_response.message_configuration.default_message.json_body #=> String
# resp.campaign_response.message_configuration.default_message.media_url #=> String
# resp.campaign_response.message_configuration.default_message.raw_content #=> String
# resp.campaign_response.message_configuration.default_message.silent_push #=> Boolean
# resp.campaign_response.message_configuration.default_message.time_to_live #=> Integer
# resp.campaign_response.message_configuration.default_message.title #=> String
# resp.campaign_response.message_configuration.default_message.url #=> String
# resp.campaign_response.message_configuration.email_message.body #=> String
# resp.campaign_response.message_configuration.email_message.from_address #=> String
# resp.campaign_response.message_configuration.email_message.html_body #=> String
# resp.campaign_response.message_configuration.email_message.title #=> String
# resp.campaign_response.message_configuration.gcm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.message_configuration.gcm_message.body #=> String
# resp.campaign_response.message_configuration.gcm_message.image_icon_url #=> String
# resp.campaign_response.message_configuration.gcm_message.image_small_icon_url #=> String
# resp.campaign_response.message_configuration.gcm_message.image_url #=> String
# resp.campaign_response.message_configuration.gcm_message.json_body #=> String
# resp.campaign_response.message_configuration.gcm_message.media_url #=> String
# resp.campaign_response.message_configuration.gcm_message.raw_content #=> String
# resp.campaign_response.message_configuration.gcm_message.silent_push #=> Boolean
# resp.campaign_response.message_configuration.gcm_message.time_to_live #=> Integer
# resp.campaign_response.message_configuration.gcm_message.title #=> String
# resp.campaign_response.message_configuration.gcm_message.url #=> String
# resp.campaign_response.message_configuration.sms_message.body #=> String
# resp.campaign_response.message_configuration.sms_message.message_type #=> String, one of "TRANSACTIONAL", "PROMOTIONAL"
# resp.campaign_response.message_configuration.sms_message.sender_id #=> String
# resp.campaign_response.name #=> String
# resp.campaign_response.schedule.end_time #=> String
# resp.campaign_response.schedule.event_filter.dimensions.attributes #=> Hash
# resp.campaign_response.schedule.event_filter.dimensions.attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaign_response.schedule.event_filter.dimensions.attributes["__string"].values #=> Array
# resp.campaign_response.schedule.event_filter.dimensions.attributes["__string"].values[0] #=> String
# resp.campaign_response.schedule.event_filter.dimensions.event_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaign_response.schedule.event_filter.dimensions.event_type.values #=> Array
# resp.campaign_response.schedule.event_filter.dimensions.event_type.values[0] #=> String
# resp.campaign_response.schedule.event_filter.dimensions.metrics #=> Hash
# resp.campaign_response.schedule.event_filter.dimensions.metrics["__string"].comparison_operator #=> String
# resp.campaign_response.schedule.event_filter.dimensions.metrics["__string"].value #=> Float
# resp.campaign_response.schedule.event_filter.filter_type #=> String, one of "SYSTEM", "ENDPOINT"
# resp.campaign_response.schedule.frequency #=> String, one of "ONCE", "HOURLY", "DAILY", "WEEKLY", "MONTHLY", "EVENT"
# resp.campaign_response.schedule.is_local_time #=> Boolean
# resp.campaign_response.schedule.quiet_time.end #=> String
# resp.campaign_response.schedule.quiet_time.start #=> String
# resp.campaign_response.schedule.start_time #=> String
# resp.campaign_response.schedule.timezone #=> String
# resp.campaign_response.segment_id #=> String
# resp.campaign_response.segment_version #=> Integer
# resp.campaign_response.state.campaign_status #=> String, one of "SCHEDULED", "EXECUTING", "PENDING_NEXT_RUN", "COMPLETED", "PAUSED", "DELETED"
# resp.campaign_response.treatment_description #=> String
# resp.campaign_response.treatment_name #=> String
# resp.campaign_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetCampaignVersion AWS API Documentation
#
# @overload get_campaign_version(params = {})
# @param [Hash] params ({})
def get_campaign_version(params = {}, options = {})
req = build_request(:get_campaign_version, params)
req.send_request(options)
end
# Returns information about your campaign versions.
#
# @option params [required, String] :application_id
#
# @option params [required, String] :campaign_id
#
# @option params [String] :page_size
#
# @option params [String] :token
#
# @return [Types::GetCampaignVersionsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetCampaignVersionsResponse#campaigns_response #campaigns_response} => Types::CampaignsResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_campaign_versions({
# application_id: "__string", # required
# campaign_id: "__string", # required
# page_size: "__string",
# token: "__string",
# })
#
# @example Response structure
#
# resp.campaigns_response.item #=> Array
# resp.campaigns_response.item[0].additional_treatments #=> Array
# resp.campaigns_response.item[0].additional_treatments[0].id #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.adm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.adm_message.body #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.adm_message.image_icon_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.adm_message.image_small_icon_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.adm_message.image_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.adm_message.json_body #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.adm_message.media_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.adm_message.raw_content #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.adm_message.silent_push #=> Boolean
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.adm_message.time_to_live #=> Integer
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.adm_message.title #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.adm_message.url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.apns_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.apns_message.body #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.apns_message.image_icon_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.apns_message.image_small_icon_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.apns_message.image_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.apns_message.json_body #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.apns_message.media_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.apns_message.raw_content #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.apns_message.silent_push #=> Boolean
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.apns_message.time_to_live #=> Integer
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.apns_message.title #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.apns_message.url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.baidu_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.baidu_message.body #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.baidu_message.image_icon_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.baidu_message.image_small_icon_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.baidu_message.image_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.baidu_message.json_body #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.baidu_message.media_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.baidu_message.raw_content #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.baidu_message.silent_push #=> Boolean
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.baidu_message.time_to_live #=> Integer
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.baidu_message.title #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.baidu_message.url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.default_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.default_message.body #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.default_message.image_icon_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.default_message.image_small_icon_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.default_message.image_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.default_message.json_body #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.default_message.media_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.default_message.raw_content #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.default_message.silent_push #=> Boolean
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.default_message.time_to_live #=> Integer
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.default_message.title #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.default_message.url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.email_message.body #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.email_message.from_address #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.email_message.html_body #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.email_message.title #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.gcm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.gcm_message.body #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.gcm_message.image_icon_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.gcm_message.image_small_icon_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.gcm_message.image_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.gcm_message.json_body #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.gcm_message.media_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.gcm_message.raw_content #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.gcm_message.silent_push #=> Boolean
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.gcm_message.time_to_live #=> Integer
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.gcm_message.title #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.gcm_message.url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.sms_message.body #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.sms_message.message_type #=> String, one of "TRANSACTIONAL", "PROMOTIONAL"
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.sms_message.sender_id #=> String
# resp.campaigns_response.item[0].additional_treatments[0].schedule.end_time #=> String
# resp.campaigns_response.item[0].additional_treatments[0].schedule.event_filter.dimensions.attributes #=> Hash
# resp.campaigns_response.item[0].additional_treatments[0].schedule.event_filter.dimensions.attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaigns_response.item[0].additional_treatments[0].schedule.event_filter.dimensions.attributes["__string"].values #=> Array
# resp.campaigns_response.item[0].additional_treatments[0].schedule.event_filter.dimensions.attributes["__string"].values[0] #=> String
# resp.campaigns_response.item[0].additional_treatments[0].schedule.event_filter.dimensions.event_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaigns_response.item[0].additional_treatments[0].schedule.event_filter.dimensions.event_type.values #=> Array
# resp.campaigns_response.item[0].additional_treatments[0].schedule.event_filter.dimensions.event_type.values[0] #=> String
# resp.campaigns_response.item[0].additional_treatments[0].schedule.event_filter.dimensions.metrics #=> Hash
# resp.campaigns_response.item[0].additional_treatments[0].schedule.event_filter.dimensions.metrics["__string"].comparison_operator #=> String
# resp.campaigns_response.item[0].additional_treatments[0].schedule.event_filter.dimensions.metrics["__string"].value #=> Float
# resp.campaigns_response.item[0].additional_treatments[0].schedule.event_filter.filter_type #=> String, one of "SYSTEM", "ENDPOINT"
# resp.campaigns_response.item[0].additional_treatments[0].schedule.frequency #=> String, one of "ONCE", "HOURLY", "DAILY", "WEEKLY", "MONTHLY", "EVENT"
# resp.campaigns_response.item[0].additional_treatments[0].schedule.is_local_time #=> Boolean
# resp.campaigns_response.item[0].additional_treatments[0].schedule.quiet_time.end #=> String
# resp.campaigns_response.item[0].additional_treatments[0].schedule.quiet_time.start #=> String
# resp.campaigns_response.item[0].additional_treatments[0].schedule.start_time #=> String
# resp.campaigns_response.item[0].additional_treatments[0].schedule.timezone #=> String
# resp.campaigns_response.item[0].additional_treatments[0].size_percent #=> Integer
# resp.campaigns_response.item[0].additional_treatments[0].state.campaign_status #=> String, one of "SCHEDULED", "EXECUTING", "PENDING_NEXT_RUN", "COMPLETED", "PAUSED", "DELETED"
# resp.campaigns_response.item[0].additional_treatments[0].treatment_description #=> String
# resp.campaigns_response.item[0].additional_treatments[0].treatment_name #=> String
# resp.campaigns_response.item[0].application_id #=> String
# resp.campaigns_response.item[0].creation_date #=> String
# resp.campaigns_response.item[0].default_state.campaign_status #=> String, one of "SCHEDULED", "EXECUTING", "PENDING_NEXT_RUN", "COMPLETED", "PAUSED", "DELETED"
# resp.campaigns_response.item[0].description #=> String
# resp.campaigns_response.item[0].holdout_percent #=> Integer
# resp.campaigns_response.item[0].hook.lambda_function_name #=> String
# resp.campaigns_response.item[0].hook.mode #=> String, one of "DELIVERY", "FILTER"
# resp.campaigns_response.item[0].hook.web_url #=> String
# resp.campaigns_response.item[0].id #=> String
# resp.campaigns_response.item[0].is_paused #=> Boolean
# resp.campaigns_response.item[0].last_modified_date #=> String
# resp.campaigns_response.item[0].limits.daily #=> Integer
# resp.campaigns_response.item[0].limits.maximum_duration #=> Integer
# resp.campaigns_response.item[0].limits.messages_per_second #=> Integer
# resp.campaigns_response.item[0].limits.total #=> Integer
# resp.campaigns_response.item[0].message_configuration.adm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaigns_response.item[0].message_configuration.adm_message.body #=> String
# resp.campaigns_response.item[0].message_configuration.adm_message.image_icon_url #=> String
# resp.campaigns_response.item[0].message_configuration.adm_message.image_small_icon_url #=> String
# resp.campaigns_response.item[0].message_configuration.adm_message.image_url #=> String
# resp.campaigns_response.item[0].message_configuration.adm_message.json_body #=> String
# resp.campaigns_response.item[0].message_configuration.adm_message.media_url #=> String
# resp.campaigns_response.item[0].message_configuration.adm_message.raw_content #=> String
# resp.campaigns_response.item[0].message_configuration.adm_message.silent_push #=> Boolean
# resp.campaigns_response.item[0].message_configuration.adm_message.time_to_live #=> Integer
# resp.campaigns_response.item[0].message_configuration.adm_message.title #=> String
# resp.campaigns_response.item[0].message_configuration.adm_message.url #=> String
# resp.campaigns_response.item[0].message_configuration.apns_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaigns_response.item[0].message_configuration.apns_message.body #=> String
# resp.campaigns_response.item[0].message_configuration.apns_message.image_icon_url #=> String
# resp.campaigns_response.item[0].message_configuration.apns_message.image_small_icon_url #=> String
# resp.campaigns_response.item[0].message_configuration.apns_message.image_url #=> String
# resp.campaigns_response.item[0].message_configuration.apns_message.json_body #=> String
# resp.campaigns_response.item[0].message_configuration.apns_message.media_url #=> String
# resp.campaigns_response.item[0].message_configuration.apns_message.raw_content #=> String
# resp.campaigns_response.item[0].message_configuration.apns_message.silent_push #=> Boolean
# resp.campaigns_response.item[0].message_configuration.apns_message.time_to_live #=> Integer
# resp.campaigns_response.item[0].message_configuration.apns_message.title #=> String
# resp.campaigns_response.item[0].message_configuration.apns_message.url #=> String
# resp.campaigns_response.item[0].message_configuration.baidu_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaigns_response.item[0].message_configuration.baidu_message.body #=> String
# resp.campaigns_response.item[0].message_configuration.baidu_message.image_icon_url #=> String
# resp.campaigns_response.item[0].message_configuration.baidu_message.image_small_icon_url #=> String
# resp.campaigns_response.item[0].message_configuration.baidu_message.image_url #=> String
# resp.campaigns_response.item[0].message_configuration.baidu_message.json_body #=> String
# resp.campaigns_response.item[0].message_configuration.baidu_message.media_url #=> String
# resp.campaigns_response.item[0].message_configuration.baidu_message.raw_content #=> String
# resp.campaigns_response.item[0].message_configuration.baidu_message.silent_push #=> Boolean
# resp.campaigns_response.item[0].message_configuration.baidu_message.time_to_live #=> Integer
# resp.campaigns_response.item[0].message_configuration.baidu_message.title #=> String
# resp.campaigns_response.item[0].message_configuration.baidu_message.url #=> String
# resp.campaigns_response.item[0].message_configuration.default_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaigns_response.item[0].message_configuration.default_message.body #=> String
# resp.campaigns_response.item[0].message_configuration.default_message.image_icon_url #=> String
# resp.campaigns_response.item[0].message_configuration.default_message.image_small_icon_url #=> String
# resp.campaigns_response.item[0].message_configuration.default_message.image_url #=> String
# resp.campaigns_response.item[0].message_configuration.default_message.json_body #=> String
# resp.campaigns_response.item[0].message_configuration.default_message.media_url #=> String
# resp.campaigns_response.item[0].message_configuration.default_message.raw_content #=> String
# resp.campaigns_response.item[0].message_configuration.default_message.silent_push #=> Boolean
# resp.campaigns_response.item[0].message_configuration.default_message.time_to_live #=> Integer
# resp.campaigns_response.item[0].message_configuration.default_message.title #=> String
# resp.campaigns_response.item[0].message_configuration.default_message.url #=> String
# resp.campaigns_response.item[0].message_configuration.email_message.body #=> String
# resp.campaigns_response.item[0].message_configuration.email_message.from_address #=> String
# resp.campaigns_response.item[0].message_configuration.email_message.html_body #=> String
# resp.campaigns_response.item[0].message_configuration.email_message.title #=> String
# resp.campaigns_response.item[0].message_configuration.gcm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaigns_response.item[0].message_configuration.gcm_message.body #=> String
# resp.campaigns_response.item[0].message_configuration.gcm_message.image_icon_url #=> String
# resp.campaigns_response.item[0].message_configuration.gcm_message.image_small_icon_url #=> String
# resp.campaigns_response.item[0].message_configuration.gcm_message.image_url #=> String
# resp.campaigns_response.item[0].message_configuration.gcm_message.json_body #=> String
# resp.campaigns_response.item[0].message_configuration.gcm_message.media_url #=> String
# resp.campaigns_response.item[0].message_configuration.gcm_message.raw_content #=> String
# resp.campaigns_response.item[0].message_configuration.gcm_message.silent_push #=> Boolean
# resp.campaigns_response.item[0].message_configuration.gcm_message.time_to_live #=> Integer
# resp.campaigns_response.item[0].message_configuration.gcm_message.title #=> String
# resp.campaigns_response.item[0].message_configuration.gcm_message.url #=> String
# resp.campaigns_response.item[0].message_configuration.sms_message.body #=> String
# resp.campaigns_response.item[0].message_configuration.sms_message.message_type #=> String, one of "TRANSACTIONAL", "PROMOTIONAL"
# resp.campaigns_response.item[0].message_configuration.sms_message.sender_id #=> String
# resp.campaigns_response.item[0].name #=> String
# resp.campaigns_response.item[0].schedule.end_time #=> String
# resp.campaigns_response.item[0].schedule.event_filter.dimensions.attributes #=> Hash
# resp.campaigns_response.item[0].schedule.event_filter.dimensions.attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaigns_response.item[0].schedule.event_filter.dimensions.attributes["__string"].values #=> Array
# resp.campaigns_response.item[0].schedule.event_filter.dimensions.attributes["__string"].values[0] #=> String
# resp.campaigns_response.item[0].schedule.event_filter.dimensions.event_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaigns_response.item[0].schedule.event_filter.dimensions.event_type.values #=> Array
# resp.campaigns_response.item[0].schedule.event_filter.dimensions.event_type.values[0] #=> String
# resp.campaigns_response.item[0].schedule.event_filter.dimensions.metrics #=> Hash
# resp.campaigns_response.item[0].schedule.event_filter.dimensions.metrics["__string"].comparison_operator #=> String
# resp.campaigns_response.item[0].schedule.event_filter.dimensions.metrics["__string"].value #=> Float
# resp.campaigns_response.item[0].schedule.event_filter.filter_type #=> String, one of "SYSTEM", "ENDPOINT"
# resp.campaigns_response.item[0].schedule.frequency #=> String, one of "ONCE", "HOURLY", "DAILY", "WEEKLY", "MONTHLY", "EVENT"
# resp.campaigns_response.item[0].schedule.is_local_time #=> Boolean
# resp.campaigns_response.item[0].schedule.quiet_time.end #=> String
# resp.campaigns_response.item[0].schedule.quiet_time.start #=> String
# resp.campaigns_response.item[0].schedule.start_time #=> String
# resp.campaigns_response.item[0].schedule.timezone #=> String
# resp.campaigns_response.item[0].segment_id #=> String
# resp.campaigns_response.item[0].segment_version #=> Integer
# resp.campaigns_response.item[0].state.campaign_status #=> String, one of "SCHEDULED", "EXECUTING", "PENDING_NEXT_RUN", "COMPLETED", "PAUSED", "DELETED"
# resp.campaigns_response.item[0].treatment_description #=> String
# resp.campaigns_response.item[0].treatment_name #=> String
# resp.campaigns_response.item[0].version #=> Integer
# resp.campaigns_response.next_token #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetCampaignVersions AWS API Documentation
#
# @overload get_campaign_versions(params = {})
# @param [Hash] params ({})
def get_campaign_versions(params = {}, options = {})
req = build_request(:get_campaign_versions, params)
req.send_request(options)
end
# Returns information about your campaigns.
#
# @option params [required, String] :application_id
#
# @option params [String] :page_size
#
# @option params [String] :token
#
# @return [Types::GetCampaignsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetCampaignsResponse#campaigns_response #campaigns_response} => Types::CampaignsResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_campaigns({
# application_id: "__string", # required
# page_size: "__string",
# token: "__string",
# })
#
# @example Response structure
#
# resp.campaigns_response.item #=> Array
# resp.campaigns_response.item[0].additional_treatments #=> Array
# resp.campaigns_response.item[0].additional_treatments[0].id #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.adm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.adm_message.body #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.adm_message.image_icon_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.adm_message.image_small_icon_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.adm_message.image_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.adm_message.json_body #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.adm_message.media_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.adm_message.raw_content #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.adm_message.silent_push #=> Boolean
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.adm_message.time_to_live #=> Integer
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.adm_message.title #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.adm_message.url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.apns_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.apns_message.body #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.apns_message.image_icon_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.apns_message.image_small_icon_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.apns_message.image_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.apns_message.json_body #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.apns_message.media_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.apns_message.raw_content #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.apns_message.silent_push #=> Boolean
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.apns_message.time_to_live #=> Integer
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.apns_message.title #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.apns_message.url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.baidu_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.baidu_message.body #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.baidu_message.image_icon_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.baidu_message.image_small_icon_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.baidu_message.image_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.baidu_message.json_body #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.baidu_message.media_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.baidu_message.raw_content #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.baidu_message.silent_push #=> Boolean
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.baidu_message.time_to_live #=> Integer
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.baidu_message.title #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.baidu_message.url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.default_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.default_message.body #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.default_message.image_icon_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.default_message.image_small_icon_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.default_message.image_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.default_message.json_body #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.default_message.media_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.default_message.raw_content #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.default_message.silent_push #=> Boolean
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.default_message.time_to_live #=> Integer
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.default_message.title #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.default_message.url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.email_message.body #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.email_message.from_address #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.email_message.html_body #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.email_message.title #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.gcm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.gcm_message.body #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.gcm_message.image_icon_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.gcm_message.image_small_icon_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.gcm_message.image_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.gcm_message.json_body #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.gcm_message.media_url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.gcm_message.raw_content #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.gcm_message.silent_push #=> Boolean
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.gcm_message.time_to_live #=> Integer
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.gcm_message.title #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.gcm_message.url #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.sms_message.body #=> String
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.sms_message.message_type #=> String, one of "TRANSACTIONAL", "PROMOTIONAL"
# resp.campaigns_response.item[0].additional_treatments[0].message_configuration.sms_message.sender_id #=> String
# resp.campaigns_response.item[0].additional_treatments[0].schedule.end_time #=> String
# resp.campaigns_response.item[0].additional_treatments[0].schedule.event_filter.dimensions.attributes #=> Hash
# resp.campaigns_response.item[0].additional_treatments[0].schedule.event_filter.dimensions.attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaigns_response.item[0].additional_treatments[0].schedule.event_filter.dimensions.attributes["__string"].values #=> Array
# resp.campaigns_response.item[0].additional_treatments[0].schedule.event_filter.dimensions.attributes["__string"].values[0] #=> String
# resp.campaigns_response.item[0].additional_treatments[0].schedule.event_filter.dimensions.event_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaigns_response.item[0].additional_treatments[0].schedule.event_filter.dimensions.event_type.values #=> Array
# resp.campaigns_response.item[0].additional_treatments[0].schedule.event_filter.dimensions.event_type.values[0] #=> String
# resp.campaigns_response.item[0].additional_treatments[0].schedule.event_filter.dimensions.metrics #=> Hash
# resp.campaigns_response.item[0].additional_treatments[0].schedule.event_filter.dimensions.metrics["__string"].comparison_operator #=> String
# resp.campaigns_response.item[0].additional_treatments[0].schedule.event_filter.dimensions.metrics["__string"].value #=> Float
# resp.campaigns_response.item[0].additional_treatments[0].schedule.event_filter.filter_type #=> String, one of "SYSTEM", "ENDPOINT"
# resp.campaigns_response.item[0].additional_treatments[0].schedule.frequency #=> String, one of "ONCE", "HOURLY", "DAILY", "WEEKLY", "MONTHLY", "EVENT"
# resp.campaigns_response.item[0].additional_treatments[0].schedule.is_local_time #=> Boolean
# resp.campaigns_response.item[0].additional_treatments[0].schedule.quiet_time.end #=> String
# resp.campaigns_response.item[0].additional_treatments[0].schedule.quiet_time.start #=> String
# resp.campaigns_response.item[0].additional_treatments[0].schedule.start_time #=> String
# resp.campaigns_response.item[0].additional_treatments[0].schedule.timezone #=> String
# resp.campaigns_response.item[0].additional_treatments[0].size_percent #=> Integer
# resp.campaigns_response.item[0].additional_treatments[0].state.campaign_status #=> String, one of "SCHEDULED", "EXECUTING", "PENDING_NEXT_RUN", "COMPLETED", "PAUSED", "DELETED"
# resp.campaigns_response.item[0].additional_treatments[0].treatment_description #=> String
# resp.campaigns_response.item[0].additional_treatments[0].treatment_name #=> String
# resp.campaigns_response.item[0].application_id #=> String
# resp.campaigns_response.item[0].creation_date #=> String
# resp.campaigns_response.item[0].default_state.campaign_status #=> String, one of "SCHEDULED", "EXECUTING", "PENDING_NEXT_RUN", "COMPLETED", "PAUSED", "DELETED"
# resp.campaigns_response.item[0].description #=> String
# resp.campaigns_response.item[0].holdout_percent #=> Integer
# resp.campaigns_response.item[0].hook.lambda_function_name #=> String
# resp.campaigns_response.item[0].hook.mode #=> String, one of "DELIVERY", "FILTER"
# resp.campaigns_response.item[0].hook.web_url #=> String
# resp.campaigns_response.item[0].id #=> String
# resp.campaigns_response.item[0].is_paused #=> Boolean
# resp.campaigns_response.item[0].last_modified_date #=> String
# resp.campaigns_response.item[0].limits.daily #=> Integer
# resp.campaigns_response.item[0].limits.maximum_duration #=> Integer
# resp.campaigns_response.item[0].limits.messages_per_second #=> Integer
# resp.campaigns_response.item[0].limits.total #=> Integer
# resp.campaigns_response.item[0].message_configuration.adm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaigns_response.item[0].message_configuration.adm_message.body #=> String
# resp.campaigns_response.item[0].message_configuration.adm_message.image_icon_url #=> String
# resp.campaigns_response.item[0].message_configuration.adm_message.image_small_icon_url #=> String
# resp.campaigns_response.item[0].message_configuration.adm_message.image_url #=> String
# resp.campaigns_response.item[0].message_configuration.adm_message.json_body #=> String
# resp.campaigns_response.item[0].message_configuration.adm_message.media_url #=> String
# resp.campaigns_response.item[0].message_configuration.adm_message.raw_content #=> String
# resp.campaigns_response.item[0].message_configuration.adm_message.silent_push #=> Boolean
# resp.campaigns_response.item[0].message_configuration.adm_message.time_to_live #=> Integer
# resp.campaigns_response.item[0].message_configuration.adm_message.title #=> String
# resp.campaigns_response.item[0].message_configuration.adm_message.url #=> String
# resp.campaigns_response.item[0].message_configuration.apns_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaigns_response.item[0].message_configuration.apns_message.body #=> String
# resp.campaigns_response.item[0].message_configuration.apns_message.image_icon_url #=> String
# resp.campaigns_response.item[0].message_configuration.apns_message.image_small_icon_url #=> String
# resp.campaigns_response.item[0].message_configuration.apns_message.image_url #=> String
# resp.campaigns_response.item[0].message_configuration.apns_message.json_body #=> String
# resp.campaigns_response.item[0].message_configuration.apns_message.media_url #=> String
# resp.campaigns_response.item[0].message_configuration.apns_message.raw_content #=> String
# resp.campaigns_response.item[0].message_configuration.apns_message.silent_push #=> Boolean
# resp.campaigns_response.item[0].message_configuration.apns_message.time_to_live #=> Integer
# resp.campaigns_response.item[0].message_configuration.apns_message.title #=> String
# resp.campaigns_response.item[0].message_configuration.apns_message.url #=> String
# resp.campaigns_response.item[0].message_configuration.baidu_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaigns_response.item[0].message_configuration.baidu_message.body #=> String
# resp.campaigns_response.item[0].message_configuration.baidu_message.image_icon_url #=> String
# resp.campaigns_response.item[0].message_configuration.baidu_message.image_small_icon_url #=> String
# resp.campaigns_response.item[0].message_configuration.baidu_message.image_url #=> String
# resp.campaigns_response.item[0].message_configuration.baidu_message.json_body #=> String
# resp.campaigns_response.item[0].message_configuration.baidu_message.media_url #=> String
# resp.campaigns_response.item[0].message_configuration.baidu_message.raw_content #=> String
# resp.campaigns_response.item[0].message_configuration.baidu_message.silent_push #=> Boolean
# resp.campaigns_response.item[0].message_configuration.baidu_message.time_to_live #=> Integer
# resp.campaigns_response.item[0].message_configuration.baidu_message.title #=> String
# resp.campaigns_response.item[0].message_configuration.baidu_message.url #=> String
# resp.campaigns_response.item[0].message_configuration.default_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaigns_response.item[0].message_configuration.default_message.body #=> String
# resp.campaigns_response.item[0].message_configuration.default_message.image_icon_url #=> String
# resp.campaigns_response.item[0].message_configuration.default_message.image_small_icon_url #=> String
# resp.campaigns_response.item[0].message_configuration.default_message.image_url #=> String
# resp.campaigns_response.item[0].message_configuration.default_message.json_body #=> String
# resp.campaigns_response.item[0].message_configuration.default_message.media_url #=> String
# resp.campaigns_response.item[0].message_configuration.default_message.raw_content #=> String
# resp.campaigns_response.item[0].message_configuration.default_message.silent_push #=> Boolean
# resp.campaigns_response.item[0].message_configuration.default_message.time_to_live #=> Integer
# resp.campaigns_response.item[0].message_configuration.default_message.title #=> String
# resp.campaigns_response.item[0].message_configuration.default_message.url #=> String
# resp.campaigns_response.item[0].message_configuration.email_message.body #=> String
# resp.campaigns_response.item[0].message_configuration.email_message.from_address #=> String
# resp.campaigns_response.item[0].message_configuration.email_message.html_body #=> String
# resp.campaigns_response.item[0].message_configuration.email_message.title #=> String
# resp.campaigns_response.item[0].message_configuration.gcm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaigns_response.item[0].message_configuration.gcm_message.body #=> String
# resp.campaigns_response.item[0].message_configuration.gcm_message.image_icon_url #=> String
# resp.campaigns_response.item[0].message_configuration.gcm_message.image_small_icon_url #=> String
# resp.campaigns_response.item[0].message_configuration.gcm_message.image_url #=> String
# resp.campaigns_response.item[0].message_configuration.gcm_message.json_body #=> String
# resp.campaigns_response.item[0].message_configuration.gcm_message.media_url #=> String
# resp.campaigns_response.item[0].message_configuration.gcm_message.raw_content #=> String
# resp.campaigns_response.item[0].message_configuration.gcm_message.silent_push #=> Boolean
# resp.campaigns_response.item[0].message_configuration.gcm_message.time_to_live #=> Integer
# resp.campaigns_response.item[0].message_configuration.gcm_message.title #=> String
# resp.campaigns_response.item[0].message_configuration.gcm_message.url #=> String
# resp.campaigns_response.item[0].message_configuration.sms_message.body #=> String
# resp.campaigns_response.item[0].message_configuration.sms_message.message_type #=> String, one of "TRANSACTIONAL", "PROMOTIONAL"
# resp.campaigns_response.item[0].message_configuration.sms_message.sender_id #=> String
# resp.campaigns_response.item[0].name #=> String
# resp.campaigns_response.item[0].schedule.end_time #=> String
# resp.campaigns_response.item[0].schedule.event_filter.dimensions.attributes #=> Hash
# resp.campaigns_response.item[0].schedule.event_filter.dimensions.attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaigns_response.item[0].schedule.event_filter.dimensions.attributes["__string"].values #=> Array
# resp.campaigns_response.item[0].schedule.event_filter.dimensions.attributes["__string"].values[0] #=> String
# resp.campaigns_response.item[0].schedule.event_filter.dimensions.event_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaigns_response.item[0].schedule.event_filter.dimensions.event_type.values #=> Array
# resp.campaigns_response.item[0].schedule.event_filter.dimensions.event_type.values[0] #=> String
# resp.campaigns_response.item[0].schedule.event_filter.dimensions.metrics #=> Hash
# resp.campaigns_response.item[0].schedule.event_filter.dimensions.metrics["__string"].comparison_operator #=> String
# resp.campaigns_response.item[0].schedule.event_filter.dimensions.metrics["__string"].value #=> Float
# resp.campaigns_response.item[0].schedule.event_filter.filter_type #=> String, one of "SYSTEM", "ENDPOINT"
# resp.campaigns_response.item[0].schedule.frequency #=> String, one of "ONCE", "HOURLY", "DAILY", "WEEKLY", "MONTHLY", "EVENT"
# resp.campaigns_response.item[0].schedule.is_local_time #=> Boolean
# resp.campaigns_response.item[0].schedule.quiet_time.end #=> String
# resp.campaigns_response.item[0].schedule.quiet_time.start #=> String
# resp.campaigns_response.item[0].schedule.start_time #=> String
# resp.campaigns_response.item[0].schedule.timezone #=> String
# resp.campaigns_response.item[0].segment_id #=> String
# resp.campaigns_response.item[0].segment_version #=> Integer
# resp.campaigns_response.item[0].state.campaign_status #=> String, one of "SCHEDULED", "EXECUTING", "PENDING_NEXT_RUN", "COMPLETED", "PAUSED", "DELETED"
# resp.campaigns_response.item[0].treatment_description #=> String
# resp.campaigns_response.item[0].treatment_name #=> String
# resp.campaigns_response.item[0].version #=> Integer
# resp.campaigns_response.next_token #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetCampaigns AWS API Documentation
#
# @overload get_campaigns(params = {})
# @param [Hash] params ({})
def get_campaigns(params = {}, options = {})
req = build_request(:get_campaigns, params)
req.send_request(options)
end
# Get all channels.
#
# @option params [required, String] :application_id
#
# @return [Types::GetChannelsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetChannelsResponse#channels_response #channels_response} => Types::ChannelsResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_channels({
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.channels_response.channels #=> Hash
# resp.channels_response.channels["__string"].application_id #=> String
# resp.channels_response.channels["__string"].creation_date #=> String
# resp.channels_response.channels["__string"].enabled #=> Boolean
# resp.channels_response.channels["__string"].has_credential #=> Boolean
# resp.channels_response.channels["__string"].id #=> String
# resp.channels_response.channels["__string"].is_archived #=> Boolean
# resp.channels_response.channels["__string"].last_modified_by #=> String
# resp.channels_response.channels["__string"].last_modified_date #=> String
# resp.channels_response.channels["__string"].version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetChannels AWS API Documentation
#
# @overload get_channels(params = {})
# @param [Hash] params ({})
def get_channels(params = {}, options = {})
req = build_request(:get_channels, params)
req.send_request(options)
end
# Get an email channel.
#
# @option params [required, String] :application_id
#
# @return [Types::GetEmailChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetEmailChannelResponse#email_channel_response #email_channel_response} => Types::EmailChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_email_channel({
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.email_channel_response.application_id #=> String
# resp.email_channel_response.configuration_set #=> String
# resp.email_channel_response.creation_date #=> String
# resp.email_channel_response.enabled #=> Boolean
# resp.email_channel_response.from_address #=> String
# resp.email_channel_response.has_credential #=> Boolean
# resp.email_channel_response.id #=> String
# resp.email_channel_response.identity #=> String
# resp.email_channel_response.is_archived #=> Boolean
# resp.email_channel_response.last_modified_by #=> String
# resp.email_channel_response.last_modified_date #=> String
# resp.email_channel_response.messages_per_second #=> Integer
# resp.email_channel_response.platform #=> String
# resp.email_channel_response.role_arn #=> String
# resp.email_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetEmailChannel AWS API Documentation
#
# @overload get_email_channel(params = {})
# @param [Hash] params ({})
def get_email_channel(params = {}, options = {})
req = build_request(:get_email_channel, params)
req.send_request(options)
end
# Returns information about an endpoint.
#
# @option params [required, String] :application_id
#
# @option params [required, String] :endpoint_id
#
# @return [Types::GetEndpointResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetEndpointResponse#endpoint_response #endpoint_response} => Types::EndpointResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_endpoint({
# application_id: "__string", # required
# endpoint_id: "__string", # required
# })
#
# @example Response structure
#
# resp.endpoint_response.address #=> String
# resp.endpoint_response.application_id #=> String
# resp.endpoint_response.attributes #=> Hash
# resp.endpoint_response.attributes["__string"] #=> Array
# resp.endpoint_response.attributes["__string"][0] #=> String
# resp.endpoint_response.channel_type #=> String, one of "GCM", "APNS", "APNS_SANDBOX", "APNS_VOIP", "APNS_VOIP_SANDBOX", "ADM", "SMS", "VOICE", "EMAIL", "BAIDU", "CUSTOM"
# resp.endpoint_response.cohort_id #=> String
# resp.endpoint_response.creation_date #=> String
# resp.endpoint_response.demographic.app_version #=> String
# resp.endpoint_response.demographic.locale #=> String
# resp.endpoint_response.demographic.make #=> String
# resp.endpoint_response.demographic.model #=> String
# resp.endpoint_response.demographic.model_version #=> String
# resp.endpoint_response.demographic.platform #=> String
# resp.endpoint_response.demographic.platform_version #=> String
# resp.endpoint_response.demographic.timezone #=> String
# resp.endpoint_response.effective_date #=> String
# resp.endpoint_response.endpoint_status #=> String
# resp.endpoint_response.id #=> String
# resp.endpoint_response.location.city #=> String
# resp.endpoint_response.location.country #=> String
# resp.endpoint_response.location.latitude #=> Float
# resp.endpoint_response.location.longitude #=> Float
# resp.endpoint_response.location.postal_code #=> String
# resp.endpoint_response.location.region #=> String
# resp.endpoint_response.metrics #=> Hash
# resp.endpoint_response.metrics["__string"] #=> Float
# resp.endpoint_response.opt_out #=> String
# resp.endpoint_response.request_id #=> String
# resp.endpoint_response.user.user_attributes #=> Hash
# resp.endpoint_response.user.user_attributes["__string"] #=> Array
# resp.endpoint_response.user.user_attributes["__string"][0] #=> String
# resp.endpoint_response.user.user_id #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetEndpoint AWS API Documentation
#
# @overload get_endpoint(params = {})
# @param [Hash] params ({})
def get_endpoint(params = {}, options = {})
req = build_request(:get_endpoint, params)
req.send_request(options)
end
# Returns the event stream for an app.
#
# @option params [required, String] :application_id
#
# @return [Types::GetEventStreamResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetEventStreamResponse#event_stream #event_stream} => Types::EventStream
#
# @example Request syntax with placeholder values
#
# resp = client.get_event_stream({
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.event_stream.application_id #=> String
# resp.event_stream.destination_stream_arn #=> String
# resp.event_stream.external_id #=> String
# resp.event_stream.last_modified_date #=> String
# resp.event_stream.last_updated_by #=> String
# resp.event_stream.role_arn #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetEventStream AWS API Documentation
#
# @overload get_event_stream(params = {})
# @param [Hash] params ({})
def get_event_stream(params = {}, options = {})
req = build_request(:get_event_stream, params)
req.send_request(options)
end
# Returns information about an export job.
#
# @option params [required, String] :application_id
#
# @option params [required, String] :job_id
#
# @return [Types::GetExportJobResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetExportJobResponse#export_job_response #export_job_response} => Types::ExportJobResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_export_job({
# application_id: "__string", # required
# job_id: "__string", # required
# })
#
# @example Response structure
#
# resp.export_job_response.application_id #=> String
# resp.export_job_response.completed_pieces #=> Integer
# resp.export_job_response.completion_date #=> String
# resp.export_job_response.creation_date #=> String
# resp.export_job_response.definition.role_arn #=> String
# resp.export_job_response.definition.s3_url_prefix #=> String
# resp.export_job_response.definition.segment_id #=> String
# resp.export_job_response.definition.segment_version #=> Integer
# resp.export_job_response.failed_pieces #=> Integer
# resp.export_job_response.failures #=> Array
# resp.export_job_response.failures[0] #=> String
# resp.export_job_response.id #=> String
# resp.export_job_response.job_status #=> String, one of "CREATED", "INITIALIZING", "PROCESSING", "COMPLETING", "COMPLETED", "FAILING", "FAILED"
# resp.export_job_response.total_failures #=> Integer
# resp.export_job_response.total_pieces #=> Integer
# resp.export_job_response.total_processed #=> Integer
# resp.export_job_response.type #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetExportJob AWS API Documentation
#
# @overload get_export_job(params = {})
# @param [Hash] params ({})
def get_export_job(params = {}, options = {})
req = build_request(:get_export_job, params)
req.send_request(options)
end
# Returns information about your export jobs.
#
# @option params [required, String] :application_id
#
# @option params [String] :page_size
#
# @option params [String] :token
#
# @return [Types::GetExportJobsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetExportJobsResponse#export_jobs_response #export_jobs_response} => Types::ExportJobsResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_export_jobs({
# application_id: "__string", # required
# page_size: "__string",
# token: "__string",
# })
#
# @example Response structure
#
# resp.export_jobs_response.item #=> Array
# resp.export_jobs_response.item[0].application_id #=> String
# resp.export_jobs_response.item[0].completed_pieces #=> Integer
# resp.export_jobs_response.item[0].completion_date #=> String
# resp.export_jobs_response.item[0].creation_date #=> String
# resp.export_jobs_response.item[0].definition.role_arn #=> String
# resp.export_jobs_response.item[0].definition.s3_url_prefix #=> String
# resp.export_jobs_response.item[0].definition.segment_id #=> String
# resp.export_jobs_response.item[0].definition.segment_version #=> Integer
# resp.export_jobs_response.item[0].failed_pieces #=> Integer
# resp.export_jobs_response.item[0].failures #=> Array
# resp.export_jobs_response.item[0].failures[0] #=> String
# resp.export_jobs_response.item[0].id #=> String
# resp.export_jobs_response.item[0].job_status #=> String, one of "CREATED", "INITIALIZING", "PROCESSING", "COMPLETING", "COMPLETED", "FAILING", "FAILED"
# resp.export_jobs_response.item[0].total_failures #=> Integer
# resp.export_jobs_response.item[0].total_pieces #=> Integer
# resp.export_jobs_response.item[0].total_processed #=> Integer
# resp.export_jobs_response.item[0].type #=> String
# resp.export_jobs_response.next_token #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetExportJobs AWS API Documentation
#
# @overload get_export_jobs(params = {})
# @param [Hash] params ({})
def get_export_jobs(params = {}, options = {})
req = build_request(:get_export_jobs, params)
req.send_request(options)
end
# Returns information about the GCM channel for an app.
#
# @option params [required, String] :application_id
#
# @return [Types::GetGcmChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetGcmChannelResponse#gcm_channel_response #gcm_channel_response} => Types::GCMChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_gcm_channel({
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.gcm_channel_response.application_id #=> String
# resp.gcm_channel_response.creation_date #=> String
# resp.gcm_channel_response.credential #=> String
# resp.gcm_channel_response.enabled #=> Boolean
# resp.gcm_channel_response.has_credential #=> Boolean
# resp.gcm_channel_response.id #=> String
# resp.gcm_channel_response.is_archived #=> Boolean
# resp.gcm_channel_response.last_modified_by #=> String
# resp.gcm_channel_response.last_modified_date #=> String
# resp.gcm_channel_response.platform #=> String
# resp.gcm_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetGcmChannel AWS API Documentation
#
# @overload get_gcm_channel(params = {})
# @param [Hash] params ({})
def get_gcm_channel(params = {}, options = {})
req = build_request(:get_gcm_channel, params)
req.send_request(options)
end
# Returns information about an import job.
#
# @option params [required, String] :application_id
#
# @option params [required, String] :job_id
#
# @return [Types::GetImportJobResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetImportJobResponse#import_job_response #import_job_response} => Types::ImportJobResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_import_job({
# application_id: "__string", # required
# job_id: "__string", # required
# })
#
# @example Response structure
#
# resp.import_job_response.application_id #=> String
# resp.import_job_response.completed_pieces #=> Integer
# resp.import_job_response.completion_date #=> String
# resp.import_job_response.creation_date #=> String
# resp.import_job_response.definition.define_segment #=> Boolean
# resp.import_job_response.definition.external_id #=> String
# resp.import_job_response.definition.format #=> String, one of "CSV", "JSON"
# resp.import_job_response.definition.register_endpoints #=> Boolean
# resp.import_job_response.definition.role_arn #=> String
# resp.import_job_response.definition.s3_url #=> String
# resp.import_job_response.definition.segment_id #=> String
# resp.import_job_response.definition.segment_name #=> String
# resp.import_job_response.failed_pieces #=> Integer
# resp.import_job_response.failures #=> Array
# resp.import_job_response.failures[0] #=> String
# resp.import_job_response.id #=> String
# resp.import_job_response.job_status #=> String, one of "CREATED", "INITIALIZING", "PROCESSING", "COMPLETING", "COMPLETED", "FAILING", "FAILED"
# resp.import_job_response.total_failures #=> Integer
# resp.import_job_response.total_pieces #=> Integer
# resp.import_job_response.total_processed #=> Integer
# resp.import_job_response.type #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetImportJob AWS API Documentation
#
# @overload get_import_job(params = {})
# @param [Hash] params ({})
def get_import_job(params = {}, options = {})
req = build_request(:get_import_job, params)
req.send_request(options)
end
# Returns information about your import jobs.
#
# @option params [required, String] :application_id
#
# @option params [String] :page_size
#
# @option params [String] :token
#
# @return [Types::GetImportJobsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetImportJobsResponse#import_jobs_response #import_jobs_response} => Types::ImportJobsResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_import_jobs({
# application_id: "__string", # required
# page_size: "__string",
# token: "__string",
# })
#
# @example Response structure
#
# resp.import_jobs_response.item #=> Array
# resp.import_jobs_response.item[0].application_id #=> String
# resp.import_jobs_response.item[0].completed_pieces #=> Integer
# resp.import_jobs_response.item[0].completion_date #=> String
# resp.import_jobs_response.item[0].creation_date #=> String
# resp.import_jobs_response.item[0].definition.define_segment #=> Boolean
# resp.import_jobs_response.item[0].definition.external_id #=> String
# resp.import_jobs_response.item[0].definition.format #=> String, one of "CSV", "JSON"
# resp.import_jobs_response.item[0].definition.register_endpoints #=> Boolean
# resp.import_jobs_response.item[0].definition.role_arn #=> String
# resp.import_jobs_response.item[0].definition.s3_url #=> String
# resp.import_jobs_response.item[0].definition.segment_id #=> String
# resp.import_jobs_response.item[0].definition.segment_name #=> String
# resp.import_jobs_response.item[0].failed_pieces #=> Integer
# resp.import_jobs_response.item[0].failures #=> Array
# resp.import_jobs_response.item[0].failures[0] #=> String
# resp.import_jobs_response.item[0].id #=> String
# resp.import_jobs_response.item[0].job_status #=> String, one of "CREATED", "INITIALIZING", "PROCESSING", "COMPLETING", "COMPLETED", "FAILING", "FAILED"
# resp.import_jobs_response.item[0].total_failures #=> Integer
# resp.import_jobs_response.item[0].total_pieces #=> Integer
# resp.import_jobs_response.item[0].total_processed #=> Integer
# resp.import_jobs_response.item[0].type #=> String
# resp.import_jobs_response.next_token #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetImportJobs AWS API Documentation
#
# @overload get_import_jobs(params = {})
# @param [Hash] params ({})
def get_import_jobs(params = {}, options = {})
req = build_request(:get_import_jobs, params)
req.send_request(options)
end
# Returns information about a segment.
#
# @option params [required, String] :application_id
#
# @option params [required, String] :segment_id
#
# @return [Types::GetSegmentResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetSegmentResponse#segment_response #segment_response} => Types::SegmentResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_segment({
# application_id: "__string", # required
# segment_id: "__string", # required
# })
#
# @example Response structure
#
# resp.segment_response.application_id #=> String
# resp.segment_response.creation_date #=> String
# resp.segment_response.dimensions.attributes #=> Hash
# resp.segment_response.dimensions.attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.attributes["__string"].values #=> Array
# resp.segment_response.dimensions.attributes["__string"].values[0] #=> String
# resp.segment_response.dimensions.behavior.recency.duration #=> String, one of "HR_24", "DAY_7", "DAY_14", "DAY_30"
# resp.segment_response.dimensions.behavior.recency.recency_type #=> String, one of "ACTIVE", "INACTIVE"
# resp.segment_response.dimensions.demographic.app_version.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.app_version.values #=> Array
# resp.segment_response.dimensions.demographic.app_version.values[0] #=> String
# resp.segment_response.dimensions.demographic.channel.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.channel.values #=> Array
# resp.segment_response.dimensions.demographic.channel.values[0] #=> String
# resp.segment_response.dimensions.demographic.device_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.device_type.values #=> Array
# resp.segment_response.dimensions.demographic.device_type.values[0] #=> String
# resp.segment_response.dimensions.demographic.make.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.make.values #=> Array
# resp.segment_response.dimensions.demographic.make.values[0] #=> String
# resp.segment_response.dimensions.demographic.model.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.model.values #=> Array
# resp.segment_response.dimensions.demographic.model.values[0] #=> String
# resp.segment_response.dimensions.demographic.platform.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.platform.values #=> Array
# resp.segment_response.dimensions.demographic.platform.values[0] #=> String
# resp.segment_response.dimensions.location.country.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.location.country.values #=> Array
# resp.segment_response.dimensions.location.country.values[0] #=> String
# resp.segment_response.dimensions.location.gps_point.coordinates.latitude #=> Float
# resp.segment_response.dimensions.location.gps_point.coordinates.longitude #=> Float
# resp.segment_response.dimensions.location.gps_point.range_in_kilometers #=> Float
# resp.segment_response.dimensions.metrics #=> Hash
# resp.segment_response.dimensions.metrics["__string"].comparison_operator #=> String
# resp.segment_response.dimensions.metrics["__string"].value #=> Float
# resp.segment_response.dimensions.user_attributes #=> Hash
# resp.segment_response.dimensions.user_attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.user_attributes["__string"].values #=> Array
# resp.segment_response.dimensions.user_attributes["__string"].values[0] #=> String
# resp.segment_response.id #=> String
# resp.segment_response.import_definition.channel_counts #=> Hash
# resp.segment_response.import_definition.channel_counts["__string"] #=> Integer
# resp.segment_response.import_definition.external_id #=> String
# resp.segment_response.import_definition.format #=> String, one of "CSV", "JSON"
# resp.segment_response.import_definition.role_arn #=> String
# resp.segment_response.import_definition.s3_url #=> String
# resp.segment_response.import_definition.size #=> Integer
# resp.segment_response.last_modified_date #=> String
# resp.segment_response.name #=> String
# resp.segment_response.segment_groups.groups #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].attributes #=> Hash
# resp.segment_response.segment_groups.groups[0].dimensions[0].attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].attributes["__string"].values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].attributes["__string"].values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].behavior.recency.duration #=> String, one of "HR_24", "DAY_7", "DAY_14", "DAY_30"
# resp.segment_response.segment_groups.groups[0].dimensions[0].behavior.recency.recency_type #=> String, one of "ACTIVE", "INACTIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.app_version.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.app_version.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.app_version.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.channel.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.channel.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.channel.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.device_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.device_type.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.device_type.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.make.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.make.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.make.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.model.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.model.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.model.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.platform.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.platform.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.platform.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.country.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.country.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.country.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.gps_point.coordinates.latitude #=> Float
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.gps_point.coordinates.longitude #=> Float
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.gps_point.range_in_kilometers #=> Float
# resp.segment_response.segment_groups.groups[0].dimensions[0].metrics #=> Hash
# resp.segment_response.segment_groups.groups[0].dimensions[0].metrics["__string"].comparison_operator #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].metrics["__string"].value #=> Float
# resp.segment_response.segment_groups.groups[0].dimensions[0].user_attributes #=> Hash
# resp.segment_response.segment_groups.groups[0].dimensions[0].user_attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].user_attributes["__string"].values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].user_attributes["__string"].values[0] #=> String
# resp.segment_response.segment_groups.groups[0].source_segments #=> Array
# resp.segment_response.segment_groups.groups[0].source_segments[0].id #=> String
# resp.segment_response.segment_groups.groups[0].source_segments[0].version #=> Integer
# resp.segment_response.segment_groups.groups[0].source_type #=> String, one of "ALL", "ANY", "NONE"
# resp.segment_response.segment_groups.groups[0].type #=> String, one of "ALL", "ANY", "NONE"
# resp.segment_response.segment_groups.include #=> String, one of "ALL", "ANY", "NONE"
# resp.segment_response.segment_type #=> String, one of "DIMENSIONAL", "IMPORT"
# resp.segment_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetSegment AWS API Documentation
#
# @overload get_segment(params = {})
# @param [Hash] params ({})
def get_segment(params = {}, options = {})
req = build_request(:get_segment, params)
req.send_request(options)
end
# Returns a list of export jobs for a specific segment.
#
# @option params [required, String] :application_id
#
# @option params [String] :page_size
#
# @option params [required, String] :segment_id
#
# @option params [String] :token
#
# @return [Types::GetSegmentExportJobsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetSegmentExportJobsResponse#export_jobs_response #export_jobs_response} => Types::ExportJobsResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_segment_export_jobs({
# application_id: "__string", # required
# page_size: "__string",
# segment_id: "__string", # required
# token: "__string",
# })
#
# @example Response structure
#
# resp.export_jobs_response.item #=> Array
# resp.export_jobs_response.item[0].application_id #=> String
# resp.export_jobs_response.item[0].completed_pieces #=> Integer
# resp.export_jobs_response.item[0].completion_date #=> String
# resp.export_jobs_response.item[0].creation_date #=> String
# resp.export_jobs_response.item[0].definition.role_arn #=> String
# resp.export_jobs_response.item[0].definition.s3_url_prefix #=> String
# resp.export_jobs_response.item[0].definition.segment_id #=> String
# resp.export_jobs_response.item[0].definition.segment_version #=> Integer
# resp.export_jobs_response.item[0].failed_pieces #=> Integer
# resp.export_jobs_response.item[0].failures #=> Array
# resp.export_jobs_response.item[0].failures[0] #=> String
# resp.export_jobs_response.item[0].id #=> String
# resp.export_jobs_response.item[0].job_status #=> String, one of "CREATED", "INITIALIZING", "PROCESSING", "COMPLETING", "COMPLETED", "FAILING", "FAILED"
# resp.export_jobs_response.item[0].total_failures #=> Integer
# resp.export_jobs_response.item[0].total_pieces #=> Integer
# resp.export_jobs_response.item[0].total_processed #=> Integer
# resp.export_jobs_response.item[0].type #=> String
# resp.export_jobs_response.next_token #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetSegmentExportJobs AWS API Documentation
#
# @overload get_segment_export_jobs(params = {})
# @param [Hash] params ({})
def get_segment_export_jobs(params = {}, options = {})
req = build_request(:get_segment_export_jobs, params)
req.send_request(options)
end
# Returns a list of import jobs for a specific segment.
#
# @option params [required, String] :application_id
#
# @option params [String] :page_size
#
# @option params [required, String] :segment_id
#
# @option params [String] :token
#
# @return [Types::GetSegmentImportJobsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetSegmentImportJobsResponse#import_jobs_response #import_jobs_response} => Types::ImportJobsResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_segment_import_jobs({
# application_id: "__string", # required
# page_size: "__string",
# segment_id: "__string", # required
# token: "__string",
# })
#
# @example Response structure
#
# resp.import_jobs_response.item #=> Array
# resp.import_jobs_response.item[0].application_id #=> String
# resp.import_jobs_response.item[0].completed_pieces #=> Integer
# resp.import_jobs_response.item[0].completion_date #=> String
# resp.import_jobs_response.item[0].creation_date #=> String
# resp.import_jobs_response.item[0].definition.define_segment #=> Boolean
# resp.import_jobs_response.item[0].definition.external_id #=> String
# resp.import_jobs_response.item[0].definition.format #=> String, one of "CSV", "JSON"
# resp.import_jobs_response.item[0].definition.register_endpoints #=> Boolean
# resp.import_jobs_response.item[0].definition.role_arn #=> String
# resp.import_jobs_response.item[0].definition.s3_url #=> String
# resp.import_jobs_response.item[0].definition.segment_id #=> String
# resp.import_jobs_response.item[0].definition.segment_name #=> String
# resp.import_jobs_response.item[0].failed_pieces #=> Integer
# resp.import_jobs_response.item[0].failures #=> Array
# resp.import_jobs_response.item[0].failures[0] #=> String
# resp.import_jobs_response.item[0].id #=> String
# resp.import_jobs_response.item[0].job_status #=> String, one of "CREATED", "INITIALIZING", "PROCESSING", "COMPLETING", "COMPLETED", "FAILING", "FAILED"
# resp.import_jobs_response.item[0].total_failures #=> Integer
# resp.import_jobs_response.item[0].total_pieces #=> Integer
# resp.import_jobs_response.item[0].total_processed #=> Integer
# resp.import_jobs_response.item[0].type #=> String
# resp.import_jobs_response.next_token #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetSegmentImportJobs AWS API Documentation
#
# @overload get_segment_import_jobs(params = {})
# @param [Hash] params ({})
def get_segment_import_jobs(params = {}, options = {})
req = build_request(:get_segment_import_jobs, params)
req.send_request(options)
end
# Returns information about a segment version.
#
# @option params [required, String] :application_id
#
# @option params [required, String] :segment_id
#
# @option params [required, String] :version
#
# @return [Types::GetSegmentVersionResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetSegmentVersionResponse#segment_response #segment_response} => Types::SegmentResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_segment_version({
# application_id: "__string", # required
# segment_id: "__string", # required
# version: "__string", # required
# })
#
# @example Response structure
#
# resp.segment_response.application_id #=> String
# resp.segment_response.creation_date #=> String
# resp.segment_response.dimensions.attributes #=> Hash
# resp.segment_response.dimensions.attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.attributes["__string"].values #=> Array
# resp.segment_response.dimensions.attributes["__string"].values[0] #=> String
# resp.segment_response.dimensions.behavior.recency.duration #=> String, one of "HR_24", "DAY_7", "DAY_14", "DAY_30"
# resp.segment_response.dimensions.behavior.recency.recency_type #=> String, one of "ACTIVE", "INACTIVE"
# resp.segment_response.dimensions.demographic.app_version.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.app_version.values #=> Array
# resp.segment_response.dimensions.demographic.app_version.values[0] #=> String
# resp.segment_response.dimensions.demographic.channel.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.channel.values #=> Array
# resp.segment_response.dimensions.demographic.channel.values[0] #=> String
# resp.segment_response.dimensions.demographic.device_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.device_type.values #=> Array
# resp.segment_response.dimensions.demographic.device_type.values[0] #=> String
# resp.segment_response.dimensions.demographic.make.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.make.values #=> Array
# resp.segment_response.dimensions.demographic.make.values[0] #=> String
# resp.segment_response.dimensions.demographic.model.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.model.values #=> Array
# resp.segment_response.dimensions.demographic.model.values[0] #=> String
# resp.segment_response.dimensions.demographic.platform.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.platform.values #=> Array
# resp.segment_response.dimensions.demographic.platform.values[0] #=> String
# resp.segment_response.dimensions.location.country.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.location.country.values #=> Array
# resp.segment_response.dimensions.location.country.values[0] #=> String
# resp.segment_response.dimensions.location.gps_point.coordinates.latitude #=> Float
# resp.segment_response.dimensions.location.gps_point.coordinates.longitude #=> Float
# resp.segment_response.dimensions.location.gps_point.range_in_kilometers #=> Float
# resp.segment_response.dimensions.metrics #=> Hash
# resp.segment_response.dimensions.metrics["__string"].comparison_operator #=> String
# resp.segment_response.dimensions.metrics["__string"].value #=> Float
# resp.segment_response.dimensions.user_attributes #=> Hash
# resp.segment_response.dimensions.user_attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.user_attributes["__string"].values #=> Array
# resp.segment_response.dimensions.user_attributes["__string"].values[0] #=> String
# resp.segment_response.id #=> String
# resp.segment_response.import_definition.channel_counts #=> Hash
# resp.segment_response.import_definition.channel_counts["__string"] #=> Integer
# resp.segment_response.import_definition.external_id #=> String
# resp.segment_response.import_definition.format #=> String, one of "CSV", "JSON"
# resp.segment_response.import_definition.role_arn #=> String
# resp.segment_response.import_definition.s3_url #=> String
# resp.segment_response.import_definition.size #=> Integer
# resp.segment_response.last_modified_date #=> String
# resp.segment_response.name #=> String
# resp.segment_response.segment_groups.groups #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].attributes #=> Hash
# resp.segment_response.segment_groups.groups[0].dimensions[0].attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].attributes["__string"].values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].attributes["__string"].values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].behavior.recency.duration #=> String, one of "HR_24", "DAY_7", "DAY_14", "DAY_30"
# resp.segment_response.segment_groups.groups[0].dimensions[0].behavior.recency.recency_type #=> String, one of "ACTIVE", "INACTIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.app_version.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.app_version.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.app_version.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.channel.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.channel.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.channel.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.device_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.device_type.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.device_type.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.make.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.make.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.make.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.model.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.model.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.model.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.platform.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.platform.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.platform.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.country.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.country.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.country.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.gps_point.coordinates.latitude #=> Float
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.gps_point.coordinates.longitude #=> Float
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.gps_point.range_in_kilometers #=> Float
# resp.segment_response.segment_groups.groups[0].dimensions[0].metrics #=> Hash
# resp.segment_response.segment_groups.groups[0].dimensions[0].metrics["__string"].comparison_operator #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].metrics["__string"].value #=> Float
# resp.segment_response.segment_groups.groups[0].dimensions[0].user_attributes #=> Hash
# resp.segment_response.segment_groups.groups[0].dimensions[0].user_attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].user_attributes["__string"].values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].user_attributes["__string"].values[0] #=> String
# resp.segment_response.segment_groups.groups[0].source_segments #=> Array
# resp.segment_response.segment_groups.groups[0].source_segments[0].id #=> String
# resp.segment_response.segment_groups.groups[0].source_segments[0].version #=> Integer
# resp.segment_response.segment_groups.groups[0].source_type #=> String, one of "ALL", "ANY", "NONE"
# resp.segment_response.segment_groups.groups[0].type #=> String, one of "ALL", "ANY", "NONE"
# resp.segment_response.segment_groups.include #=> String, one of "ALL", "ANY", "NONE"
# resp.segment_response.segment_type #=> String, one of "DIMENSIONAL", "IMPORT"
# resp.segment_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetSegmentVersion AWS API Documentation
#
# @overload get_segment_version(params = {})
# @param [Hash] params ({})
def get_segment_version(params = {}, options = {})
req = build_request(:get_segment_version, params)
req.send_request(options)
end
# Returns information about your segment versions.
#
# @option params [required, String] :application_id
#
# @option params [String] :page_size
#
# @option params [required, String] :segment_id
#
# @option params [String] :token
#
# @return [Types::GetSegmentVersionsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetSegmentVersionsResponse#segments_response #segments_response} => Types::SegmentsResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_segment_versions({
# application_id: "__string", # required
# page_size: "__string",
# segment_id: "__string", # required
# token: "__string",
# })
#
# @example Response structure
#
# resp.segments_response.item #=> Array
# resp.segments_response.item[0].application_id #=> String
# resp.segments_response.item[0].creation_date #=> String
# resp.segments_response.item[0].dimensions.attributes #=> Hash
# resp.segments_response.item[0].dimensions.attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].dimensions.attributes["__string"].values #=> Array
# resp.segments_response.item[0].dimensions.attributes["__string"].values[0] #=> String
# resp.segments_response.item[0].dimensions.behavior.recency.duration #=> String, one of "HR_24", "DAY_7", "DAY_14", "DAY_30"
# resp.segments_response.item[0].dimensions.behavior.recency.recency_type #=> String, one of "ACTIVE", "INACTIVE"
# resp.segments_response.item[0].dimensions.demographic.app_version.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].dimensions.demographic.app_version.values #=> Array
# resp.segments_response.item[0].dimensions.demographic.app_version.values[0] #=> String
# resp.segments_response.item[0].dimensions.demographic.channel.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].dimensions.demographic.channel.values #=> Array
# resp.segments_response.item[0].dimensions.demographic.channel.values[0] #=> String
# resp.segments_response.item[0].dimensions.demographic.device_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].dimensions.demographic.device_type.values #=> Array
# resp.segments_response.item[0].dimensions.demographic.device_type.values[0] #=> String
# resp.segments_response.item[0].dimensions.demographic.make.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].dimensions.demographic.make.values #=> Array
# resp.segments_response.item[0].dimensions.demographic.make.values[0] #=> String
# resp.segments_response.item[0].dimensions.demographic.model.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].dimensions.demographic.model.values #=> Array
# resp.segments_response.item[0].dimensions.demographic.model.values[0] #=> String
# resp.segments_response.item[0].dimensions.demographic.platform.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].dimensions.demographic.platform.values #=> Array
# resp.segments_response.item[0].dimensions.demographic.platform.values[0] #=> String
# resp.segments_response.item[0].dimensions.location.country.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].dimensions.location.country.values #=> Array
# resp.segments_response.item[0].dimensions.location.country.values[0] #=> String
# resp.segments_response.item[0].dimensions.location.gps_point.coordinates.latitude #=> Float
# resp.segments_response.item[0].dimensions.location.gps_point.coordinates.longitude #=> Float
# resp.segments_response.item[0].dimensions.location.gps_point.range_in_kilometers #=> Float
# resp.segments_response.item[0].dimensions.metrics #=> Hash
# resp.segments_response.item[0].dimensions.metrics["__string"].comparison_operator #=> String
# resp.segments_response.item[0].dimensions.metrics["__string"].value #=> Float
# resp.segments_response.item[0].dimensions.user_attributes #=> Hash
# resp.segments_response.item[0].dimensions.user_attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].dimensions.user_attributes["__string"].values #=> Array
# resp.segments_response.item[0].dimensions.user_attributes["__string"].values[0] #=> String
# resp.segments_response.item[0].id #=> String
# resp.segments_response.item[0].import_definition.channel_counts #=> Hash
# resp.segments_response.item[0].import_definition.channel_counts["__string"] #=> Integer
# resp.segments_response.item[0].import_definition.external_id #=> String
# resp.segments_response.item[0].import_definition.format #=> String, one of "CSV", "JSON"
# resp.segments_response.item[0].import_definition.role_arn #=> String
# resp.segments_response.item[0].import_definition.s3_url #=> String
# resp.segments_response.item[0].import_definition.size #=> Integer
# resp.segments_response.item[0].last_modified_date #=> String
# resp.segments_response.item[0].name #=> String
# resp.segments_response.item[0].segment_groups.groups #=> Array
# resp.segments_response.item[0].segment_groups.groups[0].dimensions #=> Array
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].attributes #=> Hash
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].attributes["__string"].values #=> Array
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].attributes["__string"].values[0] #=> String
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].behavior.recency.duration #=> String, one of "HR_24", "DAY_7", "DAY_14", "DAY_30"
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].behavior.recency.recency_type #=> String, one of "ACTIVE", "INACTIVE"
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.app_version.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.app_version.values #=> Array
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.app_version.values[0] #=> String
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.channel.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.channel.values #=> Array
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.channel.values[0] #=> String
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.device_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.device_type.values #=> Array
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.device_type.values[0] #=> String
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.make.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.make.values #=> Array
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.make.values[0] #=> String
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.model.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.model.values #=> Array
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.model.values[0] #=> String
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.platform.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.platform.values #=> Array
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.platform.values[0] #=> String
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].location.country.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].location.country.values #=> Array
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].location.country.values[0] #=> String
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].location.gps_point.coordinates.latitude #=> Float
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].location.gps_point.coordinates.longitude #=> Float
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].location.gps_point.range_in_kilometers #=> Float
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].metrics #=> Hash
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].metrics["__string"].comparison_operator #=> String
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].metrics["__string"].value #=> Float
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].user_attributes #=> Hash
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].user_attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].user_attributes["__string"].values #=> Array
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].user_attributes["__string"].values[0] #=> String
# resp.segments_response.item[0].segment_groups.groups[0].source_segments #=> Array
# resp.segments_response.item[0].segment_groups.groups[0].source_segments[0].id #=> String
# resp.segments_response.item[0].segment_groups.groups[0].source_segments[0].version #=> Integer
# resp.segments_response.item[0].segment_groups.groups[0].source_type #=> String, one of "ALL", "ANY", "NONE"
# resp.segments_response.item[0].segment_groups.groups[0].type #=> String, one of "ALL", "ANY", "NONE"
# resp.segments_response.item[0].segment_groups.include #=> String, one of "ALL", "ANY", "NONE"
# resp.segments_response.item[0].segment_type #=> String, one of "DIMENSIONAL", "IMPORT"
# resp.segments_response.item[0].version #=> Integer
# resp.segments_response.next_token #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetSegmentVersions AWS API Documentation
#
# @overload get_segment_versions(params = {})
# @param [Hash] params ({})
def get_segment_versions(params = {}, options = {})
req = build_request(:get_segment_versions, params)
req.send_request(options)
end
# Used to get information about your segments.
#
# @option params [required, String] :application_id
#
# @option params [String] :page_size
#
# @option params [String] :token
#
# @return [Types::GetSegmentsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetSegmentsResponse#segments_response #segments_response} => Types::SegmentsResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_segments({
# application_id: "__string", # required
# page_size: "__string",
# token: "__string",
# })
#
# @example Response structure
#
# resp.segments_response.item #=> Array
# resp.segments_response.item[0].application_id #=> String
# resp.segments_response.item[0].creation_date #=> String
# resp.segments_response.item[0].dimensions.attributes #=> Hash
# resp.segments_response.item[0].dimensions.attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].dimensions.attributes["__string"].values #=> Array
# resp.segments_response.item[0].dimensions.attributes["__string"].values[0] #=> String
# resp.segments_response.item[0].dimensions.behavior.recency.duration #=> String, one of "HR_24", "DAY_7", "DAY_14", "DAY_30"
# resp.segments_response.item[0].dimensions.behavior.recency.recency_type #=> String, one of "ACTIVE", "INACTIVE"
# resp.segments_response.item[0].dimensions.demographic.app_version.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].dimensions.demographic.app_version.values #=> Array
# resp.segments_response.item[0].dimensions.demographic.app_version.values[0] #=> String
# resp.segments_response.item[0].dimensions.demographic.channel.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].dimensions.demographic.channel.values #=> Array
# resp.segments_response.item[0].dimensions.demographic.channel.values[0] #=> String
# resp.segments_response.item[0].dimensions.demographic.device_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].dimensions.demographic.device_type.values #=> Array
# resp.segments_response.item[0].dimensions.demographic.device_type.values[0] #=> String
# resp.segments_response.item[0].dimensions.demographic.make.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].dimensions.demographic.make.values #=> Array
# resp.segments_response.item[0].dimensions.demographic.make.values[0] #=> String
# resp.segments_response.item[0].dimensions.demographic.model.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].dimensions.demographic.model.values #=> Array
# resp.segments_response.item[0].dimensions.demographic.model.values[0] #=> String
# resp.segments_response.item[0].dimensions.demographic.platform.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].dimensions.demographic.platform.values #=> Array
# resp.segments_response.item[0].dimensions.demographic.platform.values[0] #=> String
# resp.segments_response.item[0].dimensions.location.country.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].dimensions.location.country.values #=> Array
# resp.segments_response.item[0].dimensions.location.country.values[0] #=> String
# resp.segments_response.item[0].dimensions.location.gps_point.coordinates.latitude #=> Float
# resp.segments_response.item[0].dimensions.location.gps_point.coordinates.longitude #=> Float
# resp.segments_response.item[0].dimensions.location.gps_point.range_in_kilometers #=> Float
# resp.segments_response.item[0].dimensions.metrics #=> Hash
# resp.segments_response.item[0].dimensions.metrics["__string"].comparison_operator #=> String
# resp.segments_response.item[0].dimensions.metrics["__string"].value #=> Float
# resp.segments_response.item[0].dimensions.user_attributes #=> Hash
# resp.segments_response.item[0].dimensions.user_attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].dimensions.user_attributes["__string"].values #=> Array
# resp.segments_response.item[0].dimensions.user_attributes["__string"].values[0] #=> String
# resp.segments_response.item[0].id #=> String
# resp.segments_response.item[0].import_definition.channel_counts #=> Hash
# resp.segments_response.item[0].import_definition.channel_counts["__string"] #=> Integer
# resp.segments_response.item[0].import_definition.external_id #=> String
# resp.segments_response.item[0].import_definition.format #=> String, one of "CSV", "JSON"
# resp.segments_response.item[0].import_definition.role_arn #=> String
# resp.segments_response.item[0].import_definition.s3_url #=> String
# resp.segments_response.item[0].import_definition.size #=> Integer
# resp.segments_response.item[0].last_modified_date #=> String
# resp.segments_response.item[0].name #=> String
# resp.segments_response.item[0].segment_groups.groups #=> Array
# resp.segments_response.item[0].segment_groups.groups[0].dimensions #=> Array
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].attributes #=> Hash
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].attributes["__string"].values #=> Array
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].attributes["__string"].values[0] #=> String
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].behavior.recency.duration #=> String, one of "HR_24", "DAY_7", "DAY_14", "DAY_30"
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].behavior.recency.recency_type #=> String, one of "ACTIVE", "INACTIVE"
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.app_version.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.app_version.values #=> Array
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.app_version.values[0] #=> String
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.channel.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.channel.values #=> Array
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.channel.values[0] #=> String
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.device_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.device_type.values #=> Array
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.device_type.values[0] #=> String
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.make.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.make.values #=> Array
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.make.values[0] #=> String
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.model.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.model.values #=> Array
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.model.values[0] #=> String
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.platform.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.platform.values #=> Array
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].demographic.platform.values[0] #=> String
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].location.country.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].location.country.values #=> Array
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].location.country.values[0] #=> String
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].location.gps_point.coordinates.latitude #=> Float
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].location.gps_point.coordinates.longitude #=> Float
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].location.gps_point.range_in_kilometers #=> Float
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].metrics #=> Hash
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].metrics["__string"].comparison_operator #=> String
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].metrics["__string"].value #=> Float
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].user_attributes #=> Hash
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].user_attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].user_attributes["__string"].values #=> Array
# resp.segments_response.item[0].segment_groups.groups[0].dimensions[0].user_attributes["__string"].values[0] #=> String
# resp.segments_response.item[0].segment_groups.groups[0].source_segments #=> Array
# resp.segments_response.item[0].segment_groups.groups[0].source_segments[0].id #=> String
# resp.segments_response.item[0].segment_groups.groups[0].source_segments[0].version #=> Integer
# resp.segments_response.item[0].segment_groups.groups[0].source_type #=> String, one of "ALL", "ANY", "NONE"
# resp.segments_response.item[0].segment_groups.groups[0].type #=> String, one of "ALL", "ANY", "NONE"
# resp.segments_response.item[0].segment_groups.include #=> String, one of "ALL", "ANY", "NONE"
# resp.segments_response.item[0].segment_type #=> String, one of "DIMENSIONAL", "IMPORT"
# resp.segments_response.item[0].version #=> Integer
# resp.segments_response.next_token #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetSegments AWS API Documentation
#
# @overload get_segments(params = {})
# @param [Hash] params ({})
def get_segments(params = {}, options = {})
req = build_request(:get_segments, params)
req.send_request(options)
end
# Get an SMS channel.
#
# @option params [required, String] :application_id
#
# @return [Types::GetSmsChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetSmsChannelResponse#sms_channel_response #sms_channel_response} => Types::SMSChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_sms_channel({
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.sms_channel_response.application_id #=> String
# resp.sms_channel_response.creation_date #=> String
# resp.sms_channel_response.enabled #=> Boolean
# resp.sms_channel_response.has_credential #=> Boolean
# resp.sms_channel_response.id #=> String
# resp.sms_channel_response.is_archived #=> Boolean
# resp.sms_channel_response.last_modified_by #=> String
# resp.sms_channel_response.last_modified_date #=> String
# resp.sms_channel_response.platform #=> String
# resp.sms_channel_response.promotional_messages_per_second #=> Integer
# resp.sms_channel_response.sender_id #=> String
# resp.sms_channel_response.short_code #=> String
# resp.sms_channel_response.transactional_messages_per_second #=> Integer
# resp.sms_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetSmsChannel AWS API Documentation
#
# @overload get_sms_channel(params = {})
# @param [Hash] params ({})
def get_sms_channel(params = {}, options = {})
req = build_request(:get_sms_channel, params)
req.send_request(options)
end
# Returns information about the endpoints that are associated with a
# User ID.
#
# @option params [required, String] :application_id
#
# @option params [required, String] :user_id
#
# @return [Types::GetUserEndpointsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetUserEndpointsResponse#endpoints_response #endpoints_response} => Types::EndpointsResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_user_endpoints({
# application_id: "__string", # required
# user_id: "__string", # required
# })
#
# @example Response structure
#
# resp.endpoints_response.item #=> Array
# resp.endpoints_response.item[0].address #=> String
# resp.endpoints_response.item[0].application_id #=> String
# resp.endpoints_response.item[0].attributes #=> Hash
# resp.endpoints_response.item[0].attributes["__string"] #=> Array
# resp.endpoints_response.item[0].attributes["__string"][0] #=> String
# resp.endpoints_response.item[0].channel_type #=> String, one of "GCM", "APNS", "APNS_SANDBOX", "APNS_VOIP", "APNS_VOIP_SANDBOX", "ADM", "SMS", "VOICE", "EMAIL", "BAIDU", "CUSTOM"
# resp.endpoints_response.item[0].cohort_id #=> String
# resp.endpoints_response.item[0].creation_date #=> String
# resp.endpoints_response.item[0].demographic.app_version #=> String
# resp.endpoints_response.item[0].demographic.locale #=> String
# resp.endpoints_response.item[0].demographic.make #=> String
# resp.endpoints_response.item[0].demographic.model #=> String
# resp.endpoints_response.item[0].demographic.model_version #=> String
# resp.endpoints_response.item[0].demographic.platform #=> String
# resp.endpoints_response.item[0].demographic.platform_version #=> String
# resp.endpoints_response.item[0].demographic.timezone #=> String
# resp.endpoints_response.item[0].effective_date #=> String
# resp.endpoints_response.item[0].endpoint_status #=> String
# resp.endpoints_response.item[0].id #=> String
# resp.endpoints_response.item[0].location.city #=> String
# resp.endpoints_response.item[0].location.country #=> String
# resp.endpoints_response.item[0].location.latitude #=> Float
# resp.endpoints_response.item[0].location.longitude #=> Float
# resp.endpoints_response.item[0].location.postal_code #=> String
# resp.endpoints_response.item[0].location.region #=> String
# resp.endpoints_response.item[0].metrics #=> Hash
# resp.endpoints_response.item[0].metrics["__string"] #=> Float
# resp.endpoints_response.item[0].opt_out #=> String
# resp.endpoints_response.item[0].request_id #=> String
# resp.endpoints_response.item[0].user.user_attributes #=> Hash
# resp.endpoints_response.item[0].user.user_attributes["__string"] #=> Array
# resp.endpoints_response.item[0].user.user_attributes["__string"][0] #=> String
# resp.endpoints_response.item[0].user.user_id #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetUserEndpoints AWS API Documentation
#
# @overload get_user_endpoints(params = {})
# @param [Hash] params ({})
def get_user_endpoints(params = {}, options = {})
req = build_request(:get_user_endpoints, params)
req.send_request(options)
end
# Get a Voice Channel
#
# @option params [required, String] :application_id
#
# @return [Types::GetVoiceChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::GetVoiceChannelResponse#voice_channel_response #voice_channel_response} => Types::VoiceChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.get_voice_channel({
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.voice_channel_response.application_id #=> String
# resp.voice_channel_response.creation_date #=> String
# resp.voice_channel_response.enabled #=> Boolean
# resp.voice_channel_response.has_credential #=> Boolean
# resp.voice_channel_response.id #=> String
# resp.voice_channel_response.is_archived #=> Boolean
# resp.voice_channel_response.last_modified_by #=> String
# resp.voice_channel_response.last_modified_date #=> String
# resp.voice_channel_response.platform #=> String
# resp.voice_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/GetVoiceChannel AWS API Documentation
#
# @overload get_voice_channel(params = {})
# @param [Hash] params ({})
def get_voice_channel(params = {}, options = {})
req = build_request(:get_voice_channel, params)
req.send_request(options)
end
# Returns information about the specified phone number.
#
# @option params [required, Types::NumberValidateRequest] :number_validate_request
# Phone Number Validate request.
#
# @return [Types::PhoneNumberValidateResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::PhoneNumberValidateResponse#number_validate_response #number_validate_response} => Types::NumberValidateResponse
#
# @example Request syntax with placeholder values
#
# resp = client.phone_number_validate({
# number_validate_request: { # required
# iso_country_code: "__string",
# phone_number: "__string",
# },
# })
#
# @example Response structure
#
# resp.number_validate_response.carrier #=> String
# resp.number_validate_response.city #=> String
# resp.number_validate_response.cleansed_phone_number_e164 #=> String
# resp.number_validate_response.cleansed_phone_number_national #=> String
# resp.number_validate_response.country #=> String
# resp.number_validate_response.country_code_iso_2 #=> String
# resp.number_validate_response.country_code_numeric #=> String
# resp.number_validate_response.county #=> String
# resp.number_validate_response.original_country_code_iso_2 #=> String
# resp.number_validate_response.original_phone_number #=> String
# resp.number_validate_response.phone_type #=> String
# resp.number_validate_response.phone_type_code #=> Integer
# resp.number_validate_response.timezone #=> String
# resp.number_validate_response.zip_code #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/PhoneNumberValidate AWS API Documentation
#
# @overload phone_number_validate(params = {})
# @param [Hash] params ({})
def phone_number_validate(params = {}, options = {})
req = build_request(:phone_number_validate, params)
req.send_request(options)
end
# Use to create or update the event stream for an app.
#
# @option params [required, String] :application_id
#
# @option params [required, Types::WriteEventStream] :write_event_stream
# Request to save an EventStream.
#
# @return [Types::PutEventStreamResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::PutEventStreamResponse#event_stream #event_stream} => Types::EventStream
#
# @example Request syntax with placeholder values
#
# resp = client.put_event_stream({
# application_id: "__string", # required
# write_event_stream: { # required
# destination_stream_arn: "__string",
# role_arn: "__string",
# },
# })
#
# @example Response structure
#
# resp.event_stream.application_id #=> String
# resp.event_stream.destination_stream_arn #=> String
# resp.event_stream.external_id #=> String
# resp.event_stream.last_modified_date #=> String
# resp.event_stream.last_updated_by #=> String
# resp.event_stream.role_arn #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/PutEventStream AWS API Documentation
#
# @overload put_event_stream(params = {})
# @param [Hash] params ({})
def put_event_stream(params = {}, options = {})
req = build_request(:put_event_stream, params)
req.send_request(options)
end
# Use to record events for endpoints. This method creates events and
# creates or updates the endpoints that those events are associated
# with.
#
# @option params [required, String] :application_id
#
# @option params [required, Types::EventsRequest] :events_request
# A set of events to process.
#
# @return [Types::PutEventsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::PutEventsResponse#events_response #events_response} => Types::EventsResponse
#
# @example Request syntax with placeholder values
#
# resp = client.put_events({
# application_id: "__string", # required
# events_request: { # required
# batch_item: {
# "__string" => {
# endpoint: {
# address: "__string",
# attributes: {
# "__string" => ["__string"],
# },
# channel_type: "GCM", # accepts GCM, APNS, APNS_SANDBOX, APNS_VOIP, APNS_VOIP_SANDBOX, ADM, SMS, VOICE, EMAIL, BAIDU, CUSTOM
# demographic: {
# app_version: "__string",
# locale: "__string",
# make: "__string",
# model: "__string",
# model_version: "__string",
# platform: "__string",
# platform_version: "__string",
# timezone: "__string",
# },
# effective_date: "__string",
# endpoint_status: "__string",
# location: {
# city: "__string",
# country: "__string",
# latitude: 1.0,
# longitude: 1.0,
# postal_code: "__string",
# region: "__string",
# },
# metrics: {
# "__string" => 1.0,
# },
# opt_out: "__string",
# request_id: "__string",
# user: {
# user_attributes: {
# "__string" => ["__string"],
# },
# user_id: "__string",
# },
# },
# events: {
# "__string" => {
# app_package_name: "__string",
# app_title: "__string",
# app_version_code: "__string",
# attributes: {
# "__string" => "__string",
# },
# client_sdk_version: "__string",
# event_type: "__string",
# metrics: {
# "__string" => 1.0,
# },
# sdk_name: "__string",
# session: {
# duration: 1,
# id: "__string",
# start_timestamp: "__string",
# stop_timestamp: "__string",
# },
# timestamp: "__string",
# },
# },
# },
# },
# },
# })
#
# @example Response structure
#
# resp.events_response.results #=> Hash
# resp.events_response.results["__string"].endpoint_item_response.message #=> String
# resp.events_response.results["__string"].endpoint_item_response.status_code #=> Integer
# resp.events_response.results["__string"].events_item_response #=> Hash
# resp.events_response.results["__string"].events_item_response["__string"].message #=> String
# resp.events_response.results["__string"].events_item_response["__string"].status_code #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/PutEvents AWS API Documentation
#
# @overload put_events(params = {})
# @param [Hash] params ({})
def put_events(params = {}, options = {})
req = build_request(:put_events, params)
req.send_request(options)
end
# Used to remove the attributes for an app
#
# @option params [required, String] :application_id
#
# @option params [required, String] :attribute_type
#
# @option params [required, Types::UpdateAttributesRequest] :update_attributes_request
# Update attributes request
#
# @return [Types::RemoveAttributesResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::RemoveAttributesResponse#attributes_resource #attributes_resource} => Types::AttributesResource
#
# @example Request syntax with placeholder values
#
# resp = client.remove_attributes({
# application_id: "__string", # required
# attribute_type: "__string", # required
# update_attributes_request: { # required
# blacklist: ["__string"],
# },
# })
#
# @example Response structure
#
# resp.attributes_resource.application_id #=> String
# resp.attributes_resource.attribute_type #=> String
# resp.attributes_resource.attributes #=> Array
# resp.attributes_resource.attributes[0] #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/RemoveAttributes AWS API Documentation
#
# @overload remove_attributes(params = {})
# @param [Hash] params ({})
def remove_attributes(params = {}, options = {})
req = build_request(:remove_attributes, params)
req.send_request(options)
end
# Used to send a direct message.
#
# @option params [required, String] :application_id
#
# @option params [required, Types::MessageRequest] :message_request
# Send message request.
#
# @return [Types::SendMessagesResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::SendMessagesResponse#message_response #message_response} => Types::MessageResponse
#
# @example Request syntax with placeholder values
#
# resp = client.send_messages({
# application_id: "__string", # required
# message_request: { # required
# addresses: {
# "__string" => {
# body_override: "__string",
# channel_type: "GCM", # accepts GCM, APNS, APNS_SANDBOX, APNS_VOIP, APNS_VOIP_SANDBOX, ADM, SMS, VOICE, EMAIL, BAIDU, CUSTOM
# context: {
# "__string" => "__string",
# },
# raw_content: "__string",
# substitutions: {
# "__string" => ["__string"],
# },
# title_override: "__string",
# },
# },
# context: {
# "__string" => "__string",
# },
# endpoints: {
# "__string" => {
# body_override: "__string",
# context: {
# "__string" => "__string",
# },
# raw_content: "__string",
# substitutions: {
# "__string" => ["__string"],
# },
# title_override: "__string",
# },
# },
# message_configuration: {
# adm_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# consolidation_key: "__string",
# data: {
# "__string" => "__string",
# },
# expires_after: "__string",
# icon_reference: "__string",
# image_icon_url: "__string",
# image_url: "__string",
# md5: "__string",
# raw_content: "__string",
# silent_push: false,
# small_image_icon_url: "__string",
# sound: "__string",
# substitutions: {
# "__string" => ["__string"],
# },
# title: "__string",
# url: "__string",
# },
# apns_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# badge: 1,
# body: "__string",
# category: "__string",
# collapse_id: "__string",
# data: {
# "__string" => "__string",
# },
# media_url: "__string",
# preferred_authentication_method: "__string",
# priority: "__string",
# raw_content: "__string",
# silent_push: false,
# sound: "__string",
# substitutions: {
# "__string" => ["__string"],
# },
# thread_id: "__string",
# time_to_live: 1,
# title: "__string",
# url: "__string",
# },
# baidu_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# data: {
# "__string" => "__string",
# },
# icon_reference: "__string",
# image_icon_url: "__string",
# image_url: "__string",
# raw_content: "__string",
# silent_push: false,
# small_image_icon_url: "__string",
# sound: "__string",
# substitutions: {
# "__string" => ["__string"],
# },
# time_to_live: 1,
# title: "__string",
# url: "__string",
# },
# default_message: {
# body: "__string",
# substitutions: {
# "__string" => ["__string"],
# },
# },
# default_push_notification_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# data: {
# "__string" => "__string",
# },
# silent_push: false,
# substitutions: {
# "__string" => ["__string"],
# },
# title: "__string",
# url: "__string",
# },
# email_message: {
# body: "__string",
# feedback_forwarding_address: "__string",
# from_address: "__string",
# raw_email: {
# data: "data",
# },
# reply_to_addresses: ["__string"],
# simple_email: {
# html_part: {
# charset: "__string",
# data: "__string",
# },
# subject: {
# charset: "__string",
# data: "__string",
# },
# text_part: {
# charset: "__string",
# data: "__string",
# },
# },
# substitutions: {
# "__string" => ["__string"],
# },
# },
# gcm_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# collapse_key: "__string",
# data: {
# "__string" => "__string",
# },
# icon_reference: "__string",
# image_icon_url: "__string",
# image_url: "__string",
# priority: "__string",
# raw_content: "__string",
# restricted_package_name: "__string",
# silent_push: false,
# small_image_icon_url: "__string",
# sound: "__string",
# substitutions: {
# "__string" => ["__string"],
# },
# time_to_live: 1,
# title: "__string",
# url: "__string",
# },
# sms_message: {
# body: "__string",
# keyword: "__string",
# message_type: "TRANSACTIONAL", # accepts TRANSACTIONAL, PROMOTIONAL
# origination_number: "__string",
# sender_id: "__string",
# substitutions: {
# "__string" => ["__string"],
# },
# },
# voice_message: {
# body: "__string",
# language_code: "__string",
# origination_number: "__string",
# substitutions: {
# "__string" => ["__string"],
# },
# voice_id: "__string",
# },
# },
# trace_id: "__string",
# },
# })
#
# @example Response structure
#
# resp.message_response.application_id #=> String
# resp.message_response.endpoint_result #=> Hash
# resp.message_response.endpoint_result["__string"].address #=> String
# resp.message_response.endpoint_result["__string"].delivery_status #=> String, one of "SUCCESSFUL", "THROTTLED", "TEMPORARY_FAILURE", "PERMANENT_FAILURE", "UNKNOWN_FAILURE", "OPT_OUT", "DUPLICATE"
# resp.message_response.endpoint_result["__string"].message_id #=> String
# resp.message_response.endpoint_result["__string"].status_code #=> Integer
# resp.message_response.endpoint_result["__string"].status_message #=> String
# resp.message_response.endpoint_result["__string"].updated_token #=> String
# resp.message_response.request_id #=> String
# resp.message_response.result #=> Hash
# resp.message_response.result["__string"].delivery_status #=> String, one of "SUCCESSFUL", "THROTTLED", "TEMPORARY_FAILURE", "PERMANENT_FAILURE", "UNKNOWN_FAILURE", "OPT_OUT", "DUPLICATE"
# resp.message_response.result["__string"].message_id #=> String
# resp.message_response.result["__string"].status_code #=> Integer
# resp.message_response.result["__string"].status_message #=> String
# resp.message_response.result["__string"].updated_token #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/SendMessages AWS API Documentation
#
# @overload send_messages(params = {})
# @param [Hash] params ({})
def send_messages(params = {}, options = {})
req = build_request(:send_messages, params)
req.send_request(options)
end
# Used to send a message to a list of users.
#
# @option params [required, String] :application_id
#
# @option params [required, Types::SendUsersMessageRequest] :send_users_message_request
# Send message request.
#
# @return [Types::SendUsersMessagesResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::SendUsersMessagesResponse#send_users_message_response #send_users_message_response} => Types::SendUsersMessageResponse
#
# @example Request syntax with placeholder values
#
# resp = client.send_users_messages({
# application_id: "__string", # required
# send_users_message_request: { # required
# context: {
# "__string" => "__string",
# },
# message_configuration: {
# adm_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# consolidation_key: "__string",
# data: {
# "__string" => "__string",
# },
# expires_after: "__string",
# icon_reference: "__string",
# image_icon_url: "__string",
# image_url: "__string",
# md5: "__string",
# raw_content: "__string",
# silent_push: false,
# small_image_icon_url: "__string",
# sound: "__string",
# substitutions: {
# "__string" => ["__string"],
# },
# title: "__string",
# url: "__string",
# },
# apns_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# badge: 1,
# body: "__string",
# category: "__string",
# collapse_id: "__string",
# data: {
# "__string" => "__string",
# },
# media_url: "__string",
# preferred_authentication_method: "__string",
# priority: "__string",
# raw_content: "__string",
# silent_push: false,
# sound: "__string",
# substitutions: {
# "__string" => ["__string"],
# },
# thread_id: "__string",
# time_to_live: 1,
# title: "__string",
# url: "__string",
# },
# baidu_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# data: {
# "__string" => "__string",
# },
# icon_reference: "__string",
# image_icon_url: "__string",
# image_url: "__string",
# raw_content: "__string",
# silent_push: false,
# small_image_icon_url: "__string",
# sound: "__string",
# substitutions: {
# "__string" => ["__string"],
# },
# time_to_live: 1,
# title: "__string",
# url: "__string",
# },
# default_message: {
# body: "__string",
# substitutions: {
# "__string" => ["__string"],
# },
# },
# default_push_notification_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# data: {
# "__string" => "__string",
# },
# silent_push: false,
# substitutions: {
# "__string" => ["__string"],
# },
# title: "__string",
# url: "__string",
# },
# email_message: {
# body: "__string",
# feedback_forwarding_address: "__string",
# from_address: "__string",
# raw_email: {
# data: "data",
# },
# reply_to_addresses: ["__string"],
# simple_email: {
# html_part: {
# charset: "__string",
# data: "__string",
# },
# subject: {
# charset: "__string",
# data: "__string",
# },
# text_part: {
# charset: "__string",
# data: "__string",
# },
# },
# substitutions: {
# "__string" => ["__string"],
# },
# },
# gcm_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# collapse_key: "__string",
# data: {
# "__string" => "__string",
# },
# icon_reference: "__string",
# image_icon_url: "__string",
# image_url: "__string",
# priority: "__string",
# raw_content: "__string",
# restricted_package_name: "__string",
# silent_push: false,
# small_image_icon_url: "__string",
# sound: "__string",
# substitutions: {
# "__string" => ["__string"],
# },
# time_to_live: 1,
# title: "__string",
# url: "__string",
# },
# sms_message: {
# body: "__string",
# keyword: "__string",
# message_type: "TRANSACTIONAL", # accepts TRANSACTIONAL, PROMOTIONAL
# origination_number: "__string",
# sender_id: "__string",
# substitutions: {
# "__string" => ["__string"],
# },
# },
# voice_message: {
# body: "__string",
# language_code: "__string",
# origination_number: "__string",
# substitutions: {
# "__string" => ["__string"],
# },
# voice_id: "__string",
# },
# },
# trace_id: "__string",
# users: {
# "__string" => {
# body_override: "__string",
# context: {
# "__string" => "__string",
# },
# raw_content: "__string",
# substitutions: {
# "__string" => ["__string"],
# },
# title_override: "__string",
# },
# },
# },
# })
#
# @example Response structure
#
# resp.send_users_message_response.application_id #=> String
# resp.send_users_message_response.request_id #=> String
# resp.send_users_message_response.result #=> Hash
# resp.send_users_message_response.result["__string"] #=> Hash
# resp.send_users_message_response.result["__string"]["__string"].address #=> String
# resp.send_users_message_response.result["__string"]["__string"].delivery_status #=> String, one of "SUCCESSFUL", "THROTTLED", "TEMPORARY_FAILURE", "PERMANENT_FAILURE", "UNKNOWN_FAILURE", "OPT_OUT", "DUPLICATE"
# resp.send_users_message_response.result["__string"]["__string"].message_id #=> String
# resp.send_users_message_response.result["__string"]["__string"].status_code #=> Integer
# resp.send_users_message_response.result["__string"]["__string"].status_message #=> String
# resp.send_users_message_response.result["__string"]["__string"].updated_token #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/SendUsersMessages AWS API Documentation
#
# @overload send_users_messages(params = {})
# @param [Hash] params ({})
def send_users_messages(params = {}, options = {})
req = build_request(:send_users_messages, params)
req.send_request(options)
end
# Update an ADM channel.
#
# @option params [required, Types::ADMChannelRequest] :adm_channel_request
# Amazon Device Messaging channel definition.
#
# @option params [required, String] :application_id
#
# @return [Types::UpdateAdmChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::UpdateAdmChannelResponse#adm_channel_response #adm_channel_response} => Types::ADMChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.update_adm_channel({
# adm_channel_request: { # required
# client_id: "__string",
# client_secret: "__string",
# enabled: false,
# },
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.adm_channel_response.application_id #=> String
# resp.adm_channel_response.creation_date #=> String
# resp.adm_channel_response.enabled #=> Boolean
# resp.adm_channel_response.has_credential #=> Boolean
# resp.adm_channel_response.id #=> String
# resp.adm_channel_response.is_archived #=> Boolean
# resp.adm_channel_response.last_modified_by #=> String
# resp.adm_channel_response.last_modified_date #=> String
# resp.adm_channel_response.platform #=> String
# resp.adm_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/UpdateAdmChannel AWS API Documentation
#
# @overload update_adm_channel(params = {})
# @param [Hash] params ({})
def update_adm_channel(params = {}, options = {})
req = build_request(:update_adm_channel, params)
req.send_request(options)
end
# Use to update the APNs channel for an app.
#
# @option params [required, Types::APNSChannelRequest] :apns_channel_request
# Apple Push Notification Service channel definition.
#
# @option params [required, String] :application_id
#
# @return [Types::UpdateApnsChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::UpdateApnsChannelResponse#apns_channel_response #apns_channel_response} => Types::APNSChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.update_apns_channel({
# apns_channel_request: { # required
# bundle_id: "__string",
# certificate: "__string",
# default_authentication_method: "__string",
# enabled: false,
# private_key: "__string",
# team_id: "__string",
# token_key: "__string",
# token_key_id: "__string",
# },
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.apns_channel_response.application_id #=> String
# resp.apns_channel_response.creation_date #=> String
# resp.apns_channel_response.default_authentication_method #=> String
# resp.apns_channel_response.enabled #=> Boolean
# resp.apns_channel_response.has_credential #=> Boolean
# resp.apns_channel_response.has_token_key #=> Boolean
# resp.apns_channel_response.id #=> String
# resp.apns_channel_response.is_archived #=> Boolean
# resp.apns_channel_response.last_modified_by #=> String
# resp.apns_channel_response.last_modified_date #=> String
# resp.apns_channel_response.platform #=> String
# resp.apns_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/UpdateApnsChannel AWS API Documentation
#
# @overload update_apns_channel(params = {})
# @param [Hash] params ({})
def update_apns_channel(params = {}, options = {})
req = build_request(:update_apns_channel, params)
req.send_request(options)
end
# Update an APNS sandbox channel.
#
# @option params [required, Types::APNSSandboxChannelRequest] :apns_sandbox_channel_request
# Apple Development Push Notification Service channel definition.
#
# @option params [required, String] :application_id
#
# @return [Types::UpdateApnsSandboxChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::UpdateApnsSandboxChannelResponse#apns_sandbox_channel_response #apns_sandbox_channel_response} => Types::APNSSandboxChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.update_apns_sandbox_channel({
# apns_sandbox_channel_request: { # required
# bundle_id: "__string",
# certificate: "__string",
# default_authentication_method: "__string",
# enabled: false,
# private_key: "__string",
# team_id: "__string",
# token_key: "__string",
# token_key_id: "__string",
# },
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.apns_sandbox_channel_response.application_id #=> String
# resp.apns_sandbox_channel_response.creation_date #=> String
# resp.apns_sandbox_channel_response.default_authentication_method #=> String
# resp.apns_sandbox_channel_response.enabled #=> Boolean
# resp.apns_sandbox_channel_response.has_credential #=> Boolean
# resp.apns_sandbox_channel_response.has_token_key #=> Boolean
# resp.apns_sandbox_channel_response.id #=> String
# resp.apns_sandbox_channel_response.is_archived #=> Boolean
# resp.apns_sandbox_channel_response.last_modified_by #=> String
# resp.apns_sandbox_channel_response.last_modified_date #=> String
# resp.apns_sandbox_channel_response.platform #=> String
# resp.apns_sandbox_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/UpdateApnsSandboxChannel AWS API Documentation
#
# @overload update_apns_sandbox_channel(params = {})
# @param [Hash] params ({})
def update_apns_sandbox_channel(params = {}, options = {})
req = build_request(:update_apns_sandbox_channel, params)
req.send_request(options)
end
# Update an APNS VoIP channel
#
# @option params [required, Types::APNSVoipChannelRequest] :apns_voip_channel_request
# Apple VoIP Push Notification Service channel definition.
#
# @option params [required, String] :application_id
#
# @return [Types::UpdateApnsVoipChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::UpdateApnsVoipChannelResponse#apns_voip_channel_response #apns_voip_channel_response} => Types::APNSVoipChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.update_apns_voip_channel({
# apns_voip_channel_request: { # required
# bundle_id: "__string",
# certificate: "__string",
# default_authentication_method: "__string",
# enabled: false,
# private_key: "__string",
# team_id: "__string",
# token_key: "__string",
# token_key_id: "__string",
# },
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.apns_voip_channel_response.application_id #=> String
# resp.apns_voip_channel_response.creation_date #=> String
# resp.apns_voip_channel_response.default_authentication_method #=> String
# resp.apns_voip_channel_response.enabled #=> Boolean
# resp.apns_voip_channel_response.has_credential #=> Boolean
# resp.apns_voip_channel_response.has_token_key #=> Boolean
# resp.apns_voip_channel_response.id #=> String
# resp.apns_voip_channel_response.is_archived #=> Boolean
# resp.apns_voip_channel_response.last_modified_by #=> String
# resp.apns_voip_channel_response.last_modified_date #=> String
# resp.apns_voip_channel_response.platform #=> String
# resp.apns_voip_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/UpdateApnsVoipChannel AWS API Documentation
#
# @overload update_apns_voip_channel(params = {})
# @param [Hash] params ({})
def update_apns_voip_channel(params = {}, options = {})
req = build_request(:update_apns_voip_channel, params)
req.send_request(options)
end
# Update an APNS VoIP sandbox channel
#
# @option params [required, Types::APNSVoipSandboxChannelRequest] :apns_voip_sandbox_channel_request
# Apple VoIP Developer Push Notification Service channel definition.
#
# @option params [required, String] :application_id
#
# @return [Types::UpdateApnsVoipSandboxChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::UpdateApnsVoipSandboxChannelResponse#apns_voip_sandbox_channel_response #apns_voip_sandbox_channel_response} => Types::APNSVoipSandboxChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.update_apns_voip_sandbox_channel({
# apns_voip_sandbox_channel_request: { # required
# bundle_id: "__string",
# certificate: "__string",
# default_authentication_method: "__string",
# enabled: false,
# private_key: "__string",
# team_id: "__string",
# token_key: "__string",
# token_key_id: "__string",
# },
# application_id: "__string", # required
# })
#
# @example Response structure
#
# resp.apns_voip_sandbox_channel_response.application_id #=> String
# resp.apns_voip_sandbox_channel_response.creation_date #=> String
# resp.apns_voip_sandbox_channel_response.default_authentication_method #=> String
# resp.apns_voip_sandbox_channel_response.enabled #=> Boolean
# resp.apns_voip_sandbox_channel_response.has_credential #=> Boolean
# resp.apns_voip_sandbox_channel_response.has_token_key #=> Boolean
# resp.apns_voip_sandbox_channel_response.id #=> String
# resp.apns_voip_sandbox_channel_response.is_archived #=> Boolean
# resp.apns_voip_sandbox_channel_response.last_modified_by #=> String
# resp.apns_voip_sandbox_channel_response.last_modified_date #=> String
# resp.apns_voip_sandbox_channel_response.platform #=> String
# resp.apns_voip_sandbox_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/UpdateApnsVoipSandboxChannel AWS API Documentation
#
# @overload update_apns_voip_sandbox_channel(params = {})
# @param [Hash] params ({})
def update_apns_voip_sandbox_channel(params = {}, options = {})
req = build_request(:update_apns_voip_sandbox_channel, params)
req.send_request(options)
end
# Used to update the settings for an app.
#
# @option params [required, String] :application_id
#
# @option params [required, Types::WriteApplicationSettingsRequest] :write_application_settings_request
# Creating application setting request
#
# @return [Types::UpdateApplicationSettingsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::UpdateApplicationSettingsResponse#application_settings_resource #application_settings_resource} => Types::ApplicationSettingsResource
#
# @example Request syntax with placeholder values
#
# resp = client.update_application_settings({
# application_id: "__string", # required
# write_application_settings_request: { # required
# campaign_hook: {
# lambda_function_name: "__string",
# mode: "DELIVERY", # accepts DELIVERY, FILTER
# web_url: "__string",
# },
# cloud_watch_metrics_enabled: false,
# limits: {
# daily: 1,
# maximum_duration: 1,
# messages_per_second: 1,
# total: 1,
# },
# quiet_time: {
# end: "__string",
# start: "__string",
# },
# },
# })
#
# @example Response structure
#
# resp.application_settings_resource.application_id #=> String
# resp.application_settings_resource.campaign_hook.lambda_function_name #=> String
# resp.application_settings_resource.campaign_hook.mode #=> String, one of "DELIVERY", "FILTER"
# resp.application_settings_resource.campaign_hook.web_url #=> String
# resp.application_settings_resource.last_modified_date #=> String
# resp.application_settings_resource.limits.daily #=> Integer
# resp.application_settings_resource.limits.maximum_duration #=> Integer
# resp.application_settings_resource.limits.messages_per_second #=> Integer
# resp.application_settings_resource.limits.total #=> Integer
# resp.application_settings_resource.quiet_time.end #=> String
# resp.application_settings_resource.quiet_time.start #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/UpdateApplicationSettings AWS API Documentation
#
# @overload update_application_settings(params = {})
# @param [Hash] params ({})
def update_application_settings(params = {}, options = {})
req = build_request(:update_application_settings, params)
req.send_request(options)
end
# Update a BAIDU GCM channel
#
# @option params [required, String] :application_id
#
# @option params [required, Types::BaiduChannelRequest] :baidu_channel_request
# Baidu Cloud Push credentials
#
# @return [Types::UpdateBaiduChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::UpdateBaiduChannelResponse#baidu_channel_response #baidu_channel_response} => Types::BaiduChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.update_baidu_channel({
# application_id: "__string", # required
# baidu_channel_request: { # required
# api_key: "__string",
# enabled: false,
# secret_key: "__string",
# },
# })
#
# @example Response structure
#
# resp.baidu_channel_response.application_id #=> String
# resp.baidu_channel_response.creation_date #=> String
# resp.baidu_channel_response.credential #=> String
# resp.baidu_channel_response.enabled #=> Boolean
# resp.baidu_channel_response.has_credential #=> Boolean
# resp.baidu_channel_response.id #=> String
# resp.baidu_channel_response.is_archived #=> Boolean
# resp.baidu_channel_response.last_modified_by #=> String
# resp.baidu_channel_response.last_modified_date #=> String
# resp.baidu_channel_response.platform #=> String
# resp.baidu_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/UpdateBaiduChannel AWS API Documentation
#
# @overload update_baidu_channel(params = {})
# @param [Hash] params ({})
def update_baidu_channel(params = {}, options = {})
req = build_request(:update_baidu_channel, params)
req.send_request(options)
end
# Use to update a campaign.
#
# @option params [required, String] :application_id
#
# @option params [required, String] :campaign_id
#
# @option params [required, Types::WriteCampaignRequest] :write_campaign_request
# Used to create a campaign.
#
# @return [Types::UpdateCampaignResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::UpdateCampaignResponse#campaign_response #campaign_response} => Types::CampaignResponse
#
# @example Request syntax with placeholder values
#
# resp = client.update_campaign({
# application_id: "__string", # required
# campaign_id: "__string", # required
# write_campaign_request: { # required
# additional_treatments: [
# {
# message_configuration: {
# adm_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# image_icon_url: "__string",
# image_small_icon_url: "__string",
# image_url: "__string",
# json_body: "__string",
# media_url: "__string",
# raw_content: "__string",
# silent_push: false,
# time_to_live: 1,
# title: "__string",
# url: "__string",
# },
# apns_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# image_icon_url: "__string",
# image_small_icon_url: "__string",
# image_url: "__string",
# json_body: "__string",
# media_url: "__string",
# raw_content: "__string",
# silent_push: false,
# time_to_live: 1,
# title: "__string",
# url: "__string",
# },
# baidu_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# image_icon_url: "__string",
# image_small_icon_url: "__string",
# image_url: "__string",
# json_body: "__string",
# media_url: "__string",
# raw_content: "__string",
# silent_push: false,
# time_to_live: 1,
# title: "__string",
# url: "__string",
# },
# default_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# image_icon_url: "__string",
# image_small_icon_url: "__string",
# image_url: "__string",
# json_body: "__string",
# media_url: "__string",
# raw_content: "__string",
# silent_push: false,
# time_to_live: 1,
# title: "__string",
# url: "__string",
# },
# email_message: {
# body: "__string",
# from_address: "__string",
# html_body: "__string",
# title: "__string",
# },
# gcm_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# image_icon_url: "__string",
# image_small_icon_url: "__string",
# image_url: "__string",
# json_body: "__string",
# media_url: "__string",
# raw_content: "__string",
# silent_push: false,
# time_to_live: 1,
# title: "__string",
# url: "__string",
# },
# sms_message: {
# body: "__string",
# message_type: "TRANSACTIONAL", # accepts TRANSACTIONAL, PROMOTIONAL
# sender_id: "__string",
# },
# },
# schedule: {
# end_time: "__string",
# event_filter: {
# dimensions: {
# attributes: {
# "__string" => {
# attribute_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# },
# event_type: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# metrics: {
# "__string" => {
# comparison_operator: "__string",
# value: 1.0,
# },
# },
# },
# filter_type: "SYSTEM", # accepts SYSTEM, ENDPOINT
# },
# frequency: "ONCE", # accepts ONCE, HOURLY, DAILY, WEEKLY, MONTHLY, EVENT
# is_local_time: false,
# quiet_time: {
# end: "__string",
# start: "__string",
# },
# start_time: "__string",
# timezone: "__string",
# },
# size_percent: 1,
# treatment_description: "__string",
# treatment_name: "__string",
# },
# ],
# description: "__string",
# holdout_percent: 1,
# hook: {
# lambda_function_name: "__string",
# mode: "DELIVERY", # accepts DELIVERY, FILTER
# web_url: "__string",
# },
# is_paused: false,
# limits: {
# daily: 1,
# maximum_duration: 1,
# messages_per_second: 1,
# total: 1,
# },
# message_configuration: {
# adm_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# image_icon_url: "__string",
# image_small_icon_url: "__string",
# image_url: "__string",
# json_body: "__string",
# media_url: "__string",
# raw_content: "__string",
# silent_push: false,
# time_to_live: 1,
# title: "__string",
# url: "__string",
# },
# apns_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# image_icon_url: "__string",
# image_small_icon_url: "__string",
# image_url: "__string",
# json_body: "__string",
# media_url: "__string",
# raw_content: "__string",
# silent_push: false,
# time_to_live: 1,
# title: "__string",
# url: "__string",
# },
# baidu_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# image_icon_url: "__string",
# image_small_icon_url: "__string",
# image_url: "__string",
# json_body: "__string",
# media_url: "__string",
# raw_content: "__string",
# silent_push: false,
# time_to_live: 1,
# title: "__string",
# url: "__string",
# },
# default_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# image_icon_url: "__string",
# image_small_icon_url: "__string",
# image_url: "__string",
# json_body: "__string",
# media_url: "__string",
# raw_content: "__string",
# silent_push: false,
# time_to_live: 1,
# title: "__string",
# url: "__string",
# },
# email_message: {
# body: "__string",
# from_address: "__string",
# html_body: "__string",
# title: "__string",
# },
# gcm_message: {
# action: "OPEN_APP", # accepts OPEN_APP, DEEP_LINK, URL
# body: "__string",
# image_icon_url: "__string",
# image_small_icon_url: "__string",
# image_url: "__string",
# json_body: "__string",
# media_url: "__string",
# raw_content: "__string",
# silent_push: false,
# time_to_live: 1,
# title: "__string",
# url: "__string",
# },
# sms_message: {
# body: "__string",
# message_type: "TRANSACTIONAL", # accepts TRANSACTIONAL, PROMOTIONAL
# sender_id: "__string",
# },
# },
# name: "__string",
# schedule: {
# end_time: "__string",
# event_filter: {
# dimensions: {
# attributes: {
# "__string" => {
# attribute_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# },
# event_type: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# metrics: {
# "__string" => {
# comparison_operator: "__string",
# value: 1.0,
# },
# },
# },
# filter_type: "SYSTEM", # accepts SYSTEM, ENDPOINT
# },
# frequency: "ONCE", # accepts ONCE, HOURLY, DAILY, WEEKLY, MONTHLY, EVENT
# is_local_time: false,
# quiet_time: {
# end: "__string",
# start: "__string",
# },
# start_time: "__string",
# timezone: "__string",
# },
# segment_id: "__string",
# segment_version: 1,
# treatment_description: "__string",
# treatment_name: "__string",
# },
# })
#
# @example Response structure
#
# resp.campaign_response.additional_treatments #=> Array
# resp.campaign_response.additional_treatments[0].id #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.image_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.image_small_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.image_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.json_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.media_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.raw_content #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.silent_push #=> Boolean
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.time_to_live #=> Integer
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.adm_message.url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.image_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.image_small_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.image_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.json_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.media_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.raw_content #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.silent_push #=> Boolean
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.time_to_live #=> Integer
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.apns_message.url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.image_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.image_small_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.image_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.json_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.media_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.raw_content #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.silent_push #=> Boolean
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.time_to_live #=> Integer
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.baidu_message.url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.image_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.image_small_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.image_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.json_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.media_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.raw_content #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.silent_push #=> Boolean
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.time_to_live #=> Integer
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.default_message.url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.email_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.email_message.from_address #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.email_message.html_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.email_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.image_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.image_small_icon_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.image_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.json_body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.media_url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.raw_content #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.silent_push #=> Boolean
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.time_to_live #=> Integer
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.title #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.gcm_message.url #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.sms_message.body #=> String
# resp.campaign_response.additional_treatments[0].message_configuration.sms_message.message_type #=> String, one of "TRANSACTIONAL", "PROMOTIONAL"
# resp.campaign_response.additional_treatments[0].message_configuration.sms_message.sender_id #=> String
# resp.campaign_response.additional_treatments[0].schedule.end_time #=> String
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.attributes #=> Hash
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.attributes["__string"].values #=> Array
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.attributes["__string"].values[0] #=> String
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.event_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.event_type.values #=> Array
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.event_type.values[0] #=> String
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.metrics #=> Hash
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.metrics["__string"].comparison_operator #=> String
# resp.campaign_response.additional_treatments[0].schedule.event_filter.dimensions.metrics["__string"].value #=> Float
# resp.campaign_response.additional_treatments[0].schedule.event_filter.filter_type #=> String, one of "SYSTEM", "ENDPOINT"
# resp.campaign_response.additional_treatments[0].schedule.frequency #=> String, one of "ONCE", "HOURLY", "DAILY", "WEEKLY", "MONTHLY", "EVENT"
# resp.campaign_response.additional_treatments[0].schedule.is_local_time #=> Boolean
# resp.campaign_response.additional_treatments[0].schedule.quiet_time.end #=> String
# resp.campaign_response.additional_treatments[0].schedule.quiet_time.start #=> String
# resp.campaign_response.additional_treatments[0].schedule.start_time #=> String
# resp.campaign_response.additional_treatments[0].schedule.timezone #=> String
# resp.campaign_response.additional_treatments[0].size_percent #=> Integer
# resp.campaign_response.additional_treatments[0].state.campaign_status #=> String, one of "SCHEDULED", "EXECUTING", "PENDING_NEXT_RUN", "COMPLETED", "PAUSED", "DELETED"
# resp.campaign_response.additional_treatments[0].treatment_description #=> String
# resp.campaign_response.additional_treatments[0].treatment_name #=> String
# resp.campaign_response.application_id #=> String
# resp.campaign_response.creation_date #=> String
# resp.campaign_response.default_state.campaign_status #=> String, one of "SCHEDULED", "EXECUTING", "PENDING_NEXT_RUN", "COMPLETED", "PAUSED", "DELETED"
# resp.campaign_response.description #=> String
# resp.campaign_response.holdout_percent #=> Integer
# resp.campaign_response.hook.lambda_function_name #=> String
# resp.campaign_response.hook.mode #=> String, one of "DELIVERY", "FILTER"
# resp.campaign_response.hook.web_url #=> String
# resp.campaign_response.id #=> String
# resp.campaign_response.is_paused #=> Boolean
# resp.campaign_response.last_modified_date #=> String
# resp.campaign_response.limits.daily #=> Integer
# resp.campaign_response.limits.maximum_duration #=> Integer
# resp.campaign_response.limits.messages_per_second #=> Integer
# resp.campaign_response.limits.total #=> Integer
# resp.campaign_response.message_configuration.adm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.message_configuration.adm_message.body #=> String
# resp.campaign_response.message_configuration.adm_message.image_icon_url #=> String
# resp.campaign_response.message_configuration.adm_message.image_small_icon_url #=> String
# resp.campaign_response.message_configuration.adm_message.image_url #=> String
# resp.campaign_response.message_configuration.adm_message.json_body #=> String
# resp.campaign_response.message_configuration.adm_message.media_url #=> String
# resp.campaign_response.message_configuration.adm_message.raw_content #=> String
# resp.campaign_response.message_configuration.adm_message.silent_push #=> Boolean
# resp.campaign_response.message_configuration.adm_message.time_to_live #=> Integer
# resp.campaign_response.message_configuration.adm_message.title #=> String
# resp.campaign_response.message_configuration.adm_message.url #=> String
# resp.campaign_response.message_configuration.apns_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.message_configuration.apns_message.body #=> String
# resp.campaign_response.message_configuration.apns_message.image_icon_url #=> String
# resp.campaign_response.message_configuration.apns_message.image_small_icon_url #=> String
# resp.campaign_response.message_configuration.apns_message.image_url #=> String
# resp.campaign_response.message_configuration.apns_message.json_body #=> String
# resp.campaign_response.message_configuration.apns_message.media_url #=> String
# resp.campaign_response.message_configuration.apns_message.raw_content #=> String
# resp.campaign_response.message_configuration.apns_message.silent_push #=> Boolean
# resp.campaign_response.message_configuration.apns_message.time_to_live #=> Integer
# resp.campaign_response.message_configuration.apns_message.title #=> String
# resp.campaign_response.message_configuration.apns_message.url #=> String
# resp.campaign_response.message_configuration.baidu_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.message_configuration.baidu_message.body #=> String
# resp.campaign_response.message_configuration.baidu_message.image_icon_url #=> String
# resp.campaign_response.message_configuration.baidu_message.image_small_icon_url #=> String
# resp.campaign_response.message_configuration.baidu_message.image_url #=> String
# resp.campaign_response.message_configuration.baidu_message.json_body #=> String
# resp.campaign_response.message_configuration.baidu_message.media_url #=> String
# resp.campaign_response.message_configuration.baidu_message.raw_content #=> String
# resp.campaign_response.message_configuration.baidu_message.silent_push #=> Boolean
# resp.campaign_response.message_configuration.baidu_message.time_to_live #=> Integer
# resp.campaign_response.message_configuration.baidu_message.title #=> String
# resp.campaign_response.message_configuration.baidu_message.url #=> String
# resp.campaign_response.message_configuration.default_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.message_configuration.default_message.body #=> String
# resp.campaign_response.message_configuration.default_message.image_icon_url #=> String
# resp.campaign_response.message_configuration.default_message.image_small_icon_url #=> String
# resp.campaign_response.message_configuration.default_message.image_url #=> String
# resp.campaign_response.message_configuration.default_message.json_body #=> String
# resp.campaign_response.message_configuration.default_message.media_url #=> String
# resp.campaign_response.message_configuration.default_message.raw_content #=> String
# resp.campaign_response.message_configuration.default_message.silent_push #=> Boolean
# resp.campaign_response.message_configuration.default_message.time_to_live #=> Integer
# resp.campaign_response.message_configuration.default_message.title #=> String
# resp.campaign_response.message_configuration.default_message.url #=> String
# resp.campaign_response.message_configuration.email_message.body #=> String
# resp.campaign_response.message_configuration.email_message.from_address #=> String
# resp.campaign_response.message_configuration.email_message.html_body #=> String
# resp.campaign_response.message_configuration.email_message.title #=> String
# resp.campaign_response.message_configuration.gcm_message.action #=> String, one of "OPEN_APP", "DEEP_LINK", "URL"
# resp.campaign_response.message_configuration.gcm_message.body #=> String
# resp.campaign_response.message_configuration.gcm_message.image_icon_url #=> String
# resp.campaign_response.message_configuration.gcm_message.image_small_icon_url #=> String
# resp.campaign_response.message_configuration.gcm_message.image_url #=> String
# resp.campaign_response.message_configuration.gcm_message.json_body #=> String
# resp.campaign_response.message_configuration.gcm_message.media_url #=> String
# resp.campaign_response.message_configuration.gcm_message.raw_content #=> String
# resp.campaign_response.message_configuration.gcm_message.silent_push #=> Boolean
# resp.campaign_response.message_configuration.gcm_message.time_to_live #=> Integer
# resp.campaign_response.message_configuration.gcm_message.title #=> String
# resp.campaign_response.message_configuration.gcm_message.url #=> String
# resp.campaign_response.message_configuration.sms_message.body #=> String
# resp.campaign_response.message_configuration.sms_message.message_type #=> String, one of "TRANSACTIONAL", "PROMOTIONAL"
# resp.campaign_response.message_configuration.sms_message.sender_id #=> String
# resp.campaign_response.name #=> String
# resp.campaign_response.schedule.end_time #=> String
# resp.campaign_response.schedule.event_filter.dimensions.attributes #=> Hash
# resp.campaign_response.schedule.event_filter.dimensions.attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaign_response.schedule.event_filter.dimensions.attributes["__string"].values #=> Array
# resp.campaign_response.schedule.event_filter.dimensions.attributes["__string"].values[0] #=> String
# resp.campaign_response.schedule.event_filter.dimensions.event_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.campaign_response.schedule.event_filter.dimensions.event_type.values #=> Array
# resp.campaign_response.schedule.event_filter.dimensions.event_type.values[0] #=> String
# resp.campaign_response.schedule.event_filter.dimensions.metrics #=> Hash
# resp.campaign_response.schedule.event_filter.dimensions.metrics["__string"].comparison_operator #=> String
# resp.campaign_response.schedule.event_filter.dimensions.metrics["__string"].value #=> Float
# resp.campaign_response.schedule.event_filter.filter_type #=> String, one of "SYSTEM", "ENDPOINT"
# resp.campaign_response.schedule.frequency #=> String, one of "ONCE", "HOURLY", "DAILY", "WEEKLY", "MONTHLY", "EVENT"
# resp.campaign_response.schedule.is_local_time #=> Boolean
# resp.campaign_response.schedule.quiet_time.end #=> String
# resp.campaign_response.schedule.quiet_time.start #=> String
# resp.campaign_response.schedule.start_time #=> String
# resp.campaign_response.schedule.timezone #=> String
# resp.campaign_response.segment_id #=> String
# resp.campaign_response.segment_version #=> Integer
# resp.campaign_response.state.campaign_status #=> String, one of "SCHEDULED", "EXECUTING", "PENDING_NEXT_RUN", "COMPLETED", "PAUSED", "DELETED"
# resp.campaign_response.treatment_description #=> String
# resp.campaign_response.treatment_name #=> String
# resp.campaign_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/UpdateCampaign AWS API Documentation
#
# @overload update_campaign(params = {})
# @param [Hash] params ({})
def update_campaign(params = {}, options = {})
req = build_request(:update_campaign, params)
req.send_request(options)
end
# Update an email channel.
#
# @option params [required, String] :application_id
#
# @option params [required, Types::EmailChannelRequest] :email_channel_request
# Email Channel Request
#
# @return [Types::UpdateEmailChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::UpdateEmailChannelResponse#email_channel_response #email_channel_response} => Types::EmailChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.update_email_channel({
# application_id: "__string", # required
# email_channel_request: { # required
# configuration_set: "__string",
# enabled: false,
# from_address: "__string",
# identity: "__string",
# role_arn: "__string",
# },
# })
#
# @example Response structure
#
# resp.email_channel_response.application_id #=> String
# resp.email_channel_response.configuration_set #=> String
# resp.email_channel_response.creation_date #=> String
# resp.email_channel_response.enabled #=> Boolean
# resp.email_channel_response.from_address #=> String
# resp.email_channel_response.has_credential #=> Boolean
# resp.email_channel_response.id #=> String
# resp.email_channel_response.identity #=> String
# resp.email_channel_response.is_archived #=> Boolean
# resp.email_channel_response.last_modified_by #=> String
# resp.email_channel_response.last_modified_date #=> String
# resp.email_channel_response.messages_per_second #=> Integer
# resp.email_channel_response.platform #=> String
# resp.email_channel_response.role_arn #=> String
# resp.email_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/UpdateEmailChannel AWS API Documentation
#
# @overload update_email_channel(params = {})
# @param [Hash] params ({})
def update_email_channel(params = {}, options = {})
req = build_request(:update_email_channel, params)
req.send_request(options)
end
# Creates or updates an endpoint.
#
# @option params [required, String] :application_id
#
# @option params [required, String] :endpoint_id
#
# @option params [required, Types::EndpointRequest] :endpoint_request
# An endpoint update request.
#
# @return [Types::UpdateEndpointResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::UpdateEndpointResponse#message_body #message_body} => Types::MessageBody
#
# @example Request syntax with placeholder values
#
# resp = client.update_endpoint({
# application_id: "__string", # required
# endpoint_id: "__string", # required
# endpoint_request: { # required
# address: "__string",
# attributes: {
# "__string" => ["__string"],
# },
# channel_type: "GCM", # accepts GCM, APNS, APNS_SANDBOX, APNS_VOIP, APNS_VOIP_SANDBOX, ADM, SMS, VOICE, EMAIL, BAIDU, CUSTOM
# demographic: {
# app_version: "__string",
# locale: "__string",
# make: "__string",
# model: "__string",
# model_version: "__string",
# platform: "__string",
# platform_version: "__string",
# timezone: "__string",
# },
# effective_date: "__string",
# endpoint_status: "__string",
# location: {
# city: "__string",
# country: "__string",
# latitude: 1.0,
# longitude: 1.0,
# postal_code: "__string",
# region: "__string",
# },
# metrics: {
# "__string" => 1.0,
# },
# opt_out: "__string",
# request_id: "__string",
# user: {
# user_attributes: {
# "__string" => ["__string"],
# },
# user_id: "__string",
# },
# },
# })
#
# @example Response structure
#
# resp.message_body.message #=> String
# resp.message_body.request_id #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/UpdateEndpoint AWS API Documentation
#
# @overload update_endpoint(params = {})
# @param [Hash] params ({})
def update_endpoint(params = {}, options = {})
req = build_request(:update_endpoint, params)
req.send_request(options)
end
# Use to update a batch of endpoints.
#
# @option params [required, String] :application_id
#
# @option params [required, Types::EndpointBatchRequest] :endpoint_batch_request
# Endpoint batch update request.
#
# @return [Types::UpdateEndpointsBatchResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::UpdateEndpointsBatchResponse#message_body #message_body} => Types::MessageBody
#
# @example Request syntax with placeholder values
#
# resp = client.update_endpoints_batch({
# application_id: "__string", # required
# endpoint_batch_request: { # required
# item: [
# {
# address: "__string",
# attributes: {
# "__string" => ["__string"],
# },
# channel_type: "GCM", # accepts GCM, APNS, APNS_SANDBOX, APNS_VOIP, APNS_VOIP_SANDBOX, ADM, SMS, VOICE, EMAIL, BAIDU, CUSTOM
# demographic: {
# app_version: "__string",
# locale: "__string",
# make: "__string",
# model: "__string",
# model_version: "__string",
# platform: "__string",
# platform_version: "__string",
# timezone: "__string",
# },
# effective_date: "__string",
# endpoint_status: "__string",
# id: "__string",
# location: {
# city: "__string",
# country: "__string",
# latitude: 1.0,
# longitude: 1.0,
# postal_code: "__string",
# region: "__string",
# },
# metrics: {
# "__string" => 1.0,
# },
# opt_out: "__string",
# request_id: "__string",
# user: {
# user_attributes: {
# "__string" => ["__string"],
# },
# user_id: "__string",
# },
# },
# ],
# },
# })
#
# @example Response structure
#
# resp.message_body.message #=> String
# resp.message_body.request_id #=> String
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/UpdateEndpointsBatch AWS API Documentation
#
# @overload update_endpoints_batch(params = {})
# @param [Hash] params ({})
def update_endpoints_batch(params = {}, options = {})
req = build_request(:update_endpoints_batch, params)
req.send_request(options)
end
# Use to update the GCM channel for an app.
#
# @option params [required, String] :application_id
#
# @option params [required, Types::GCMChannelRequest] :gcm_channel_request
# Google Cloud Messaging credentials
#
# @return [Types::UpdateGcmChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::UpdateGcmChannelResponse#gcm_channel_response #gcm_channel_response} => Types::GCMChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.update_gcm_channel({
# application_id: "__string", # required
# gcm_channel_request: { # required
# api_key: "__string",
# enabled: false,
# },
# })
#
# @example Response structure
#
# resp.gcm_channel_response.application_id #=> String
# resp.gcm_channel_response.creation_date #=> String
# resp.gcm_channel_response.credential #=> String
# resp.gcm_channel_response.enabled #=> Boolean
# resp.gcm_channel_response.has_credential #=> Boolean
# resp.gcm_channel_response.id #=> String
# resp.gcm_channel_response.is_archived #=> Boolean
# resp.gcm_channel_response.last_modified_by #=> String
# resp.gcm_channel_response.last_modified_date #=> String
# resp.gcm_channel_response.platform #=> String
# resp.gcm_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/UpdateGcmChannel AWS API Documentation
#
# @overload update_gcm_channel(params = {})
# @param [Hash] params ({})
def update_gcm_channel(params = {}, options = {})
req = build_request(:update_gcm_channel, params)
req.send_request(options)
end
# Used to update a segment.
#
# @option params [required, String] :application_id
#
# @option params [required, String] :segment_id
#
# @option params [required, Types::WriteSegmentRequest] :write_segment_request
# Segment definition.
#
# @return [Types::UpdateSegmentResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::UpdateSegmentResponse#segment_response #segment_response} => Types::SegmentResponse
#
# @example Request syntax with placeholder values
#
# resp = client.update_segment({
# application_id: "__string", # required
# segment_id: "__string", # required
# write_segment_request: { # required
# dimensions: {
# attributes: {
# "__string" => {
# attribute_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# },
# behavior: {
# recency: {
# duration: "HR_24", # accepts HR_24, DAY_7, DAY_14, DAY_30
# recency_type: "ACTIVE", # accepts ACTIVE, INACTIVE
# },
# },
# demographic: {
# app_version: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# channel: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# device_type: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# make: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# model: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# platform: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# },
# location: {
# country: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# gps_point: {
# coordinates: {
# latitude: 1.0,
# longitude: 1.0,
# },
# range_in_kilometers: 1.0,
# },
# },
# metrics: {
# "__string" => {
# comparison_operator: "__string",
# value: 1.0,
# },
# },
# user_attributes: {
# "__string" => {
# attribute_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# },
# },
# name: "__string",
# segment_groups: {
# groups: [
# {
# dimensions: [
# {
# attributes: {
# "__string" => {
# attribute_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# },
# behavior: {
# recency: {
# duration: "HR_24", # accepts HR_24, DAY_7, DAY_14, DAY_30
# recency_type: "ACTIVE", # accepts ACTIVE, INACTIVE
# },
# },
# demographic: {
# app_version: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# channel: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# device_type: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# make: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# model: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# platform: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# },
# location: {
# country: {
# dimension_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# gps_point: {
# coordinates: {
# latitude: 1.0,
# longitude: 1.0,
# },
# range_in_kilometers: 1.0,
# },
# },
# metrics: {
# "__string" => {
# comparison_operator: "__string",
# value: 1.0,
# },
# },
# user_attributes: {
# "__string" => {
# attribute_type: "INCLUSIVE", # accepts INCLUSIVE, EXCLUSIVE
# values: ["__string"],
# },
# },
# },
# ],
# source_segments: [
# {
# id: "__string",
# version: 1,
# },
# ],
# source_type: "ALL", # accepts ALL, ANY, NONE
# type: "ALL", # accepts ALL, ANY, NONE
# },
# ],
# include: "ALL", # accepts ALL, ANY, NONE
# },
# },
# })
#
# @example Response structure
#
# resp.segment_response.application_id #=> String
# resp.segment_response.creation_date #=> String
# resp.segment_response.dimensions.attributes #=> Hash
# resp.segment_response.dimensions.attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.attributes["__string"].values #=> Array
# resp.segment_response.dimensions.attributes["__string"].values[0] #=> String
# resp.segment_response.dimensions.behavior.recency.duration #=> String, one of "HR_24", "DAY_7", "DAY_14", "DAY_30"
# resp.segment_response.dimensions.behavior.recency.recency_type #=> String, one of "ACTIVE", "INACTIVE"
# resp.segment_response.dimensions.demographic.app_version.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.app_version.values #=> Array
# resp.segment_response.dimensions.demographic.app_version.values[0] #=> String
# resp.segment_response.dimensions.demographic.channel.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.channel.values #=> Array
# resp.segment_response.dimensions.demographic.channel.values[0] #=> String
# resp.segment_response.dimensions.demographic.device_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.device_type.values #=> Array
# resp.segment_response.dimensions.demographic.device_type.values[0] #=> String
# resp.segment_response.dimensions.demographic.make.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.make.values #=> Array
# resp.segment_response.dimensions.demographic.make.values[0] #=> String
# resp.segment_response.dimensions.demographic.model.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.model.values #=> Array
# resp.segment_response.dimensions.demographic.model.values[0] #=> String
# resp.segment_response.dimensions.demographic.platform.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.demographic.platform.values #=> Array
# resp.segment_response.dimensions.demographic.platform.values[0] #=> String
# resp.segment_response.dimensions.location.country.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.location.country.values #=> Array
# resp.segment_response.dimensions.location.country.values[0] #=> String
# resp.segment_response.dimensions.location.gps_point.coordinates.latitude #=> Float
# resp.segment_response.dimensions.location.gps_point.coordinates.longitude #=> Float
# resp.segment_response.dimensions.location.gps_point.range_in_kilometers #=> Float
# resp.segment_response.dimensions.metrics #=> Hash
# resp.segment_response.dimensions.metrics["__string"].comparison_operator #=> String
# resp.segment_response.dimensions.metrics["__string"].value #=> Float
# resp.segment_response.dimensions.user_attributes #=> Hash
# resp.segment_response.dimensions.user_attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.dimensions.user_attributes["__string"].values #=> Array
# resp.segment_response.dimensions.user_attributes["__string"].values[0] #=> String
# resp.segment_response.id #=> String
# resp.segment_response.import_definition.channel_counts #=> Hash
# resp.segment_response.import_definition.channel_counts["__string"] #=> Integer
# resp.segment_response.import_definition.external_id #=> String
# resp.segment_response.import_definition.format #=> String, one of "CSV", "JSON"
# resp.segment_response.import_definition.role_arn #=> String
# resp.segment_response.import_definition.s3_url #=> String
# resp.segment_response.import_definition.size #=> Integer
# resp.segment_response.last_modified_date #=> String
# resp.segment_response.name #=> String
# resp.segment_response.segment_groups.groups #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].attributes #=> Hash
# resp.segment_response.segment_groups.groups[0].dimensions[0].attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].attributes["__string"].values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].attributes["__string"].values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].behavior.recency.duration #=> String, one of "HR_24", "DAY_7", "DAY_14", "DAY_30"
# resp.segment_response.segment_groups.groups[0].dimensions[0].behavior.recency.recency_type #=> String, one of "ACTIVE", "INACTIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.app_version.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.app_version.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.app_version.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.channel.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.channel.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.channel.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.device_type.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.device_type.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.device_type.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.make.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.make.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.make.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.model.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.model.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.model.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.platform.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.platform.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].demographic.platform.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.country.dimension_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.country.values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.country.values[0] #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.gps_point.coordinates.latitude #=> Float
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.gps_point.coordinates.longitude #=> Float
# resp.segment_response.segment_groups.groups[0].dimensions[0].location.gps_point.range_in_kilometers #=> Float
# resp.segment_response.segment_groups.groups[0].dimensions[0].metrics #=> Hash
# resp.segment_response.segment_groups.groups[0].dimensions[0].metrics["__string"].comparison_operator #=> String
# resp.segment_response.segment_groups.groups[0].dimensions[0].metrics["__string"].value #=> Float
# resp.segment_response.segment_groups.groups[0].dimensions[0].user_attributes #=> Hash
# resp.segment_response.segment_groups.groups[0].dimensions[0].user_attributes["__string"].attribute_type #=> String, one of "INCLUSIVE", "EXCLUSIVE"
# resp.segment_response.segment_groups.groups[0].dimensions[0].user_attributes["__string"].values #=> Array
# resp.segment_response.segment_groups.groups[0].dimensions[0].user_attributes["__string"].values[0] #=> String
# resp.segment_response.segment_groups.groups[0].source_segments #=> Array
# resp.segment_response.segment_groups.groups[0].source_segments[0].id #=> String
# resp.segment_response.segment_groups.groups[0].source_segments[0].version #=> Integer
# resp.segment_response.segment_groups.groups[0].source_type #=> String, one of "ALL", "ANY", "NONE"
# resp.segment_response.segment_groups.groups[0].type #=> String, one of "ALL", "ANY", "NONE"
# resp.segment_response.segment_groups.include #=> String, one of "ALL", "ANY", "NONE"
# resp.segment_response.segment_type #=> String, one of "DIMENSIONAL", "IMPORT"
# resp.segment_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/UpdateSegment AWS API Documentation
#
# @overload update_segment(params = {})
# @param [Hash] params ({})
def update_segment(params = {}, options = {})
req = build_request(:update_segment, params)
req.send_request(options)
end
# Update an SMS channel.
#
# @option params [required, String] :application_id
#
# @option params [required, Types::SMSChannelRequest] :sms_channel_request
# SMS Channel Request
#
# @return [Types::UpdateSmsChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::UpdateSmsChannelResponse#sms_channel_response #sms_channel_response} => Types::SMSChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.update_sms_channel({
# application_id: "__string", # required
# sms_channel_request: { # required
# enabled: false,
# sender_id: "__string",
# short_code: "__string",
# },
# })
#
# @example Response structure
#
# resp.sms_channel_response.application_id #=> String
# resp.sms_channel_response.creation_date #=> String
# resp.sms_channel_response.enabled #=> Boolean
# resp.sms_channel_response.has_credential #=> Boolean
# resp.sms_channel_response.id #=> String
# resp.sms_channel_response.is_archived #=> Boolean
# resp.sms_channel_response.last_modified_by #=> String
# resp.sms_channel_response.last_modified_date #=> String
# resp.sms_channel_response.platform #=> String
# resp.sms_channel_response.promotional_messages_per_second #=> Integer
# resp.sms_channel_response.sender_id #=> String
# resp.sms_channel_response.short_code #=> String
# resp.sms_channel_response.transactional_messages_per_second #=> Integer
# resp.sms_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/UpdateSmsChannel AWS API Documentation
#
# @overload update_sms_channel(params = {})
# @param [Hash] params ({})
def update_sms_channel(params = {}, options = {})
req = build_request(:update_sms_channel, params)
req.send_request(options)
end
# Update an Voice channel
#
# @option params [required, String] :application_id
#
# @option params [required, Types::VoiceChannelRequest] :voice_channel_request
# Voice Channel Request
#
# @return [Types::UpdateVoiceChannelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
#
# * {Types::UpdateVoiceChannelResponse#voice_channel_response #voice_channel_response} => Types::VoiceChannelResponse
#
# @example Request syntax with placeholder values
#
# resp = client.update_voice_channel({
# application_id: "__string", # required
# voice_channel_request: { # required
# enabled: false,
# },
# })
#
# @example Response structure
#
# resp.voice_channel_response.application_id #=> String
# resp.voice_channel_response.creation_date #=> String
# resp.voice_channel_response.enabled #=> Boolean
# resp.voice_channel_response.has_credential #=> Boolean
# resp.voice_channel_response.id #=> String
# resp.voice_channel_response.is_archived #=> Boolean
# resp.voice_channel_response.last_modified_by #=> String
# resp.voice_channel_response.last_modified_date #=> String
# resp.voice_channel_response.platform #=> String
# resp.voice_channel_response.version #=> Integer
#
# @see http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/UpdateVoiceChannel AWS API Documentation
#
# @overload update_voice_channel(params = {})
# @param [Hash] params ({})
def update_voice_channel(params = {}, options = {})
req = build_request(:update_voice_channel, params)
req.send_request(options)
end
# @!endgroup
# @param params ({})
# @api private
def build_request(operation_name, params = {})
handlers = @handlers.for(operation_name)
context = Seahorse::Client::RequestContext.new(
operation_name: operation_name,
operation: config.api.operation(operation_name),
client: self,
params: params,
config: config)
context[:gem_name] = 'aws-sdk-pinpoint'
context[:gem_version] = '1.15.0'
Seahorse::Client::Request.new(handlers, context)
end
# @api private
# @deprecated
def waiter_names
[]
end
class << self
# @api private
attr_reader :identifier
# @api private
def errors_module
Errors
end
end
end
end
| 60.390233 | 217 | 0.691319 |
e94d4c8d67f209e61847c2081daa2e4b795171d9 | 1,067 | require 'rails_helper'
describe User do
describe '#generate_uid' do
it 'gets uid assigned' do
user = create(:user)
expect(user.uid).not_to be_blank
end
end
describe 'Validation' do
context 'when valid' do
it 'creates a new user' do
expect{create(:user)}.to change(User, :count).by(+1)
end
end
context 'when invalid' do
it 'has no name' do
expect(build(:user, name: nil)).to be_invalid
end
it 'has no last name' do
expect(build(:user, last_name: nil)).to be_invalid
end
it 'has no email' do
expect(build(:user, email: nil)).to be_invalid
end
it 'has no password' do
expect(build(:user, password: nil)).to be_invalid
end
it 'has name with more than 100 symbols' do
expect(build(:user, name: FFaker::Lorem.characters(110))).to be_invalid
end
it 'has last name with more than 100 symbols' do
expect(build(:user, last_name: FFaker::Lorem.characters(110))).to be_invalid
end
end
end
end
| 27.358974 | 84 | 0.617619 |
03357af7b7102ad74e57904d86c8d9a968c76f06 | 2,725 | #!/usr/bin/env ruby
# Encoding: utf-8
#
# Copyright:: Copyright 2016, Google Inc. All Rights Reserved.
#
# License:: 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.
#
# This example gets all rate cards.
require 'ad_manager_api'
def get_all_rate_cards(ad_manager)
# Get the RateCardService.
rate_card_service = ad_manager.service(:RateCardService, API_VERSION)
# Create a statement to select rate cards.
statement = ad_manager.new_statement_builder()
# Retrieve a small amount of rate cards at a time, paging
# through until all rate cards have been retrieved.
page = {:total_result_set_size => 0}
begin
page = rate_card_service.get_rate_cards_by_statement(
statement.to_statement()
)
# Print out some information for each rate card.
unless page[:results].nil?
page[:results].each_with_index do |rate_card, index|
puts ('%d) Rate card with ID %d, name "%s", and currency code "%s" ' +
'was found.') % [index + statement.offset, rate_card[:id],
rate_card[:name], rate_card[:currency_code]]
end
end
# Increase the statement offset by the page size to get the next page.
statement.offset += statement.limit
end while statement.offset < page[:total_result_set_size]
puts 'Total number of rate cards: %d' % page[:total_result_set_size]
end
if __FILE__ == $0
API_VERSION = :v201808
# Get AdManagerApi instance and load configuration from ~/ad_manager_api.yml.
ad_manager = AdManagerApi::Api.new
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
# the configuration file or provide your own logger:
# ad_manager.logger = Logger.new('ad_manager_xml.log')
begin
get_all_rate_cards(ad_manager)
# HTTP errors.
rescue AdsCommon::Errors::HttpError => e
puts "HTTP Error: %s" % e
# API errors.
rescue AdManagerApi::Errors::ApiException => e
puts "Message: %s" % e.message
puts 'Errors:'
e.errors.each_with_index do |error, index|
puts "\tError [%d]:" % (index + 1)
error.each do |field, value|
puts "\t\t%s: %s" % [field, value]
end
end
end
end
| 32.831325 | 79 | 0.679633 |
91c74e4694c1c37ccdb3a265799900d7415e7773 | 485 | # frozen_string_literal: true
# mock ElasticSearch request to response success
class MockElasticSearch
class << self
FakeResponse = Struct.new(:status, :body, :headers) do
def status
values[0] || 200
end
def body
values[1] || {hits: {hits: [], total: 0}}
end
def headers
values[2] || {}
end
end
def start
Elasticsearch::Model.client.stubs(:perform_request).returns(FakeResponse.new)
end
end
end
| 19.4 | 83 | 0.610309 |
796eed3eb82fc7cfebc18276bac75c55b35f4dea | 362 | module Flipper
module Rails
def self.flipper
@flipper ||= Flipper.new(
::Rails.application.config.flipper[:adapter].new(
::Rails.application.config.flipper[:adapter_options] || {}
)
)
end
end
end
require 'flipper'
require 'flipper/rails/version'
require 'flipper/rails/options'
require 'flipper/rails/railtie'
| 20.111111 | 68 | 0.660221 |
ffdded10e899dc7704da7db424a1ef5eda55db21 | 6,552 | require 'support/shared/integration/integration_helper'
require 'chef/mixin/shell_out'
describe "chef-client" do
extend IntegrationSupport
include Chef::Mixin::ShellOut
when_the_repository "has a cookbook with a no-op recipe" do
file 'cookbooks/x/recipes/default.rb', ''
it "should complete with success" do
file 'config/client.rb', <<EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
chef_dir = File.join(File.dirname(__FILE__), "..", "..", "..", "bin")
result = shell_out("chef-client -c \"#{path_to('config/client.rb')}\" -o 'x::default'", :cwd => chef_dir)
result.error!
end
context 'and no config file' do
it 'should complete with success when cwd is just above cookbooks and paths are not specified' do
chef_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "bin"))
result = shell_out("ruby #{chef_dir}/chef-client -z -o 'x::default' --config-file-jail \"#{path_to('')}\"", :cwd => path_to(''))
result.error!
end
it 'should complete with success when cwd is below cookbooks and paths are not specified' do
chef_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "bin"))
result = shell_out("ruby #{chef_dir}/chef-client -z -o 'x::default' --config-file-jail \"#{path_to('')}\"", :cwd => path_to('cookbooks/x'))
result.error!
end
it 'should fail when cwd is below high above and paths are not specified' do
chef_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "bin"))
result = shell_out("ruby #{chef_dir}/chef-client -z -o 'x::default' --config-file-jail \"#{path_to('')}\"", :cwd => File.expand_path('..', path_to('')))
result.exitstatus.should == 1
end
end
context 'and a config file under .chef/knife.rb' do
file '.chef/knife.rb', 'xxx.xxx'
it 'should load .chef/knife.rb when -z is specified' do
chef_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "bin"))
result = shell_out("ruby #{chef_dir}/chef-client -z -o 'x::default' --config-file-jail \"#{path_to('')}\"", :cwd => path_to(''))
# FATAL: Configuration error NoMethodError: undefined method `xxx' for nil:NilClass
result.stdout.should include("xxx")
end
it 'fails to load .chef/knife.rb when -z is specified and --config-file-jail does not include the .chef/knife.rb' do
chef_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "bin"))
result = shell_out("ruby #{chef_dir}/chef-client -z -o 'x::default' --config-file-jail \"#{path_to('roles')}\"", :cwd => path_to(''))
result.error!
end
end
it "should complete with success" do
file 'config/client.rb', <<EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
chef_dir = File.join(File.dirname(__FILE__), "..", "..", "..", "bin")
result = shell_out("chef-client -c \"#{path_to('config/client.rb')}\" -o 'x::default'", :cwd => chef_dir)
result.error!
end
context 'and a private key' do
file 'mykey.pem', <<EOM
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEApubutqtYYQ5UiA9QhWP7UvSmsfHsAoPKEVVPdVW/e8Svwpyf
0Xef6OFWVmBE+W442ZjLOe2y6p2nSnaq4y7dg99NFz6X+16mcKiCbj0RCiGqCvCk
NftHhTgO9/RFvCbmKZ1RKNob1YzLrFpxBHaSh9po+DGWhApcd+I+op+ZzvDgXhNn
0nauZu3rZmApI/r7EEAOjFedAXs7VPNXhhtZAiLSAVIrwU3ZajtSzgXOxbNzgj5O
AAAMmThK+71qPdffAdO4J198H6/MY04qgtFo7vumzCq0UCaGZfmeI1UNE4+xQWwP
HJ3pDAP61C6Ebx2snI2kAd9QMx9Y78nIedRHPwIDAQABAoIBAHssRtPM1GacWsom
8zfeN6ZbI4KDlbetZz0vhnqDk9NVrpijWlcOP5dwZXVNitnB/HaqCqFvyPDY9JNB
zI/pEFW4QH59FVDP42mVEt0keCTP/1wfiDDGh1vLqVBYl/ZphscDcNgDTzNkuxMx
k+LFVxKnn3w7rGc59lALSkpeGvbbIDjp3LUMlUeCF8CIFyYZh9ZvXe4OCxYdyjxb
i8tnMLKvJ4Psbh5jMapsu3rHQkfPdqzztQUz8vs0NYwP5vWge46FUyk+WNm/IhbJ
G3YM22nwUS8Eu2bmTtADSJolATbCSkOwQ1D+Fybz/4obfYeGaCdOqB05ttubhenV
ShsAb7ECgYEA20ecRVxw2S7qA7sqJ4NuYOg9TpfGooptYNA1IP971eB6SaGAelEL
awYkGNuu2URmm5ElZpwJFFTDLGA7t2zB2xI1FeySPPIVPvJGSiZoFQOVlIg9WQzK
7jTtFQ/tOMrF+bigEUJh5bP1/7HzqSpuOsPjEUb2aoCTp+tpiRGL7TUCgYEAwtns
g3ysrSEcTzpSv7fQRJRk1lkBhatgNd0oc+ikzf74DaVLhBg1jvSThDhiDCdB59mr
Jh41cnR1XqE8jmdQbCDRiFrI1Pq6TPaDZFcovDVE1gue9x86v3FOH2ukPG4d2/Xy
HevXjThtpMMsWFi0JYXuzXuV5HOvLZiP8sN3lSMCgYANpdxdGM7RRbE9ADY0dWK2
V14ReTLcxP7fyrWz0xLzEeCqmomzkz3BsIUoouu0DCTSw+rvAwExqcDoDylIVlWO
fAifz7SeZHbcDxo+3TsXK7zwnLYsx7YNs2+aIv6hzUUbMNmNmXMcZ+IEwx+mRMTN
lYmZdrA5mr0V83oDFPt/jQKBgC74RVE03pMlZiObFZNtheDiPKSG9Bz6wMh7NWMr
c37MtZLkg52mEFMTlfPLe6ceV37CM8WOhqe+dwSGrYhOU06dYqUR7VOZ1Qr0aZvo
fsNPu/Y0+u7rMkgv0fs1AXQnvz7kvKaF0YITVirfeXMafuKEtJoH7owRbur42cpV
YCAtAoGAP1rHOc+w0RUcBK3sY7aErrih0OPh9U5bvJsrw1C0FIZhCEoDVA+fNIQL
syHLXYFNy0OxMtH/bBAXBGNHd9gf5uOnqh0pYcbe/uRAxumC7Rl0cL509eURiA2T
+vFmf54y9YdnLXaqv+FhJT6B6V7WX7IpU9BMqJY1cJYXHuHG2KA=
-----END RSA PRIVATE KEY-----
EOM
it "should complete with success even with a client key" do
file 'config/client.rb', <<EOM
local_mode true
client_key "#{path_to('mykey.pem')}"
cookbook_path "#{path_to('cookbooks')}"
EOM
chef_dir = File.join(File.dirname(__FILE__), "..", "..", "..", "bin")
result = shell_out("chef-client -c \"#{path_to('config/client.rb')}\" -o 'x::default'", :cwd => chef_dir)
result.error!
end
end
it "should complete with success when passed the -z flag" do
file 'config/client.rb', <<EOM
chef_server_url 'http://omg.com/blah'
cookbook_path "#{path_to('cookbooks')}"
EOM
chef_dir = File.join(File.dirname(__FILE__), "..", "..", "..", "bin")
result = shell_out("chef-client -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z", :cwd => chef_dir)
result.error!
end
it "should complete with success when passed the --local-mode flag" do
file 'config/client.rb', <<EOM
chef_server_url 'http://omg.com/blah'
cookbook_path "#{path_to('cookbooks')}"
EOM
chef_dir = File.join(File.dirname(__FILE__), "..", "..", "..", "bin")
result = shell_out("chef-client -c \"#{path_to('config/client.rb')}\" -o 'x::default' --local-mode", :cwd => chef_dir)
result.error!
end
it "should complete with success when passed -z and --chef-zero-port" do
file 'config/client.rb', <<EOM
chef_server_url 'http://omg.com/blah'
cookbook_path "#{path_to('cookbooks')}"
EOM
chef_dir = File.join(File.dirname(__FILE__), "..", "..", "..", "bin")
result = shell_out("chef-client -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z", :cwd => chef_dir)
result.error!
end
end
end
| 44.27027 | 160 | 0.700855 |
91949b660ad9a2b9b0f093488ad4d21f5f0c3fa4 | 163 | # typed: false
class AddNameIndexToOperationType < ActiveRecord::Migration
def change
add_index :operation_types, [:category, :name], unique: true
end
end
| 23.285714 | 64 | 0.760736 |
f81d348179e098094b275b02b3b632fa234ed4a4 | 156 | # frozen_string_literal: true
class AnimalSpecy < ApplicationRecord
has_many :animal_breeds, dependent: :destroy
validates :name, uniqueness: true
end
| 22.285714 | 46 | 0.801282 |
330b96c0895b45e1181f7a69f43bd2b5bc919cb9 | 3,789 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Attempt to read encrypted secrets from `config/secrets.yml.enc`.
# Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or
# `config/secrets.yml.key`.
config.read_encrypted_secrets = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Mount Action Cable outside main process or domain
# config.action_cable.mount_path = nil
# config.action_cable.url = 'wss://example.com/cable'
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :debug
# Prepend all log lines with the following tags.
config.log_tags = [ :request_id ]
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Use a real queuing backend for Active Job (and separate queues per environment)
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "sample_app5_#{Rails.env}"
config.action_mailer.perform_caching = false
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Use a different logger for distributed setups.
# require 'syslog/logger'
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end
| 41.184783 | 102 | 0.757192 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.