Sha256: de00bce5e3831f63317a1a4caea540143959686d4616dee2768b50316a497cfd

Contents?: true

Size: 1.85 KB

Versions: 1

Compression:

Stored size: 1.85 KB

Contents

# frozen_string_literal: true

#--
# gravaty
# rubocop:disable Style/AsciiComments
# © 2013 Marco Bresciani
# rubocop:enable Style/AsciiComments
#
# This file is part of gravaty.
#
# gravaty is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# gravaty is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with gravaty. If not, see <http://www.gnu.org/licenses/>.
#
# SPDX-FileCopyrightText: 2013 Marco Bresciani
#
# SPDX-License-Identifier: GPL-3.0-or-later
#++

require_relative '../lib/gravaty'
require 'open-uri'

def internet_connection?
  true if URI.open('http://secure.gravatar.com')
rescue StandardError
  false
end

i = 0

# Creates the Gravaty object with an (example) email
puts '=========================================='
puts "XML-RPC '#{i}': Creates the Gravaty object with an (example) email."
puts "irb(main):001:0> a_gravaty = Gravaty::gravatize 'user@example.com'"
a_gravaty = Gravaty.gravatize 'user@example.com'
puts '------------------------------------------'
puts
i += 1

# Calls the test method of the XML-RPC API
puts '=========================================='
puts "XML-RPC '#{i}': Calls the test method of the XML-RPC API with password 'password'."
puts 'irb(main):001:0> a_gravaty.xmlrpc Gravaty::RPC_TEST_METHOD'
a_gravaty.xmlrpc Gravaty::RPC_TEST_METHOD, 'password' if internet_connection? && !ENV['SSL_CERT_FILE'].nil?
puts '------------------------------------------'
puts

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gravaty-11.0.1 examples/xmlrpc.rb