adorable_avatars 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 37f0b546888c654f69acb3d2aed5c652bb7f87b8
4
+ data.tar.gz: b20f788ba76cdfaa25c6bbd53d6fb8478279aa8a
5
+ SHA512:
6
+ metadata.gz: 0e344f9aeed3793fcdc860cf028e11346e84eed45205307906e7bcf70d6fe329d2035b43acdeba498a179080f856c48121b0fc33ea43515dacb3c72e73a7a7de
7
+ data.tar.gz: 6d3c45c2cb88a8cc6e4e92799394615094dd61a1f968258f0b71df97f4339a6f63314daa4a6acbcb86c15d335c531e0650237d45bc974f51dc96f6752960723e
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2015 Mateusz Świszcz
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # Adorable Avatars
2
+
3
+ Easily add random persisted avatars to users (and not only) in your rails application. This gem is only a simple wrapper for [adorable avatars api](http://avatars.adorable.io/).
4
+
5
+ ## Install
6
+
7
+ Add this to Gemfile:
8
+
9
+ ```ruby
10
+ gem 'adorable_avatars'
11
+ ```
12
+
13
+ and run `bundle install`
14
+
15
+ ## Usage
16
+
17
+ In view simply add:
18
+
19
+ ```erb
20
+ <%= adorable_avatar user.email %>
21
+ ```
22
+
23
+ By default the size is 150px. If you want to specify size of the avatar, provide method with **size** option:
24
+
25
+ ```erb
26
+ <%= adorable_avatar user.email, size: 50 %>
27
+ ```
28
+
29
+ You can also set default size in an initializer
30
+
31
+ ```ruby
32
+ # config/intitializers/adorable_avatars.rb
33
+ AdorableAvatars.setup do |config|
34
+ config.default_size = 200
35
+ end
36
+ ```
37
+
38
+ | Note: Size can range from 40px to 285px
39
+
40
+ Adorable avatars create simple wrapper around image_tag, so you can use all options that [image_tag](http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html#method-i-image_tag) accepts
41
+
42
+ ```erb
43
+ <%= adorable_avatar user.email, size: 50, alt: 'Adorable avatar' %>
44
+ ```
@@ -0,0 +1,2 @@
1
+ require 'adorable_avatars/adorable_avatars'
2
+ require 'adorable_avatars/version'
@@ -0,0 +1,21 @@
1
+ module AdorableAvatars
2
+ mattr_accessor :default_size
3
+
4
+ @@default_size = 150
5
+
6
+ def adorable_avatar(digest, options = {})
7
+ size = options.delete(:size) || default_size
8
+
9
+ image_tag adorable_avatar_url(digest, size), **options
10
+ end
11
+
12
+ def adorable_avatar_url(digest, size)
13
+ "http://api.adorable.io/avatars/#{size}/#{digest}.png"
14
+ end
15
+
16
+ def self.setup
17
+ yield self if block_given?
18
+ end
19
+ end
20
+
21
+ ActionView::Base.send :include, AdorableAvatars
@@ -0,0 +1,3 @@
1
+ module AdorableAvatars
2
+ VERSION = '0.0.1'
3
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: adorable_avatars
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Mateusz Świszcz
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-08-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: actionpack
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: Helper method to create unique random avatars for user basing on for
28
+ ex. username or email
29
+ email:
30
+ - swistaku@gmail.com
31
+ executables: []
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - LICENSE
36
+ - README.md
37
+ - lib/adorable_avatars.rb
38
+ - lib/adorable_avatars/adorable_avatars.rb
39
+ - lib/adorable_avatars/version.rb
40
+ homepage: http://github.com/notimetoexplain/adorable_avatars
41
+ licenses: []
42
+ metadata: {}
43
+ post_install_message:
44
+ rdoc_options: []
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ requirements: []
58
+ rubyforge_project:
59
+ rubygems_version: 2.4.6
60
+ signing_key:
61
+ specification_version: 4
62
+ summary: ActionView helper to render adorable avatars
63
+ test_files: []