zuora_connect 0 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/Rakefile +1 -2
- data/app/assets/javascripts/{zuora_connect → connect_sdk}/api/v1/app_instance.js +0 -0
- data/app/assets/javascripts/{zuora_connect → connect_sdk}/application.js +0 -0
- data/app/assets/stylesheets/{zuora_connect → connect_sdk}/api/v1/app_instance.css +0 -0
- data/app/assets/stylesheets/{zuora_connect → connect_sdk}/application.css +0 -0
- data/app/controllers/connect/admin/tenant_controller.rb +11 -0
- data/app/controllers/connect/api/v1/app_instance_controller.rb +19 -0
- data/app/controllers/connect/application_controller.rb +6 -0
- data/app/helpers/{zuora_connect → connect}/api/v1/app_instance_helper.rb +1 -1
- data/app/helpers/{zuora_connect → connect}/application_helper.rb +1 -2
- data/app/models/connect/app_instance.rb +41 -0
- data/app/views/layouts/connect_sdk/application.html.erb +14 -0
- data/config/initializers/apartment.rb +6 -8
- data/config/routes.rb +1 -15
- data/db/migrate/20160718151733_create_connect_app_instances.rb +7 -0
- data/lib/connect.rb +24 -0
- data/lib/connect/configuration.rb +11 -0
- data/lib/connect/controllers/helpers.rb +47 -0
- data/lib/{zuora_connect → connect}/engine.rb +9 -11
- data/lib/connect/version.rb +3 -0
- data/lib/tasks/{zuora_connect_tasks.rake → connect_tasks.rake} +0 -0
- data/test/connect_test.rb +7 -0
- data/test/controllers/{zuora_connect → connect}/api/v1/app_instance_controller_test.rb +1 -1
- data/test/dummy/config/application.rb +1 -1
- data/test/fixtures/{zuora_connect → connect}/app_instances.yml +0 -0
- data/test/models/{zuora_connect → connect}/app_instance_test.rb +1 -1
- metadata +57 -279
- data/app/assets/javascripts/hallway_wrapper/after.js +0 -15
- data/app/assets/javascripts/hallway_wrapper/before.js +0 -2
- data/app/controllers/zuora_connect/admin/tenant_controller.rb +0 -11
- data/app/controllers/zuora_connect/api/v1/app_instance_controller.rb +0 -58
- data/app/controllers/zuora_connect/application_controller.rb +0 -8
- data/app/controllers/zuora_connect/static_controller.rb +0 -58
- data/app/models/zuora_connect/app_instance.rb +0 -5
- data/app/models/zuora_connect/app_instance_base.rb +0 -952
- data/app/models/zuora_connect/login.rb +0 -36
- data/app/models/zuora_connect/telegraf.rb +0 -93
- data/app/views/layouts/zuora_connect/application.html.erb +0 -14
- data/app/views/sql/refresh_aggregate_table.txt +0 -85
- data/app/views/zuora_connect/static/invalid_app_instance_error.html.erb +0 -65
- data/app/views/zuora_connect/static/invalid_launch_request.html +0 -65
- data/app/views/zuora_connect/static/launch.html.erb +0 -80
- data/app/views/zuora_connect/static/session_error.html.erb +0 -63
- data/config/initializers/aws.rb +0 -2
- data/config/initializers/elastic_apm.rb +0 -25
- data/config/initializers/object_method_hooks.rb +0 -27
- data/config/initializers/postgresql_adapter.rb +0 -32
- data/config/initializers/prometheus.rb +0 -40
- data/config/initializers/redis.rb +0 -13
- data/config/initializers/resque.rb +0 -22
- data/config/initializers/to_bool.rb +0 -24
- data/config/initializers/unicorn.rb +0 -9
- data/db/migrate/20100718151733_create_connect_app_instances.rb +0 -9
- data/db/migrate/20101024162319_add_tokens_to_app_instance.rb +0 -6
- data/db/migrate/20101024220705_add_token_to_app_instance.rb +0 -5
- data/db/migrate/20110131211919_add_sessions_table.rb +0 -13
- data/db/migrate/20110411200303_add_expiration_to_app_instance.rb +0 -5
- data/db/migrate/20110413191512_add_new_api_token.rb +0 -5
- data/db/migrate/20110503003602_add_catalog_data_to_app_instance.rb +0 -6
- data/db/migrate/20110503003603_add_catalog_mappings_to_app_instance.rb +0 -5
- data/db/migrate/20110503003604_catalog_default.rb +0 -5
- data/db/migrate/20180301052853_add_catalog_attempted_at.rb +0 -5
- data/db/migrate/20181206162339_add_fields_to_instance.rb +0 -5
- data/lib/metrics/influx/point_value.rb +0 -79
- data/lib/metrics/net.rb +0 -218
- data/lib/middleware/metrics_middleware.rb +0 -134
- data/lib/resque/additions.rb +0 -53
- data/lib/resque/dynamic_queues.rb +0 -222
- data/lib/resque/plugins/custom_logger.rb +0 -46
- data/lib/resque/self_lookup.rb +0 -19
- data/lib/resque/silence_done.rb +0 -71
- data/lib/zuora_connect.rb +0 -42
- data/lib/zuora_connect/configuration.rb +0 -53
- data/lib/zuora_connect/controllers/helpers.rb +0 -261
- data/lib/zuora_connect/exceptions.rb +0 -67
- data/lib/zuora_connect/railtie.rb +0 -63
- data/lib/zuora_connect/version.rb +0 -3
- data/lib/zuora_connect/views/helpers.rb +0 -9
- data/test/lib/generators/zuora_connect/datatable_generator_test.rb +0 -16
- data/test/zuora_connect_test.rb +0 -7
@@ -1,63 +0,0 @@
|
|
1
|
-
<html><head>
|
2
|
-
<title>We're sorry, but something went wrong (500)</title>
|
3
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
4
|
-
<style>
|
5
|
-
body {
|
6
|
-
background-color: #EFEFEF;
|
7
|
-
color: #2E2F30;
|
8
|
-
text-align: center;
|
9
|
-
font-family: arial, sans-serif;
|
10
|
-
margin: 0;
|
11
|
-
}
|
12
|
-
|
13
|
-
div.dialog {
|
14
|
-
width: 95%;
|
15
|
-
max-width: 33em;
|
16
|
-
margin: 4em auto 0;
|
17
|
-
}
|
18
|
-
|
19
|
-
div.dialog > div {
|
20
|
-
border: 1px solid #CCC;
|
21
|
-
border-right-color: #999;
|
22
|
-
border-left-color: #999;
|
23
|
-
border-bottom-color: #BBB;
|
24
|
-
border-top: #B00100 solid 4px;
|
25
|
-
border-top-left-radius: 9px;
|
26
|
-
border-top-right-radius: 9px;
|
27
|
-
background-color: white;
|
28
|
-
padding: 7px 12% 0;
|
29
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
30
|
-
}
|
31
|
-
|
32
|
-
h1 {
|
33
|
-
font-size: 100%;
|
34
|
-
color: #730E15;
|
35
|
-
line-height: 1.5em;
|
36
|
-
}
|
37
|
-
|
38
|
-
div.dialog > p {
|
39
|
-
margin: 0 0 1em;
|
40
|
-
padding: 1em;
|
41
|
-
background-color: #F7F7F7;
|
42
|
-
border: 1px solid #CCC;
|
43
|
-
border-right-color: #999;
|
44
|
-
border-left-color: #999;
|
45
|
-
border-bottom-color: #999;
|
46
|
-
border-bottom-left-radius: 4px;
|
47
|
-
border-bottom-right-radius: 4px;
|
48
|
-
border-top-color: #DADADA;
|
49
|
-
color: #666;
|
50
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
51
|
-
}
|
52
|
-
</style>
|
53
|
-
</head>
|
54
|
-
|
55
|
-
<body>
|
56
|
-
<!-- This file lives in public/500.html -->
|
57
|
-
<div class="dialog">
|
58
|
-
<div>
|
59
|
-
<h1>Session is invalid</h1>
|
60
|
-
</div>
|
61
|
-
<p>Please try relaunching the application from connect.zuora.com</p>
|
62
|
-
</div>
|
63
|
-
</body></html>
|
data/config/initializers/aws.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
if defined?(ElasticAPM)
|
2
|
-
if ZuoraConnect.configuration.enable_apm && !defined?(Rails::Console)
|
3
|
-
ElasticAPM.agent.config.disable_send = false
|
4
|
-
else
|
5
|
-
ElasticAPM.agent.config.disable_send = true
|
6
|
-
end
|
7
|
-
case Rails.env.to_s
|
8
|
-
when 'production'
|
9
|
-
ElasticAPM.agent.config.server_url = "http://apm-server.logging:8200"
|
10
|
-
ElasticAPM.agent.config.transaction_sample_rate = 0.20
|
11
|
-
ElasticAPM.agent.config.capture_body = false
|
12
|
-
when 'staging'
|
13
|
-
ElasticAPM.agent.config.server_url = "http://apm-server.logging:8200"
|
14
|
-
ElasticAPM.agent.config.transaction_sample_rate = 1.0
|
15
|
-
when 'development'
|
16
|
-
ElasticAPM.agent.config.server_url = "http://logging.0.ecc.auw2.zuora:8200"
|
17
|
-
ElasticAPM.agent.config.transaction_sample_rate = 1.0
|
18
|
-
end
|
19
|
-
ElasticAPM.agent.config.pool_size = 1
|
20
|
-
ElasticAPM.agent.config.transaction_max_spans = 500
|
21
|
-
ElasticAPM.agent.config.ignore_url_patterns = ['^\/admin\/resque.*', '^\/admin\/redis.*', '^\/admin\/peek.*', '^\/peek.*']
|
22
|
-
ElasticAPM.agent.config.verify_server_cert = false
|
23
|
-
ElasticAPM.agent.config.log_level = Logger::INFO
|
24
|
-
ElasticAPM.agent.config.service_name = ::ZuoraConnect::Telegraf.app_name
|
25
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
class Object
|
2
|
-
def self.method_hook(*args)
|
3
|
-
options = args.extract_options!
|
4
|
-
return unless (options[:before].present? or options[:after].present?)
|
5
|
-
args.each do |method_name|
|
6
|
-
old_method = instance_method(method_name) rescue next
|
7
|
-
|
8
|
-
define_method(method_name) do |*args|
|
9
|
-
# invoke before callback
|
10
|
-
if options[:before].present?
|
11
|
-
options[:before].is_a?(Proc) ? options[:before].call(method_name, self):
|
12
|
-
send(options[:before], method_name)
|
13
|
-
end
|
14
|
-
|
15
|
-
# you can modify the code to call after callback
|
16
|
-
# only when the old method returns true etc..
|
17
|
-
old_method.bind(self).call(*args)
|
18
|
-
|
19
|
-
# invoke after callback
|
20
|
-
if options[:after].present?
|
21
|
-
options[:after].is_a?(Proc) ? options[:after].call(method_name, self):
|
22
|
-
send(options[:after], method_name)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
module ActiveRecord
|
2
|
-
module ConnectionAdapters
|
3
|
-
class PostgreSQLAdapter < AbstractAdapter
|
4
|
-
private
|
5
|
-
def load_additional_types(type_map, oids = nil)
|
6
|
-
initializer = OID::TypeMapInitializer.new(type_map)
|
7
|
-
if supports_ranges?
|
8
|
-
query = <<-SQL
|
9
|
-
SELECT DISTINCT on (t.typname) t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype
|
10
|
-
FROM pg_type as t
|
11
|
-
LEFT JOIN pg_range as r ON oid = rngtypid
|
12
|
-
SQL
|
13
|
-
else
|
14
|
-
query = <<-SQL
|
15
|
-
SELECT DISTINCT on (t.typname) t.oid, t.typname, t.typelem, t.typdelim, t.typinput, t.typtype, t.typbasetype
|
16
|
-
FROM pg_type as t
|
17
|
-
SQL
|
18
|
-
end
|
19
|
-
|
20
|
-
if oids
|
21
|
-
query += "WHERE t.oid::integer IN (%s)" % oids.join(", ")
|
22
|
-
else
|
23
|
-
query += initializer.query_conditions_for_initial_load(type_map)
|
24
|
-
end
|
25
|
-
|
26
|
-
execute_and_clear(query, "SCHEMA", []) do |records|
|
27
|
-
initializer.run(records)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
if defined? Prometheus
|
2
|
-
module Prometheus
|
3
|
-
require "zuora_connect/version"
|
4
|
-
require "zuora_api/version"
|
5
|
-
|
6
|
-
# Create a default Prometheus registry for our metrics.
|
7
|
-
prometheus = Prometheus::Client.registry
|
8
|
-
|
9
|
-
# Create your metrics.
|
10
|
-
ZUORA_VERSION = Prometheus::Client::Gauge.new(:zuora_version, 'The current Zuora Gem version.')
|
11
|
-
CONNECT_VERSION = Prometheus::Client::Gauge.new(:gem_version, 'The current Connect Gem version.')
|
12
|
-
RAILS_VERSION = Prometheus::Client::Gauge.new(:rails_version, 'The current Rails version.')
|
13
|
-
RUBY_V = Prometheus::Client::Gauge.new(:ruby_version, 'The current Ruby version.')
|
14
|
-
|
15
|
-
# Register your metrics with the registry we previously created.
|
16
|
-
prometheus.register(ZUORA_VERSION);ZUORA_VERSION.set({version: ZuoraAPI::VERSION, name: ZuoraConnect::Telegraf.app_name},0)
|
17
|
-
prometheus.register(CONNECT_VERSION);CONNECT_VERSION.set({version: ZuoraConnect::VERSION, name: ZuoraConnect::Telegraf.app_name},0)
|
18
|
-
prometheus.register(RAILS_VERSION);RAILS_VERSION.set({version: Rails.version, name: ZuoraConnect::Telegraf.app_name},0)
|
19
|
-
prometheus.register(RUBY_V);RUBY_V.set({version: RUBY_VERSION, name: ZuoraConnect::Telegraf.app_name},0)
|
20
|
-
|
21
|
-
# Do they have resque jobs?
|
22
|
-
if defined? Resque.redis
|
23
|
-
REDIS_CONNECTION = Prometheus::Client::Gauge.new(:redis_connection, 'The status of the redis connection, 0 or 1')
|
24
|
-
FINISHED_JOBS = Prometheus::Client::Gauge.new(:finished_jobs, 'Done resque jobs')
|
25
|
-
WORKERS = Prometheus::Client::Gauge.new(:workers, 'Total resque workers')
|
26
|
-
ACTIVE_WORKERS = Prometheus::Client::Gauge.new(:active_workers, 'Active resque workers')
|
27
|
-
FAILED_JOBS = Prometheus::Client::Gauge.new(:failed_jobs, 'Failed resque jobs')
|
28
|
-
PENDING_JOBS = Prometheus::Client::Gauge.new(:pending_jobs, 'Pending resque jobs')
|
29
|
-
|
30
|
-
prometheus.register(REDIS_CONNECTION)
|
31
|
-
prometheus.register(FINISHED_JOBS)
|
32
|
-
prometheus.register(ACTIVE_WORKERS)
|
33
|
-
prometheus.register(WORKERS)
|
34
|
-
prometheus.register(FAILED_JOBS)
|
35
|
-
prometheus.register(PENDING_JOBS)
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
redis_url = ENV["REDIS_URL"].present? ? ENV["REDIS_URL"] : defined?(Rails.application.secrets.redis) ? Rails.application.secrets.redis : 'redis://localhost:6379/1'
|
2
|
-
resque_url = ENV["RESQUE_URL"].present? ? ENV["RESQUE_URL"] : defined?(Rails.application.secrets.resque) ? Rails.application.secrets.resque : 'redis://localhost:6379/1'
|
3
|
-
if defined?(Redis.current)
|
4
|
-
Redis.current = Redis.new(:id => "#{ZuoraConnect::Telegraf.full_process_name(process_name: 'Redis')}", :url => redis_url, :timeout => 6, :reconnect_attempts => 2)
|
5
|
-
if defined?(Resque.redis)
|
6
|
-
Resque.redis = resque_url != redis_url ? Redis.new(:id => "#{ZuoraConnect::Telegraf.full_process_name(process_name: 'Resque')}", :url => resque_url, :timeout => 6, :reconnect_attempts => 2) : Redis.current
|
7
|
-
end
|
8
|
-
end
|
9
|
-
if defined?(RedisBrowser)
|
10
|
-
RedisBrowser.configure("connections" => {
|
11
|
-
"Redis" => { "url" => redis_url },
|
12
|
-
"Resque" => { "url" => resque_url }})
|
13
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
if defined?(Resque::Worker)
|
2
|
-
Resque.send(:extend, Resque::Additions)
|
3
|
-
Resque::Worker.send(:include, Resque::DynamicQueues)
|
4
|
-
Resque::Worker.send(:include, Resque::SilenceDone) if ZuoraConnect.configuration.silencer_resque_finish == true
|
5
|
-
Resque::Job.send(:include, Resque::SelfLookup)
|
6
|
-
end
|
7
|
-
|
8
|
-
Resque.module_eval do
|
9
|
-
# Returns a hash, mapping queue names to queue sizes
|
10
|
-
def queue_sizes
|
11
|
-
paused_queues = Resque.redis.zrange("PauseQueue", 0, -1).map! {|key| key.split("__")[0]}
|
12
|
-
queue_names = queues.delete_if{|name| paused_queues.include?(name.split("_")[0])}
|
13
|
-
|
14
|
-
sizes = redis.pipelined do
|
15
|
-
queue_names.each do |name|
|
16
|
-
redis.llen("queue:#{name}")
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
Hash[queue_names.zip(sizes)]
|
21
|
-
end
|
22
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
class String
|
2
|
-
def to_bool
|
3
|
-
return self if (self.class == TrueClass || self.class == FalseClass)
|
4
|
-
return true if self == true || self =~ (/(true|t|yes|y|1)$/i)
|
5
|
-
return false if self == false || self.blank? || self =~ (/(false|f|no|n|0)$/i)
|
6
|
-
return false
|
7
|
-
raise ArgumentError.new("invalid value for Boolean: \"#{self}\"")
|
8
|
-
end
|
9
|
-
end
|
10
|
-
class TrueClass
|
11
|
-
def to_bool
|
12
|
-
return self
|
13
|
-
end
|
14
|
-
end
|
15
|
-
class FalseClass
|
16
|
-
def to_bool
|
17
|
-
return self
|
18
|
-
end
|
19
|
-
end
|
20
|
-
class NilClass
|
21
|
-
def to_bool
|
22
|
-
return false
|
23
|
-
end
|
24
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
if defined?(Unicorn::WorkerKiller)
|
2
|
-
Unicorn::WorkerKiller.module_eval do
|
3
|
-
self.singleton_class.send(:alias_method, :kill_self_old, :kill_self)
|
4
|
-
def self.kill_self(logger, start_time)
|
5
|
-
self.kill_self_old(logger, start_time)
|
6
|
-
ZuoraConnect::AppInstance.write_to_telegraf(direction: 'Unicorn-Killer', tags: {app_instance: 0}, values: {kill: 1})
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
@@ -1,6 +0,0 @@
|
|
1
|
-
class AddTokensToAppInstance < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
add_column :zuora_connect_app_instances, :access_token, :string unless column_exists? :zuora_connect_app_instances, :access_token
|
4
|
-
add_column :zuora_connect_app_instances, :refresh_token, :string unless column_exists? :zuora_connect_app_instances, :refresh_token
|
5
|
-
end
|
6
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class AddSessionsTable < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
if !ActiveRecord::Base.connection.table_exists?('sessions')
|
4
|
-
create_table :sessions do |t|
|
5
|
-
t.string :session_id, :null => false
|
6
|
-
t.text :data
|
7
|
-
t.timestamps
|
8
|
-
end
|
9
|
-
add_index :sessions, :session_id, :unique => true
|
10
|
-
add_index :sessions, :updated_at
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,6 +0,0 @@
|
|
1
|
-
class AddCatalogDataToAppInstance < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
add_column :zuora_connect_app_instances, :catalog_updated_at, :datetime unless column_exists? :zuora_connect_app_instances, :catalog_updated_at
|
4
|
-
add_column :zuora_connect_app_instances, :catalog, :jsonb, default: {} unless column_exists? :zuora_connect_app_instances, :catalog
|
5
|
-
end
|
6
|
-
end
|
@@ -1,79 +0,0 @@
|
|
1
|
-
module InfluxDB
|
2
|
-
# Convert data point to string using Line protocol
|
3
|
-
class PointValue
|
4
|
-
attr_reader :series, :values, :tags, :timestamp
|
5
|
-
|
6
|
-
def initialize(data)
|
7
|
-
@series = escape data[:series], :measurement
|
8
|
-
@values = escape_values data[:values]
|
9
|
-
@tags = escape_tags data[:tags]
|
10
|
-
@timestamp = data[:timestamp]
|
11
|
-
end
|
12
|
-
|
13
|
-
def dump
|
14
|
-
dump = @series.dup
|
15
|
-
dump << ",#{@tags}" if @tags
|
16
|
-
dump << " #{@values}"
|
17
|
-
dump << " #{@timestamp}" if @timestamp
|
18
|
-
dump
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
ESCAPES = {
|
24
|
-
measurement: [' '.freeze, ','.freeze],
|
25
|
-
tag_key: ['='.freeze, ' '.freeze, ','.freeze],
|
26
|
-
tag_value: ['='.freeze, ' '.freeze, ','.freeze],
|
27
|
-
field_key: ['='.freeze, ' '.freeze, ','.freeze, '"'.freeze],
|
28
|
-
field_value: ["\\".freeze, '"'.freeze],
|
29
|
-
}.freeze
|
30
|
-
|
31
|
-
private_constant :ESCAPES
|
32
|
-
|
33
|
-
def escape(str, type)
|
34
|
-
# rubocop:disable Layout/AlignParameters
|
35
|
-
str = str.encode "UTF-8".freeze, "UTF-8".freeze,
|
36
|
-
invalid: :replace,
|
37
|
-
undef: :replace,
|
38
|
-
replace: "".freeze
|
39
|
-
# rubocop:enable Layout/AlignParameters
|
40
|
-
|
41
|
-
ESCAPES[type].each do |ch|
|
42
|
-
str = str.gsub(ch) { "\\#{ch}" }
|
43
|
-
end
|
44
|
-
str
|
45
|
-
end
|
46
|
-
|
47
|
-
def escape_values(values)
|
48
|
-
return if values.nil?
|
49
|
-
values.map do |k, v|
|
50
|
-
key = escape(k.to_s, :field_key)
|
51
|
-
val = escape_value(v)
|
52
|
-
"#{key}=#{val}"
|
53
|
-
end.join(",".freeze)
|
54
|
-
end
|
55
|
-
|
56
|
-
def escape_value(value)
|
57
|
-
if value.is_a?(String)
|
58
|
-
'"'.freeze + escape(value, :field_value) + '"'.freeze
|
59
|
-
elsif value.is_a?(Integer)
|
60
|
-
"#{value}i"
|
61
|
-
else
|
62
|
-
value.to_s
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
def escape_tags(tags)
|
67
|
-
return if tags.nil?
|
68
|
-
|
69
|
-
tags = tags.map do |k, v|
|
70
|
-
key = escape(k.to_s, :tag_key)
|
71
|
-
val = escape(v.to_s, :tag_value)
|
72
|
-
|
73
|
-
"#{key}=#{val}" unless key == "".freeze || val == "".freeze
|
74
|
-
end.compact
|
75
|
-
|
76
|
-
tags.join(",") unless tags.empty?
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|