gravaty 10.0.0 → 11.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +7 -0
  3. data/Gemfile +5 -1
  4. data/README.md +219 -212
  5. data/Rakefile +9 -3
  6. data/copyright.md +33 -136
  7. data/examples/avatar.rb +70 -43
  8. data/examples/basics.rb +30 -20
  9. data/examples/profile.rb +77 -50
  10. data/examples/xmlrpc.rb +24 -10
  11. data/gravaty.gemspec +46 -25
  12. data/html/CHANGELOG.html +13 -20
  13. data/html/COPYING_md.html +8 -24
  14. data/html/Gemfile.html +7 -21
  15. data/html/Gravaty.html +49 -113
  16. data/html/Gravaty/Gravaty.html +138 -343
  17. data/html/Gravaty/ParsableDuckType.html +14 -33
  18. data/html/Gravaty/Parser.html +27 -66
  19. data/html/Gravaty/Parsers.html +3 -11
  20. data/html/Gravaty/Parsers/Avatar.html +19 -36
  21. data/html/Gravaty/Parsers/Callback.html +21 -37
  22. data/html/Gravaty/Parsers/Default.html +28 -45
  23. data/html/Gravaty/Parsers/Force.html +21 -37
  24. data/html/Gravaty/Parsers/Format.html +22 -42
  25. data/html/Gravaty/Parsers/Pixelsize.html +22 -42
  26. data/html/Gravaty/Parsers/Rating.html +22 -42
  27. data/html/Gravaty/Parsers/Secure.html +19 -36
  28. data/html/Gravaty/Parsers/Type.html +22 -42
  29. data/html/Gravaty/Utils.html +11 -13
  30. data/html/Gravaty/Utils/Downloader.html +3 -11
  31. data/html/Gravaty/Utils/Downloader/Downloader.html +25 -59
  32. data/html/Gravaty/Utils/Raisers.html +24 -55
  33. data/html/Gravaty/Utils/Rfc5322.html +12 -19
  34. data/html/Gravaty/Utils/RpcConnector.html +11 -13
  35. data/html/Gravaty/Utils/RpcConnector/RpcConnector.html +33 -73
  36. data/html/Object.html +728 -57
  37. data/html/README_md.html +105 -100
  38. data/html/Rakefile.html +9 -23
  39. data/html/copyright_md.html +17 -119
  40. data/html/created.rid +48 -55
  41. data/html/css/rdoc.css +1 -1
  42. data/html/index.html +97 -114
  43. data/html/js/navigation.js.gz +0 -0
  44. data/html/js/search_index.js +1 -1
  45. data/html/js/search_index.js.gz +0 -0
  46. data/html/js/searcher.js.gz +0 -0
  47. data/html/table_of_contents.html +219 -651
  48. data/lib/gravaty.rb +22 -15
  49. data/lib/gravaty/application.rb +40 -25
  50. data/lib/gravaty/constants.rb +20 -11
  51. data/lib/gravaty/locales/en.yml +9 -3
  52. data/lib/gravaty/locales/it.yml +9 -3
  53. data/lib/gravaty/locales/ja.yml +7 -4
  54. data/lib/gravaty/parser.rb +16 -10
  55. data/lib/gravaty/parsers/avatar.rb +11 -3
  56. data/lib/gravaty/parsers/callback.rb +13 -4
  57. data/lib/gravaty/parsers/default.rb +24 -16
  58. data/lib/gravaty/parsers/force.rb +12 -2
  59. data/lib/gravaty/parsers/format.rb +11 -2
  60. data/lib/gravaty/parsers/pixelsize.rb +12 -3
  61. data/lib/gravaty/parsers/rating.rb +12 -3
  62. data/lib/gravaty/parsers/secure.rb +11 -2
  63. data/lib/gravaty/parsers/type.rb +11 -2
  64. data/lib/gravaty/utils/downloader.rb +98 -96
  65. data/lib/gravaty/utils/raisers.rb +19 -12
  66. data/lib/gravaty/utils/rfc5322.rb +54 -41
  67. data/lib/gravaty/utils/rpc_connector.rb +19 -11
  68. data/lib/gravaty/version.rb +10 -2
  69. data/test/gravaty/locales/en.yml +29 -0
  70. data/test/gravaty/locales/it.yml +29 -0
  71. data/test/gravaty/locales/ja.yml +27 -0
  72. data/test/gravaty/locales/test_locales.rb +17 -13
  73. data/test/gravaty/parsers/test_avatar.rb +9 -1
  74. data/test/gravaty/parsers/test_callback.rb +12 -4
  75. data/test/gravaty/parsers/test_default.rb +25 -21
  76. data/test/gravaty/parsers/test_force.rb +9 -1
  77. data/test/gravaty/parsers/test_format.rb +18 -11
  78. data/test/gravaty/parsers/test_pixelsize.rb +19 -12
  79. data/test/gravaty/parsers/test_rating.rb +18 -11
  80. data/test/gravaty/parsers/test_secure.rb +9 -1
  81. data/test/gravaty/parsers/test_type.rb +14 -5
  82. data/test/gravaty/test_application.rb +14 -6
  83. data/test/gravaty/test_avatar.rb +94 -59
  84. data/test/gravaty/test_parser.rb +11 -5
  85. data/test/gravaty/test_profile.rb +47 -25
  86. data/test/gravaty/utils/test_downloader.rb +43 -28
  87. data/test/gravaty/utils/test_raisers.rb +42 -26
  88. data/test/gravaty/utils/test_rfc5322.rb +35 -13
  89. data/test/gravaty/utils/test_rpc_connector.rb +83 -39
  90. data/test/test_gravaty.rb +12 -4
  91. data/test/test_helper.rb +15 -9
  92. metadata +54 -40
  93. data/ISSUES.md +0 -62
  94. data/acknowledgements.md +0 -66
  95. data/authors.md +0 -63
  96. data/examples/cacert.pem +0 -3466
  97. data/html/ISSUES_md.html +0 -166
  98. data/html/acknowledgements_md.html +0 -161
  99. data/html/authors_md.html +0 -174
  100. data/html/examples/cacert_pem.html +0 -1078
data/Rakefile CHANGED
@@ -1,5 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ #--
1
4
  # gravaty
2
- # Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 201, 20209 Marco Bresciani
5
+ # rubocop:disable Style/AsciiComments
6
+ # © 2013 Marco Bresciani
7
+ # rubocop:enable Style/AsciiComments
3
8
  #
4
9
  # This file is part of gravaty.
5
10
  #
@@ -15,6 +20,7 @@
15
20
  #
16
21
  # You should have received a copy of the GNU General Public License
17
22
  # along with gravaty. If not, see <http://www.gnu.org/licenses/>.
23
+ #++
18
24
 
19
25
  require 'rake'
20
26
  require 'rake/clean'
@@ -38,9 +44,9 @@ end
38
44
  desc "Build the RDoc gem documentation (task 'rake rdoc')"
39
45
  Rake::RDocTask.new do |rdoc|
40
46
  rdoc.rdoc_files.add gravaty.files
41
- rdoc.title = gravaty.name + ' ' + gravaty.version.to_s
47
+ rdoc.title = "#{gravaty.name} #{gravaty.version}"
42
48
  rdoc.main = 'README.md'
43
- rdoc.options += %w(-e UTF-8 --hyperlink-all --line-numbers)
49
+ rdoc.options += %w[-e UTF-8 --hyperlink-all --line-numbers]
44
50
  end
45
51
 
46
52
  desc "Run the gem unit tests (task 'rake test')"
data/copyright.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  gravaty
3
3
 
4
- Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Marco Bresciani
4
+ © 2013 Marco Bresciani
5
5
 
6
6
  This file is part of gravaty.
7
7
 
@@ -17,14 +17,18 @@ more details.
17
17
 
18
18
  You should have received a copy of the GNU General Public License along
19
19
  with gravaty. If not, see <http://www.gnu.org/licenses/>.
20
+
21
+ SPDX-FileCopyrightText: 2013 Marco Bresciani
22
+
23
+ SPDX-License-Identifier: FSFAP
20
24
  -->
21
25
 
22
26
  # Copyright Notes
23
- 2020-03-09 update.
27
+ 2020-11-30 update.
24
28
 
25
29
  gravaty
26
30
 
27
- Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Marco Bresciani
31
+ © 2013 Marco Bresciani
28
32
 
29
33
  This file is part of gravaty.
30
34
 
@@ -41,20 +45,20 @@ more details.
41
45
  You should have received a copy of the GNU General Public License along
42
46
  with gravaty. If not, see <http://www.gnu.org/licenses/>.
43
47
 
44
- All project files, except for those listed in whole RDoc section below
45
- are released according to the above notice. The contributed code by
46
- Peter R. Marreck and Jon Maken are released according to their own
47
- licenses, specified inside the source code and checked being compatible
48
- with GNU GPLv3 license and the free software philosophy.
49
-
48
+ All project files, except for those listed in whole [RDoc](#rdoc)
49
+ section below, are released according to the above notice.
50
+ The contributed code by Peter R. Marreck and Jon Maken are released
51
+ according to their own licenses, specified inside the source code and
52
+ checked being compatible with GNU GPLv3 license and the free software
53
+ philosophy.
50
54
 
51
55
  ## RDoc
52
- Documents in the html directory are automatically generated by Ruby RDoc
53
- tool, with Markdown syntax. Automatically included files have the
54
- following licenses:
56
+ Ruby RDoc tool automatically generated documents in the `html` directory
57
+ using Markdown syntax.
58
+ Automatically included files have the following licenses:
55
59
 
56
60
  ### Darkfish (darkfish.js & rdoc.css)
57
- See <http://www.ruby-doc.org/stdlib-2.0/libdoc/rdoc/rdoc/RDoc/Generator/Darkfish.html>
61
+ See http://www.ruby-doc.org/stdlib-2.0/libdoc/rdoc/rdoc/RDoc/Generator/Darkfish.html
58
62
 
59
63
  Copyright © 2007, 2008, Michael Granger. All rights reserved.
60
64
 
@@ -62,16 +66,16 @@ Redistribution and use in source and binary forms, with or without
62
66
  modification, are permitted provided that the following conditions are
63
67
  met:
64
68
 
65
- Redistributions of source code must retain the above copyright
66
- notice, this list of conditions and the following disclaimer.
69
+ Redistributions of source code must retain the above copyright notice,
70
+ this list of conditions and the following disclaimer.
67
71
 
68
- Redistributions in binary form must reproduce the above copyright
69
- notice, this list of conditions and the following disclaimer in the
70
- documentation and/or other materials provided with the distribution.
72
+ Redistributions in binary form must reproduce the above copyright
73
+ notice, this list of conditions and the following disclaimer in the
74
+ documentation and/or other materials provided with the distribution.
71
75
 
72
- Neither the name of the author/s, nor the names of the project's
73
- contributors may be used to endorse or promote products derived from
74
- this software without specific prior written permission.
76
+ Neither the name of the author/s, nor the names of the project's
77
+ contributors may be used to endorse or promote products derived from
78
+ this software without specific prior written permission.
75
79
 
76
80
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
77
81
  IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -88,16 +92,16 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
88
92
  Darkfish uses the Silk Icons set by Mark James.
89
93
 
90
94
  ### Sorce Code Pro Font (& fonts.css)
91
- Copyright 2010, 2012 Adobe Systems Incorporated
92
- (<http://www.adobe.com/>), with Reserved Font Name "Source". All Rights
93
- Reserved. Source is a trademark of Adobe Systems Incorporated in the
94
- United States and/or other countries.
95
+ Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/),
96
+ with Reserved Font Name "Source". All Rights Reserved. Source is a
97
+ trademark of Adobe Systems Incorporated in the United States and/or
98
+ other countries.
95
99
 
96
100
  This Font Software is licensed under the SIL Open Font License, Version
97
101
  1.1.
98
102
 
99
103
  This license is copied below, and is also available with a FAQ at:
100
- <http://scripts.sil.org/OFL>
104
+ http://scripts.sil.org/OFL
101
105
 
102
106
  /*
103
107
  * -----------------------------------------------------------
@@ -202,7 +206,7 @@ This Font Software is licensed under the SIL Open Font License, Version
202
206
  1.1.
203
207
 
204
208
  This license is copied below, and is also available with a FAQ at:
205
- <http://scripts.sil.org/OFL>
209
+ http://scripts.sil.org/OFL
206
210
 
207
211
  /*
208
212
  * -----------------------------------------------------------
@@ -315,26 +319,8 @@ set contents within a readme file or equivalent documentation for the
315
319
  software which includes the set or a subset of the icons contained
316
320
  within.
317
321
 
318
- ### jquery.js
319
- jQuery JavaScript Library v1.6.2. See <http://jquery.com/>
320
-
321
- Copyright 2011, John Resig
322
- Dual licensed under the MIT or GPL Version 2 licenses.
323
- <http://jquery.org/license>
324
-
325
- #### Sizzle.js
326
- Includes Sizzle.js
327
- <http://sizzlejs.com/>
328
- Copyright 2011, The Dojo Foundation
329
- Released under the MIT, BSD, and GPL Licenses.
330
-
331
322
  ### JsonIndex generator (navigation.js & search.js & search_index.js & searcher.js)
332
- See
333
- <http://www.ruby-doc.org/stdlib-2.0/libdoc/rdoc/rdoc/RDoc/Generator/JsonIndex.html>
334
-
335
- The JsonIndex generator is designed to complement an HTML generator and
336
- produces a JSON search index. This generator is derived from sdoc by
337
- Vladimir Kolesnikov and contains verbatim code written by him.
323
+ See http://www.ruby-doc.org/stdlib-2.0/libdoc/rdoc/rdoc/RDoc/Generator/JsonIndex.html
338
324
 
339
325
  Copyright © 2009 Vladimir Kolesnikov
340
326
 
@@ -357,100 +343,11 @@ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
357
343
  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
358
344
  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
359
345
 
360
- ## root.crt
361
- The root.crt root certificate by CAcert.org is release under the Root
362
- Distribution License (see
363
- <http://www.cacert.org/policy/RootDistributionLicense.php>).
364
-
365
- * Name: RDL
366
- [COD14](https://svn.cacert.org/CAcert/Policies/ControlledDocumentList.html)
367
- * Status: DRAFT
368
- [p20100710](https://wiki.cacert.org/PolicyDecisions#p20100710)
369
- * Editor: Mark Lipscombe
370
-
371
- RDL Status - DRAFT
372
-
373
- ### Root Distribution License
374
- #### Terms
375
- * "CAcert Inc" means CAcert Incorporated, a non-profit association
376
- incorporated in New South Wales, Australia.
377
- * "CAcert Community Agreement" means the agreement entered into by each
378
- person wishing to RELY.
379
- * "Member" means a natural or legal person who has agreed to the CAcert
380
- Community Agreement.
381
- * "Certificate" means any certificate or like device to which CAcert
382
- Inc's digital signature has been affixed.
383
- * "CAcert Root Certificates" means any certificate issued by CAcert Inc
384
- to itself for the purposes of signing further CAcert Roots or for
385
- signing certificates of Members.
386
- * "RELY" means the human act in taking on a risk or liability on the
387
- basis of the claim(s) bound within a certificate issued by CAcert.
388
- * "Embedded" means a certificate that is contained within a software
389
- application or hardware system, when and only when, that software
390
- application or system is distributed in binary form only.
391
-
392
- #### Copyright
393
- CAcert Root Certificates are Copyright CAcert Incorporated. All rights
394
- reserved.
395
-
396
- #### License
397
- You may copy and distribute CAcert Root Certificates only in accordance
398
- with this license.
399
-
400
- CAcert Inc grants you a free, non-exclusive license to copy and
401
- distribute CAcert Root Certificates in any medium, with or without
402
- modification, provided that the following conditions are met:
403
-
404
- * Redistributions of Embedded CAcert Root Certificates must take
405
- reasonable steps to inform the recipient of the disclaimer in section
406
- 4 or reproduce this license and copyright notice in full in the
407
- documentation provided with the distribution.
408
- * Redistributions in all other forms must reproduce this license and
409
- copyright notice in full.
410
-
411
- #### Disclaimer
412
- THE CACERT ROOT CERTIFICATES ARE PROVIDED "AS IS" AND ANY EXPRESS OR
413
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
414
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
415
- DISCLAIMED TO THE MAXIMUM EXTENT PERMITTED BY LAW. IN NO EVENT SHALL
416
- CACERT INC, ITS MEMBERS, AGENTS, SUBSIDIARIES OR RELATED PARTIES BE
417
- LIABLE TO THE LICENSEE OR ANY THIRD PARTY FOR ANY DIRECT, INDIRECT,
418
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
419
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
420
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
421
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
422
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
423
- THESE CERTIFICATES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
424
- IN ANY EVENT, CACERT'S LIABILITY SHALL NOT EXCEED $1,000.00 AUSTRALIAN
425
- DOLLARS.
426
-
427
- THIS LICENSE SPECIFICALLY DOES NOT PERMIT YOU TO RELY UPON ANY
428
- CERTIFICATES ISSUED BY CACERT INC. IF YOU WISH TO RELY ON CERTIFICATES
429
- ISSUED BY CACERT INC, YOU MUST ENTER INTO A SEPARATE AGREEMENT WITH
430
- CACERT INC.
431
-
432
- #### Statutory Rights
433
- Nothing in this license affects any statutory rights that cannot be
434
- waived or limited by contract. In the event that any provision of this
435
- license is held to be invalid or unenforceable, the remaining provisions
436
- of this license remain in full force and effect.
437
-
438
- ### Alternatives
439
- If you find the terms of the above Root Distribution License difficult
440
- or inadequate for your purposes, you may wish to:
441
- * Enter into the CAcert Community Agreement by [registering as a
442
- Member](https://www.cacert.org/index.php?id=1). This is free.
443
- * Delete CAcert Root Certificates from your software. Your software
444
- documentation should give directions and assistance for this.
445
-
446
- These alternatives are outside the above Root Distribution License and
447
- do not incorporate.
448
-
449
346
  ------------------------------------------
450
347
 
451
348
  gravaty
452
349
 
453
- Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Marco Bresciani
350
+ © 2013 Marco Bresciani
454
351
 
455
352
  This file is part of gravaty.
456
353
 
data/examples/avatar.rb CHANGED
@@ -1,6 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #--
2
4
  # gravaty
3
- # Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Marco Bresciani
5
+ # rubocop:disable Style/AsciiComments
6
+ # © 2013 Marco Bresciani
7
+ # rubocop:enable Style/AsciiComments
4
8
  #
5
9
  # This file is part of gravaty.
6
10
  #
@@ -16,144 +20,167 @@
16
20
  #
17
21
  # You should have received a copy of the GNU General Public License
18
22
  # along with gravaty. If not, see <http://www.gnu.org/licenses/>.
23
+ #
24
+ # SPDX-FileCopyrightText: 2013 Marco Bresciani
25
+ #
26
+ # SPDX-License-Identifier: GPL-3.0-or-later
19
27
  #++
20
28
 
21
29
  require_relative '../lib/gravaty'
30
+ require 'open-uri'
22
31
 
23
32
  i = 0
24
33
 
34
+ def internet_connection?
35
+ true if URI.open('http://secure.gravatar.com')
36
+ rescue StandardError
37
+ false
38
+ end
39
+
25
40
  # Creates the Gravaty object with an (example) email
26
- puts "------------------------------------------"
27
- puts "Avatar: '#{i}'. Creates the Gravaty object with an (example) email."
28
- puts "------------------------------------------"
41
+ puts '=========================================='
42
+ puts "AVATAR '#{i}': Creates the Gravaty object with an (example) email."
29
43
  puts "irb(main):001:0> a_gravaty = Gravaty::gravatize 'user@example.com'"
30
- a_gravaty = Gravaty::gravatize 'user@example.com'
44
+ a_gravaty = Gravaty.gravatize 'user@example.com'
45
+ puts '------------------------------------------'
31
46
  puts
32
47
  i += 1
33
48
 
34
49
  # Prints the secure URL for avatar retrieval, with no frills
35
50
  # (https://secure.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af)
36
- puts "------------------------------------------"
37
- puts "Avatar: '#{i}'. Prints the secure URL for avatar retrieval, with no frills (https://secure.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af)."
38
- puts "------------------------------------------"
51
+ puts '=========================================='
52
+ puts "AVATAR '#{i}': Prints the secure URL for avatar retrieval, with no frills (https://secure.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af)."
39
53
  puts 'irb(main):001:0> a_gravaty.avatar'
40
54
  puts a_gravaty.avatar
55
+ puts '------------------------------------------'
41
56
  puts
42
57
  i += 1
43
58
 
44
59
  # Prints the basic URL for avatar retrieval, with no frills
45
60
  # (http://www.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af)
46
- puts "------------------------------------------"
47
- puts "Avatar: '#{i}'. Prints the basic URL for avatar retrieval, with no frills (http://www.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af)."
48
- puts "------------------------------------------"
61
+ puts '=========================================='
62
+ puts "AVATAR '#{i}': Prints the basic URL for avatar retrieval, with no frills (http://www.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af)."
49
63
  puts 'irb(main):001:0> a_gravaty.avatar secure: false'
50
64
  puts a_gravaty.avatar secure: false
65
+ puts '------------------------------------------'
51
66
  puts
52
67
  i += 1
53
68
 
54
69
  # Prints the secure URL for avatar retrieval, with specified image file
55
70
  # extension
56
71
  # (https://secure.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.jpg)
57
- puts "------------------------------------------"
58
- puts "Avatar: '#{i}'. Prints the secure URL for avatar retrieval, with specified image file extension (https://secure.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.jpg)."
59
- puts "------------------------------------------"
72
+ puts '=========================================='
73
+ puts "AVATAR '#{i}': Prints the secure URL for avatar retrieval, with specified image file extension (https://secure.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.jpg)."
60
74
  puts "irb(main):001:0> a_gravaty.avatar type: 'JPG'"
61
75
  puts a_gravaty.avatar type: 'JPG'
76
+ puts '------------------------------------------'
62
77
  puts
63
78
  i += 1
64
79
 
65
80
  # Retrieves the latest saved operation (email address, if none saved)
66
81
  # (user@example.com)
67
- puts "------------------------------------------"
68
- puts "Avatar: '#{i}'. Retrieves the latest saved operation (email address, if none saved) (user@example.com)."
69
- puts "------------------------------------------"
82
+ puts '=========================================='
83
+ puts "AVATAR '#{i}': Retrieves the latest saved operation (email address, if none saved) (user@example.com)."
70
84
  puts 'irb(main):001:0> puts a_gravaty'
71
85
  puts a_gravaty
86
+ puts '------------------------------------------'
72
87
  puts
73
88
  i += 1
74
89
 
75
90
  # Prints and saves the secure URL for avatar and later retrieval, with
76
91
  # specified image file extension
77
92
  # (https://secure.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.jpg)
78
- puts "------------------------------------------"
79
- puts "Avatar: '#{i}'. Prints and saves the secure URL for avatar and later retrieval, with specified image file extension (https://secure.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.jpg)."
80
- puts "------------------------------------------"
93
+ puts '=========================================='
94
+ # rubocop:disable Layout/LineLength
95
+ puts "AVATAR '#{i}': Prints and saves the secure URL for avatar and later retrieval, with specified image file extension (https://secure.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.jpg)."
96
+ # rubocop:enable Layout/LineLength
81
97
  puts "irb(main):001:0> a_gravaty.avatar! type: 'JPG'"
82
98
  puts a_gravaty.avatar! type: 'JPG'
99
+ puts '------------------------------------------'
83
100
  puts
84
101
  i += 1
85
102
 
86
103
  # Prints the basic URL for avatar retrieval, with specified image file
87
104
  # extension
88
105
  # (http://www.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.gif)
89
- puts "------------------------------------------"
90
- puts "Avatar: '#{i}'. Prints the basic URL for avatar retrieval, with specified image file extension (http://www.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.gif)."
91
- puts "------------------------------------------"
106
+ puts '=========================================='
107
+ puts "AVATAR '#{i}': Prints the basic URL for avatar retrieval, with specified image file extension (http://www.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.gif)."
92
108
  puts "irb(main):001:0> a_gravaty.avatar type: 'GIF', secure: false"
93
109
  puts a_gravaty.avatar type: 'GIF', secure: false
110
+ puts '------------------------------------------'
94
111
  puts
95
112
  i += 1
96
113
 
97
114
  # Retrieves and prints the latest saved operation
98
115
  # (https://secure.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.jpg)
99
- puts "------------------------------------------"
100
- puts "Avatar: '#{i}'. Retrieves and prints the latest saved operation. (https://secure.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.jpg)"
101
- puts "------------------------------------------"
116
+ puts '=========================================='
117
+ puts "AVATAR '#{i}': Retrieves and prints the latest saved operation. (https://secure.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.jpg)"
102
118
  puts 'irb(main):001:0> puts a_gravaty'
103
119
  puts a_gravaty
120
+ puts '------------------------------------------'
104
121
  puts
105
122
  i += 1
106
123
 
107
124
  # Prints the basic URL for avatar retrieval, with specified image size
108
125
  # (in pixels) and specified image file extension
109
126
  # (http://www.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.png?s=42)
110
- puts "------------------------------------------"
111
- puts "Avatar: '#{i}'. Prints the basic URL for avatar retrieval, with specified image size (in pixels) and specified image file extension (http://www.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.png?s=42)."
112
- puts "------------------------------------------"
127
+ puts '=========================================='
128
+ # rubocop:disable Layout/LineLength
129
+ puts "AVATAR '#{i}': Prints the basic URL for avatar retrieval, with specified image size (in pixels) and specified image file extension (http://www.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.png?s=42)."
130
+ # rubocop:enable Layout/LineLength
113
131
  puts "irb(main):001:0> a_gravaty.avatar type: 'png', pixelsize: 42, secure: false"
114
132
  puts a_gravaty.avatar type: 'png', pixelsize: 42, secure: false
133
+ puts '------------------------------------------'
115
134
  puts
116
135
  i += 1
117
136
 
118
137
  # Prints and saves the basic URL for avatar retrieval, with specified
119
138
  # image size (in pixels), specified image file extension and type
120
139
  # (http://www.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.png?s=42&d=monsterid)
121
- puts "------------------------------------------"
122
- puts "Avatar: '#{i}'. Prints and saves the basic URL for avatar retrieval, with specified image size (in pixels), specified image file extension and type (http://www.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.png?s=42&d=robohash)."
123
- puts "------------------------------------------"
140
+ puts '=========================================='
141
+ # rubocop:disable Layout/LineLength
142
+ puts "AVATAR '#{i}': Prints and saves the basic URL for avatar retrieval, with specified image size (in pixels), specified image file extension and type (http://www.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.png?s=42&d=robohash)."
143
+ # rubocop:enable Layout/LineLength
124
144
  puts "irb(main):001:0> a_gravaty.avatar! type: 'png', default: 'robohash', pixelsize: 42, secure: false"
125
145
  puts a_gravaty.avatar! type: 'png', default: 'robohash', pixelsize: 42, secure: false
146
+ puts '------------------------------------------'
126
147
  puts
127
148
  i += 1
128
149
 
129
150
  # Downloads the previously saved gravaty configuration with the default
130
151
  # name of the file according to saved URI
131
152
  # (saves b58996c504c5638798eb6b511e6f49af.png file)
132
- puts "------------------------------------------"
133
- puts "Avatar: '#{i}'. Downloads the previously saved gravaty configuration with the default name of the file according to saved URI. (saves b58996c504c5638798eb6b511e6f49af.png file)"
134
- puts "------------------------------------------"
153
+ puts '=========================================='
154
+ # rubocop:disable Layout/LineLength
155
+ puts "AVATAR '#{i}': Downloads the previously saved gravaty configuration with the default name of the file according to saved URI. (saves b58996c504c5638798eb6b511e6f49af.png file)"
156
+ # rubocop:enable Layout/LineLength
135
157
  puts 'irb(main):001:0> a_gravaty.download'
136
- a_gravaty.download
158
+ a_gravaty.download if internet_connection? && !ENV['SSL_CERT_FILE'].nil?
159
+ File.delete('b58996c504c5638798eb6b511e6f49af.png') if File.exist?('b58996c504c5638798eb6b511e6f49af.png')
160
+ puts '------------------------------------------'
137
161
  puts
138
162
  i += 1
139
163
 
140
164
  # Prints and saves the basic URL for avatar retrieval, with specified
141
165
  # image default
142
166
  # (https://secure.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.jpg?d=identicon)
143
- puts "------------------------------------------"
144
- puts "Avatar: '#{i}'. Prints and saves the basic URL for avatar retrieval, with specified image default (https://secure.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.jpg?d=identicon)."
145
- puts "------------------------------------------"
167
+ puts '=========================================='
168
+ puts "AVATAR '#{i}': Prints and saves the basic URL for avatar retrieval, with specified image default (https://secure.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.jpg?d=identicon)."
146
169
  puts "irb(main):001:0> a_gravaty.avatar default: 'identicon', type: 'jpg'"
147
170
  puts a_gravaty.avatar! default: 'identicon', type: 'jpg'
171
+ puts '------------------------------------------'
148
172
  puts
149
173
  i += 1
150
174
 
151
175
  # Downloads the previously saved gravaty configuration with the default
152
176
  # name of the file according to saved URI
153
177
  # (saves b58996c504c5638798eb6b511e6f49af.jpg file)
154
- puts "------------------------------------------"
155
- puts "Avatar: '#{i}'. Downloads the previously saved gravaty configuration with the default name of the file according to saved URI. (saves b58996c504c5638798eb6b511e6f49af.jpg file)"
156
- puts "------------------------------------------"
178
+ puts '=========================================='
179
+ # rubocop:disable Layout/LineLength
180
+ puts "AVATAR '#{i}': Downloads the previously saved gravaty configuration with the default name of the file according to saved URI. (saves b58996c504c5638798eb6b511e6f49af.jpg file)"
181
+ # rubocop:enable Layout/LineLength
157
182
  puts 'irb(main):001:0> a_gravaty.download'
158
- a_gravaty.download
183
+ a_gravaty.download if internet_connection? && !ENV['SSL_CERT_FILE'].nil?
184
+ File.delete('b58996c504c5638798eb6b511e6f49af.jpg') if File.exist?('b58996c504c5638798eb6b511e6f49af.jpg')
185
+ puts '------------------------------------------'
159
186
  puts