conversant 1.0.16
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 +7 -0
- data/.env.example +39 -0
- data/.gitignore +52 -0
- data/.gitlab-ci.yml +108 -0
- data/.rspec +3 -0
- data/.rubocop.yml +16 -0
- data/.yardopts +7 -0
- data/CHANGELOG.md +487 -0
- data/Gemfile +12 -0
- data/LICENSE.txt +21 -0
- data/README.md +860 -0
- data/RELEASE.md +726 -0
- data/Rakefile +21 -0
- data/conversant.gemspec +49 -0
- data/examples/inheritance_integration.rb +348 -0
- data/examples/rails_initializer.rb +69 -0
- data/lib/conversant/configuration.rb +132 -0
- data/lib/conversant/v3/base.rb +47 -0
- data/lib/conversant/v3/http_client.rb +456 -0
- data/lib/conversant/v3/mixins/authentication.rb +221 -0
- data/lib/conversant/v3/services/authorization.rb +194 -0
- data/lib/conversant/v3/services/cdn/analytics.rb +483 -0
- data/lib/conversant/v3/services/cdn/audit.rb +71 -0
- data/lib/conversant/v3/services/cdn/business.rb +122 -0
- data/lib/conversant/v3/services/cdn/certificate.rb +180 -0
- data/lib/conversant/v3/services/cdn/dashboard.rb +109 -0
- data/lib/conversant/v3/services/cdn/domain.rb +223 -0
- data/lib/conversant/v3/services/cdn/monitoring.rb +65 -0
- data/lib/conversant/v3/services/cdn/partner/analytics.rb +233 -0
- data/lib/conversant/v3/services/cdn/partner.rb +60 -0
- data/lib/conversant/v3/services/cdn.rb +221 -0
- data/lib/conversant/v3/services/lms/dashboard.rb +99 -0
- data/lib/conversant/v3/services/lms/domain.rb +108 -0
- data/lib/conversant/v3/services/lms/job.rb +211 -0
- data/lib/conversant/v3/services/lms/partner/analytics.rb +266 -0
- data/lib/conversant/v3/services/lms/partner/business.rb +151 -0
- data/lib/conversant/v3/services/lms/partner/report.rb +170 -0
- data/lib/conversant/v3/services/lms/partner.rb +58 -0
- data/lib/conversant/v3/services/lms/preset.rb +57 -0
- data/lib/conversant/v3/services/lms.rb +173 -0
- data/lib/conversant/v3/services/oss/partner/analytics.rb +105 -0
- data/lib/conversant/v3/services/oss/partner.rb +48 -0
- data/lib/conversant/v3/services/oss.rb +128 -0
- data/lib/conversant/v3/services/portal/dashboard.rb +114 -0
- data/lib/conversant/v3/services/portal.rb +219 -0
- data/lib/conversant/v3/services/vms/analytics.rb +114 -0
- data/lib/conversant/v3/services/vms/business.rb +190 -0
- data/lib/conversant/v3/services/vms/partner/analytics.rb +133 -0
- data/lib/conversant/v3/services/vms/partner/business.rb +90 -0
- data/lib/conversant/v3/services/vms/partner.rb +57 -0
- data/lib/conversant/v3/services/vms/transcoding.rb +184 -0
- data/lib/conversant/v3/services/vms.rb +166 -0
- data/lib/conversant/v3.rb +36 -0
- data/lib/conversant/version.rb +5 -0
- data/lib/conversant.rb +108 -0
- data/publish.sh +107 -0
- data/sig/conversant/v3/services/authorization.rbs +34 -0
- data/sig/conversant/v3/services/cdn.rbs +123 -0
- data/sig/conversant/v3/services/lms.rbs +80 -0
- data/sig/conversant/v3/services/portal.rbs +22 -0
- data/sig/conversant/v3/services/vms.rbs +64 -0
- data/sig/conversant/v3.rbs +85 -0
- data/sig/conversant.rbs +37 -0
- metadata +267 -0
data/publish.sh
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Conversant Gem Publishing Script
|
|
4
|
+
# This script helps you publish the gem to RubyGems.org
|
|
5
|
+
|
|
6
|
+
set -e # Exit on error
|
|
7
|
+
|
|
8
|
+
echo "========================================="
|
|
9
|
+
echo " Conversant Gem Publishing Process"
|
|
10
|
+
echo "========================================="
|
|
11
|
+
echo ""
|
|
12
|
+
|
|
13
|
+
# Color codes for output
|
|
14
|
+
RED='\033[0;31m'
|
|
15
|
+
GREEN='\033[0;32m'
|
|
16
|
+
YELLOW='\033[1;33m'
|
|
17
|
+
NC='\033[0m' # No Color
|
|
18
|
+
|
|
19
|
+
# Step 1: Check if we're in the right directory
|
|
20
|
+
if [ ! -f "conversant.gemspec" ]; then
|
|
21
|
+
echo -e "${RED}Error: conversant.gemspec not found. Please run this script from the gem root directory.${NC}"
|
|
22
|
+
exit 1
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
echo -e "${GREEN}✓${NC} Found conversant.gemspec"
|
|
26
|
+
|
|
27
|
+
# Step 2: Clean up previous builds
|
|
28
|
+
echo -e "\n${YELLOW}Step 1: Cleaning previous builds...${NC}"
|
|
29
|
+
rm -f *.gem
|
|
30
|
+
echo -e "${GREEN}✓${NC} Cleaned previous gem files"
|
|
31
|
+
|
|
32
|
+
# Step 3: Run tests (if available)
|
|
33
|
+
echo -e "\n${YELLOW}Step 2: Running tests...${NC}"
|
|
34
|
+
if [ -f "Rakefile" ] && grep -q "RSpec" "Rakefile" 2>/dev/null; then
|
|
35
|
+
bundle exec rake spec || {
|
|
36
|
+
echo -e "${RED}✗ Tests failed. Please fix tests before publishing.${NC}"
|
|
37
|
+
exit 1
|
|
38
|
+
}
|
|
39
|
+
echo -e "${GREEN}✓${NC} All tests passed"
|
|
40
|
+
else
|
|
41
|
+
echo -e "${YELLOW}⚠${NC} No tests found, skipping..."
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
# Step 4: Build the gem
|
|
45
|
+
echo -e "\n${YELLOW}Step 3: Building the gem...${NC}"
|
|
46
|
+
gem build conversant.gemspec || {
|
|
47
|
+
echo -e "${RED}✗ Gem build failed. Please fix the gemspec.${NC}"
|
|
48
|
+
exit 1
|
|
49
|
+
}
|
|
50
|
+
echo -e "${GREEN}✓${NC} Gem built successfully"
|
|
51
|
+
|
|
52
|
+
# Step 5: Display gem info
|
|
53
|
+
echo -e "\n${YELLOW}Step 4: Gem Information:${NC}"
|
|
54
|
+
gem_file=$(ls *.gem | head -n 1)
|
|
55
|
+
echo " Gem file: $gem_file"
|
|
56
|
+
gem specification $gem_file | grep -E "name:|version:|authors:|summary:" | sed 's/^/ /'
|
|
57
|
+
|
|
58
|
+
# Step 6: Check RubyGems credentials
|
|
59
|
+
echo -e "\n${YELLOW}Step 5: Checking RubyGems credentials...${NC}"
|
|
60
|
+
if [ ! -f ~/.gem/credentials ]; then
|
|
61
|
+
echo -e "${YELLOW}⚠ No RubyGems credentials found.${NC}"
|
|
62
|
+
echo " To set up credentials, run:"
|
|
63
|
+
echo " gem signin"
|
|
64
|
+
echo " Or:"
|
|
65
|
+
echo " curl -u your_rubygems_username https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials"
|
|
66
|
+
echo " chmod 0600 ~/.gem/credentials"
|
|
67
|
+
exit 1
|
|
68
|
+
fi
|
|
69
|
+
echo -e "${GREEN}✓${NC} RubyGems credentials found"
|
|
70
|
+
|
|
71
|
+
# Step 7: Confirm before publishing
|
|
72
|
+
echo -e "\n${YELLOW}Ready to publish $gem_file to RubyGems.org${NC}"
|
|
73
|
+
echo -e "${YELLOW}This action cannot be undone. Are you sure? (y/N)${NC}"
|
|
74
|
+
read -r response
|
|
75
|
+
|
|
76
|
+
if [[ ! "$response" =~ ^[Yy]$ ]]; then
|
|
77
|
+
echo "Publishing cancelled."
|
|
78
|
+
exit 0
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
# Step 8: Push to RubyGems
|
|
82
|
+
echo -e "\n${YELLOW}Step 6: Publishing to RubyGems...${NC}"
|
|
83
|
+
gem push $gem_file || {
|
|
84
|
+
echo -e "${RED}✗ Failed to push gem to RubyGems${NC}"
|
|
85
|
+
echo " Common issues:"
|
|
86
|
+
echo " - Gem name already taken"
|
|
87
|
+
echo " - Invalid credentials"
|
|
88
|
+
echo " - Network issues"
|
|
89
|
+
exit 1
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
echo -e "\n${GREEN}=========================================${NC}"
|
|
93
|
+
echo -e "${GREEN} 🎉 Successfully published $gem_file!${NC}"
|
|
94
|
+
echo -e "${GREEN}=========================================${NC}"
|
|
95
|
+
echo ""
|
|
96
|
+
echo "Your gem is now available at:"
|
|
97
|
+
echo " https://rubygems.org/gems/conversant"
|
|
98
|
+
echo ""
|
|
99
|
+
echo "Users can install it with:"
|
|
100
|
+
echo " gem install conversant"
|
|
101
|
+
echo ""
|
|
102
|
+
echo "Next steps:"
|
|
103
|
+
echo " 1. Tag this release in git:"
|
|
104
|
+
echo " git tag -a v1.0.0 -m 'Release version 1.0.0'"
|
|
105
|
+
echo " git push origin v1.0.0"
|
|
106
|
+
echo " 2. Create a GitHub release"
|
|
107
|
+
echo " 3. Update documentation if needed"
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Authorization module type signatures
|
|
2
|
+
module Conversant
|
|
3
|
+
module V3
|
|
4
|
+
module Services
|
|
5
|
+
module Authorization
|
|
6
|
+
protected
|
|
7
|
+
|
|
8
|
+
def authorized_headers: () -> Hash[String, String]
|
|
9
|
+
def authorize: () -> String?
|
|
10
|
+
|
|
11
|
+
private
|
|
12
|
+
|
|
13
|
+
def fetch_session_cookie: () -> String?
|
|
14
|
+
def fetch_sso_session: () -> String?
|
|
15
|
+
def cached_session: () -> String?
|
|
16
|
+
def session_cache_key: () -> String
|
|
17
|
+
def sso_cache_key: () -> String
|
|
18
|
+
def build_headers_with_cookies: (String? session_cookie, String? sso_gw_session2) -> Hash[String, String]
|
|
19
|
+
def base_headers: () -> Hash[String, String]
|
|
20
|
+
def format_cookies: (String? session_cookie, String? sso_gw_session2) -> String?
|
|
21
|
+
def build_cookie_hash: (String? session_cookie, String? sso_gw_session2) -> Hash[String, String]
|
|
22
|
+
def log_missing_session: () -> void
|
|
23
|
+
|
|
24
|
+
# Service-specific methods that must be implemented
|
|
25
|
+
def service_endpoint: () -> String
|
|
26
|
+
def fetch_new_session: () -> String?
|
|
27
|
+
|
|
28
|
+
# Optional methods that services can override
|
|
29
|
+
def session_cookie_name: () -> String
|
|
30
|
+
def requires_session?: () -> bool
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# CDN service type signatures for Conversant gem
|
|
2
|
+
module Conversant
|
|
3
|
+
module V3
|
|
4
|
+
module Services
|
|
5
|
+
# CDN service inherits from Base class
|
|
6
|
+
class CDN < ::Conversant::V3::Base
|
|
7
|
+
# No need to re-declare attributes from Base
|
|
8
|
+
# attr_reader customer_id: Integer (inherited)
|
|
9
|
+
# attr_reader type: Integer (inherited)
|
|
10
|
+
|
|
11
|
+
# Constructor is inherited from Base
|
|
12
|
+
# def initialize: (Integer customer_id, ?Integer type) -> void
|
|
13
|
+
|
|
14
|
+
# Service instances
|
|
15
|
+
def analytics: () -> CDN::Analytics
|
|
16
|
+
def monitoring: () -> CDN::Monitoring
|
|
17
|
+
def audit: () -> CDN::Audit
|
|
18
|
+
def domain: () -> CDN::Domain
|
|
19
|
+
def business: () -> CDN::Business
|
|
20
|
+
def certificate: () -> CDN::Certificate
|
|
21
|
+
|
|
22
|
+
def requires_session?: -> bool
|
|
23
|
+
|
|
24
|
+
def session_cookie_name: -> String
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
def call: (String method, String path, Hash[Symbol, untyped]? payload) -> String?
|
|
29
|
+
def fetch_new_session: () -> String?
|
|
30
|
+
def service_endpoint: () -> String
|
|
31
|
+
def logger: () -> untyped
|
|
32
|
+
def configuration: () -> untyped
|
|
33
|
+
def redis: () -> untyped
|
|
34
|
+
|
|
35
|
+
# Nested service classes
|
|
36
|
+
class Analytics
|
|
37
|
+
attr_reader parent: CDN
|
|
38
|
+
|
|
39
|
+
def initialize: (CDN parent) -> void
|
|
40
|
+
def bandwidths: (Hash[Symbol, untyped] payload) -> Hash[Symbol, untyped]?
|
|
41
|
+
def volumes: (Hash[Symbol, untyped] payload) -> Hash[Symbol, untyped]?
|
|
42
|
+
def viewers: (Hash[Symbol, untyped] payload) -> Hash[Symbol, untyped]?
|
|
43
|
+
def request_per_second: (Hash[Symbol, untyped] payload) -> Hash[Symbol, untyped]?
|
|
44
|
+
def http_codes: (Hash[Symbol, untyped] payload) -> Hash[Symbol, untyped]?
|
|
45
|
+
def referrer_by_domain: (Hash[Symbol, untyped] payload) -> (Hash[Symbol, untyped] | Array[untyped])?
|
|
46
|
+
def popular_content_url_by_domain: (Hash[Symbol, untyped] payload) -> (Hash[Symbol, untyped] | Array[untyped])?
|
|
47
|
+
def origin_request: (Hash[Symbol, untyped] payload) -> Hash[Symbol, untyped]?
|
|
48
|
+
|
|
49
|
+
private
|
|
50
|
+
|
|
51
|
+
def logger: () -> untyped
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
class Monitoring
|
|
55
|
+
attr_reader parent: CDN
|
|
56
|
+
|
|
57
|
+
def initialize: (CDN parent) -> void
|
|
58
|
+
def spots: (Hash[Symbol, untyped] payload) -> (Hash[Symbol, untyped] | Array[untyped])?
|
|
59
|
+
def delivery_domain_list: () -> Array[Hash[String, untyped]]
|
|
60
|
+
def delivery_domain_detail: (Integer domain_id) -> Hash[String, untyped]?
|
|
61
|
+
def customer_details: () -> Hash[String, untyped]?
|
|
62
|
+
|
|
63
|
+
private
|
|
64
|
+
|
|
65
|
+
def logger: () -> untyped
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
class Audit
|
|
69
|
+
attr_reader parent: CDN
|
|
70
|
+
|
|
71
|
+
def initialize: (CDN parent) -> void
|
|
72
|
+
def list: (Hash[Symbol, untyped] payload) -> (Hash[Symbol, untyped] | Array[untyped])?
|
|
73
|
+
def delivery_domain_operations: (Hash[Symbol, untyped] payload) -> Array[Hash[String, untyped]]
|
|
74
|
+
|
|
75
|
+
private
|
|
76
|
+
|
|
77
|
+
def logger: () -> untyped
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
class Domain
|
|
81
|
+
attr_reader parent: CDN
|
|
82
|
+
|
|
83
|
+
def initialize: (CDN parent) -> void
|
|
84
|
+
def all: () -> Array[OpenStruct]
|
|
85
|
+
def find: (Integer | String domain_id) -> OpenStruct?
|
|
86
|
+
def find_by: (Hash[Symbol, untyped] params) -> OpenStruct?
|
|
87
|
+
def create: (Hash[Symbol, untyped] payload) -> Integer?
|
|
88
|
+
def total_current_disk_usage: () -> Integer
|
|
89
|
+
|
|
90
|
+
private
|
|
91
|
+
|
|
92
|
+
def redis: () -> untyped
|
|
93
|
+
def logger: () -> untyped
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
class Business
|
|
97
|
+
attr_reader parent: CDN
|
|
98
|
+
|
|
99
|
+
def initialize: (CDN parent) -> void
|
|
100
|
+
def bandwidth: (Hash[Symbol, untyped] payload) -> Array[Hash[String, untyped]]
|
|
101
|
+
def bandwidth95th: (Hash[Symbol, Integer] params) -> Array[Hash[String, untyped]]
|
|
102
|
+
|
|
103
|
+
private
|
|
104
|
+
|
|
105
|
+
def logger: () -> untyped
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
class Certificate
|
|
109
|
+
attr_reader parent: CDN
|
|
110
|
+
|
|
111
|
+
def initialize: (CDN parent) -> void
|
|
112
|
+
def all: (?Hash[Symbol, untyped] params) -> Array[Hash[String, untyped]]
|
|
113
|
+
def auto_certificate_info: (Integer | String certificate_id, String name) -> Hash[String, untyped]?
|
|
114
|
+
def deploy_auto_certificate: (Integer | String certificate_id, String name, Hash[Symbol, untyped] payload) -> bool
|
|
115
|
+
|
|
116
|
+
private
|
|
117
|
+
|
|
118
|
+
def logger: () -> untyped
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# LMS service type signatures for Conversant gem
|
|
2
|
+
module Conversant
|
|
3
|
+
module V3
|
|
4
|
+
module Services
|
|
5
|
+
# LMS (Live Media Streaming) service
|
|
6
|
+
class LMS < ::Conversant::V3::Base
|
|
7
|
+
# Job management for streaming
|
|
8
|
+
class Job
|
|
9
|
+
attr_reader parent: LMS
|
|
10
|
+
|
|
11
|
+
def initialize: (LMS parent) -> void
|
|
12
|
+
def where: (**untyped params) -> Array[Hash[String, untyped]]
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
def parse_status: (Integer | String | nil status) -> String
|
|
17
|
+
def parse_timestamp: (Integer | String | nil timestamp) -> DateTime?
|
|
18
|
+
def extract_encoder: (Hash[String | Symbol, untyped] item) -> String
|
|
19
|
+
def stream_extension: (String? type) -> String
|
|
20
|
+
def build_profile_url: (Hash[String | Symbol, untyped]? inbound, Hash[String | Symbol, untyped] item, Hash[String | Symbol, untyped]? stream) -> String?
|
|
21
|
+
def build_manifest_url: (Hash[String | Symbol, untyped]? inbound, Hash[String | Symbol, untyped] item, Array[Hash[Symbol, untyped]]? profiles) -> String?
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Domain management for LMS
|
|
25
|
+
class Domain
|
|
26
|
+
attr_reader parent: LMS
|
|
27
|
+
|
|
28
|
+
def initialize: (LMS parent) -> void
|
|
29
|
+
def all: (?Hash[Symbol, untyped] params) -> Hash[Symbol, untyped]?
|
|
30
|
+
def show: (Integer | String domain_id) -> Hash[String, untyped]?
|
|
31
|
+
def create: (Hash[Symbol, untyped] payload) -> bool
|
|
32
|
+
def update: (Hash[Symbol, untyped] payload) -> bool
|
|
33
|
+
def delete: (Integer | String domain_id) -> bool
|
|
34
|
+
|
|
35
|
+
private
|
|
36
|
+
|
|
37
|
+
def logger: () -> untyped
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Dashboard metrics for LMS
|
|
41
|
+
class Dashboard
|
|
42
|
+
attr_reader parent: LMS
|
|
43
|
+
|
|
44
|
+
def initialize: (LMS parent) -> void
|
|
45
|
+
def live: () -> Hash[String, untyped]?
|
|
46
|
+
def vod: () -> Hash[String, untyped]?
|
|
47
|
+
def dvr: () -> Hash[String, untyped]?
|
|
48
|
+
def recent_jobs: () -> Array[Hash[Symbol, untyped]]
|
|
49
|
+
|
|
50
|
+
private
|
|
51
|
+
|
|
52
|
+
def parse_timestamp: (String? timestamp_text) -> Time?
|
|
53
|
+
def logger: () -> untyped
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Service accessors
|
|
57
|
+
def job: () -> Job
|
|
58
|
+
def domain: () -> Domain
|
|
59
|
+
def dashboard: () -> Dashboard
|
|
60
|
+
|
|
61
|
+
def partner_analytics: -> untyped
|
|
62
|
+
|
|
63
|
+
private
|
|
64
|
+
|
|
65
|
+
def fetch_new_session: () -> String?
|
|
66
|
+
def valid_sessions?: (Hash[Symbol, String]? sessions) -> bool
|
|
67
|
+
def request_jsessionid: (Hash[Symbol, String] sessions) -> untyped
|
|
68
|
+
def build_reporting_url: () -> String
|
|
69
|
+
def build_request_headers: (Hash[Symbol, String] sessions) -> Hash[String | Symbol, untyped]
|
|
70
|
+
def extract_and_cache_jsessionid: (untyped response) -> String?
|
|
71
|
+
def cache_jsessionid: (String jsessionid) -> void
|
|
72
|
+
def log_and_return_nil: (String message) -> nil
|
|
73
|
+
|
|
74
|
+
def service_endpoint: () -> String
|
|
75
|
+
def session_cookie_name: () -> String
|
|
76
|
+
def requires_session?: () -> bool
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Portal service type signatures for Conversant gem
|
|
2
|
+
module Conversant
|
|
3
|
+
module V3
|
|
4
|
+
module Services
|
|
5
|
+
# Portal service for appliance management
|
|
6
|
+
class Portal < ::Conversant::V3::Base
|
|
7
|
+
include Authorization
|
|
8
|
+
|
|
9
|
+
MASTER_APPLIANCE_REDIS_KEY: String
|
|
10
|
+
|
|
11
|
+
# Get appliances within date range
|
|
12
|
+
def appliances: (?String? gte, ?String? lte) -> Array[Hash[String, untyped]]
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
def fetch_new_session: () -> String
|
|
17
|
+
def service_endpoint: () -> String
|
|
18
|
+
def requires_session?: () -> bool
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# VMS service type signatures for Conversant gem
|
|
2
|
+
module Conversant
|
|
3
|
+
module V3
|
|
4
|
+
module Services
|
|
5
|
+
# VMS (Video Management System) service
|
|
6
|
+
class VMS < ::Conversant::V3::Base
|
|
7
|
+
# VOD Transcoding management
|
|
8
|
+
class VodTranscoding
|
|
9
|
+
attr_reader parent: VMS
|
|
10
|
+
|
|
11
|
+
def initialize: (VMS parent) -> void
|
|
12
|
+
def list: (Hash[Symbol, untyped] params) -> Array[Hash[String, untyped]]
|
|
13
|
+
def status: (String | Integer job_id) -> Hash[String, untyped]?
|
|
14
|
+
def create: (Hash[Symbol, untyped] payload) -> Integer?
|
|
15
|
+
def presets: (?Hash[Symbol, untyped] payload) -> Array[Hash[String, untyped]]
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def logger: () -> untyped
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Analytics for VMS
|
|
23
|
+
class Analytics
|
|
24
|
+
attr_reader parent: VMS
|
|
25
|
+
|
|
26
|
+
def initialize: (VMS parent) -> void
|
|
27
|
+
def transcoding: (Hash[Symbol, untyped] payload) -> Array[untyped]
|
|
28
|
+
def volume: (Hash[Symbol, untyped] payload) -> Array[untyped]
|
|
29
|
+
|
|
30
|
+
private
|
|
31
|
+
|
|
32
|
+
def logger: () -> untyped
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Business metrics for VMS
|
|
36
|
+
class Business
|
|
37
|
+
attr_reader parent: VMS
|
|
38
|
+
|
|
39
|
+
def initialize: (VMS parent) -> void
|
|
40
|
+
def duration: (Hash[Symbol, untyped] payload) -> Array[Hash[String, untyped]]
|
|
41
|
+
def volume: (Hash[Symbol, untyped] payload) -> Array[Hash[String, untyped]]
|
|
42
|
+
def transcoding: (Hash[Symbol, untyped] payload) -> Hash[Symbol, Float]
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
|
|
46
|
+
def extract_month: (Hash[Symbol, untyped] payload) -> String
|
|
47
|
+
def logger: () -> untyped
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Service accessors
|
|
51
|
+
def vod_transcoding: () -> VodTranscoding
|
|
52
|
+
def analytics: () -> Analytics
|
|
53
|
+
def business: () -> Business
|
|
54
|
+
|
|
55
|
+
private
|
|
56
|
+
|
|
57
|
+
def fetch_new_session: () -> String?
|
|
58
|
+
def service_endpoint: () -> String
|
|
59
|
+
def session_cookie_name: () -> String
|
|
60
|
+
def requires_session?: () -> bool
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# V3 module type signatures
|
|
2
|
+
module Conversant
|
|
3
|
+
module V3
|
|
4
|
+
def self.portal: (Integer customer_id, ?Integer type) -> Services::Portal
|
|
5
|
+
def self.cdn: (Integer customer_id, ?Integer type) -> Services::CDN
|
|
6
|
+
def self.lms: (Integer customer_id, ?Integer type) -> Services::LMS
|
|
7
|
+
def self.vms: (Integer customer_id, ?Integer type) -> Services::VMS
|
|
8
|
+
def self.oss: (Integer customer_id, ?Integer type) -> Services::OSS
|
|
9
|
+
|
|
10
|
+
# Base class for all V3 services
|
|
11
|
+
class Base
|
|
12
|
+
include HttpClient
|
|
13
|
+
|
|
14
|
+
attr_reader customer_id: Integer
|
|
15
|
+
attr_reader type: Integer
|
|
16
|
+
|
|
17
|
+
def initialize: (Integer customer_id, ?Integer type) -> void
|
|
18
|
+
|
|
19
|
+
protected
|
|
20
|
+
|
|
21
|
+
def validate_configuration!: () -> void
|
|
22
|
+
def configuration: () -> Conversant::Configuration
|
|
23
|
+
def redis: () -> untyped
|
|
24
|
+
def portal_endpoint: () -> String
|
|
25
|
+
def sso_endpoint: () -> String
|
|
26
|
+
def identifier: () -> String
|
|
27
|
+
def logger: () -> untyped
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# HTTP client module
|
|
31
|
+
module HttpClient
|
|
32
|
+
LOGIN_URL: String
|
|
33
|
+
PORTAL_SESSION_REDIS_KEY: String
|
|
34
|
+
SSO_GW_SESSION2_REDIS_KEY: String
|
|
35
|
+
|
|
36
|
+
def cookie_jar: () -> Hash[String, String]
|
|
37
|
+
def cookie_jar=: (Hash[String, String]? value) -> Hash[String, String]?
|
|
38
|
+
def debug_log: (String message) -> void
|
|
39
|
+
def sso_login: () -> Hash[Symbol, String]?
|
|
40
|
+
def authenticate: () -> Hash[Symbol, String]?
|
|
41
|
+
def request: (Symbol method, String url, untyped payload, Hash[String, String] headers) -> [Integer, untyped]
|
|
42
|
+
|
|
43
|
+
private
|
|
44
|
+
|
|
45
|
+
def http_get: (String url) -> Hash[Symbol, untyped]?
|
|
46
|
+
def http_post: (String url, String payload, Hash[String, String] extra_headers) -> Hash[Symbol, untyped]?
|
|
47
|
+
def add_cookies_to_headers: (Hash[String, String] headers) -> Hash[String, String]
|
|
48
|
+
def update_cookie_jar: (untyped response) -> void
|
|
49
|
+
def parse_cookie_to_jar: (String cookie_string) -> void
|
|
50
|
+
def extract_form_action: (String html_body) -> String?
|
|
51
|
+
def configuration: () -> Conversant::Configuration
|
|
52
|
+
def redis: () -> untyped
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Authentication mixin
|
|
56
|
+
module Mixins
|
|
57
|
+
module Authentication
|
|
58
|
+
def self.included: (untyped base) -> void
|
|
59
|
+
|
|
60
|
+
module ClassMethods
|
|
61
|
+
def use_conversant_auth!: () -> void
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
attr_reader customer_id: Integer
|
|
65
|
+
attr_reader type: Integer
|
|
66
|
+
|
|
67
|
+
def initialize_conversant_auth: (Integer customer_id, ?Integer type) -> void
|
|
68
|
+
def conversant_authenticate: () -> Hash[Symbol, String]?
|
|
69
|
+
def portal_authorized_headers: () -> Hash[String, String]
|
|
70
|
+
def cdn_authorized_headers: () -> Hash[String, String]
|
|
71
|
+
def lms_authorized_headers: () -> Hash[String, String]
|
|
72
|
+
def vms_authorized_headers: () -> Hash[String, String]
|
|
73
|
+
|
|
74
|
+
private
|
|
75
|
+
|
|
76
|
+
def portal_service: () -> Services::Portal
|
|
77
|
+
def cdn_service: () -> Services::CDN
|
|
78
|
+
def lms_service: () -> Services::LMS
|
|
79
|
+
def vms_service: () -> Services::VMS
|
|
80
|
+
def configuration: () -> Conversant::Configuration
|
|
81
|
+
def redis: () -> untyped
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
data/sig/conversant.rbs
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Main Conversant module type signatures
|
|
2
|
+
module Conversant
|
|
3
|
+
VERSION: String
|
|
4
|
+
|
|
5
|
+
def self.configuration: () -> Configuration
|
|
6
|
+
def self.configure: () { (Configuration) -> void } -> void
|
|
7
|
+
|
|
8
|
+
class Configuration
|
|
9
|
+
attr_accessor portal_endpoint: String
|
|
10
|
+
attr_accessor private_cdn_endpoint: String
|
|
11
|
+
attr_accessor private_lms_endpoint: String
|
|
12
|
+
attr_accessor private_vms_endpoint: String
|
|
13
|
+
attr_accessor private_oss_endpoint: String
|
|
14
|
+
attr_accessor redis: untyped
|
|
15
|
+
attr_accessor default_ua: String
|
|
16
|
+
attr_accessor default_content_type: String
|
|
17
|
+
attr_accessor cache_ttl: Integer
|
|
18
|
+
attr_accessor enable_logging: bool
|
|
19
|
+
attr_accessor log_level: Symbol
|
|
20
|
+
|
|
21
|
+
def initialize: () -> void
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
class Error < StandardError
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
class AuthenticationError < Error
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
module V3
|
|
31
|
+
def self.cdn: (Integer customer_id, ?Integer type) -> Services::CDN
|
|
32
|
+
def self.lms: (Integer customer_id, ?Integer type) -> Services::LMS
|
|
33
|
+
def self.vms: (Integer customer_id, ?Integer type) -> Services::VMS
|
|
34
|
+
def self.portal: (Integer customer_id, ?Integer type) -> Services::Portal
|
|
35
|
+
def self.oss: (Integer customer_id, ?Integer type) -> Services::OSS
|
|
36
|
+
end
|
|
37
|
+
end
|