finapps 2.0.2 → 2.0.3
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 +4 -4
- data/finapps.gemspec +1 -0
- data/lib/finapps/version.rb +1 -1
- data/lib/finapps.rb +2 -2
- metadata +21 -3
- data/lib/finapps/core_extensions/hash/compact.rb +0 -22
- data/lib/finapps/core_extensions/object/blank.rb +0 -145
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a81d812abab60bad504cb74b393d1c89f9ec37d7
|
4
|
+
data.tar.gz: 1b1eaccf3d3e1e95e77976bde2c3f8da1c474b95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15e163b8bf4747efdbdc4e3a51309cb3160943ff22078488cd261babbefe71eb1d4a6262b0f83387baa03b2a12c52ae9e63baf3dcfc913d7f201e60f4cd43bfc
|
7
|
+
data.tar.gz: d9e5dea299c1cc259676f02433379d7e5cecba6753c2c9afdbb75a44e5270f1942602c273d17665a737d17cf3531f64d71c1cebe6d72211138887d26d022cc8f
|
data/finapps.gemspec
CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.test_files = Dir['spec/**/*.rb']
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
|
23
|
+
spec.add_runtime_dependency 'activesupport', '~> 4.2', '>= 4.2.6'
|
23
24
|
spec.add_runtime_dependency 'faraday', '~> 0.9', '>= 0.9.2'
|
24
25
|
spec.add_runtime_dependency 'faraday_middleware', '~> 0.10', '>= 0.10.0'
|
25
26
|
spec.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.2'
|
data/lib/finapps/version.rb
CHANGED
data/lib/finapps.rb
CHANGED
@@ -5,8 +5,8 @@ require 'faraday_middleware'
|
|
5
5
|
require 'typhoeus'
|
6
6
|
require 'typhoeus/adapters/faraday'
|
7
7
|
|
8
|
-
require '
|
9
|
-
require '
|
8
|
+
require 'active_support/core_ext/hash/compact'
|
9
|
+
require 'active_support/core_ext/object/blank'
|
10
10
|
require 'finapps/core_extensions/integerable'
|
11
11
|
require 'finapps/hash_constructable'
|
12
12
|
require 'finapps/utils/loggeable'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: finapps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erich Quintero
|
@@ -10,6 +10,26 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2016-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.2'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 4.2.6
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '4.2'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 4.2.6
|
13
33
|
- !ruby/object:Gem::Dependency
|
14
34
|
name: faraday
|
15
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -231,9 +251,7 @@ files:
|
|
231
251
|
- Rakefile
|
232
252
|
- finapps.gemspec
|
233
253
|
- lib/finapps.rb
|
234
|
-
- lib/finapps/core_extensions/hash/compact.rb
|
235
254
|
- lib/finapps/core_extensions/integerable.rb
|
236
|
-
- lib/finapps/core_extensions/object/blank.rb
|
237
255
|
- lib/finapps/error.rb
|
238
256
|
- lib/finapps/hash_constructable.rb
|
239
257
|
- lib/finapps/middleware/raise_error.rb
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# from rails/activesupport/lib/active_support/core_ext/hash/compact.rb
|
2
|
-
|
3
|
-
class Hash # :nodoc:
|
4
|
-
# Returns a hash with non +nil+ values.
|
5
|
-
#
|
6
|
-
# hash = { a: true, b: false, c: nil}
|
7
|
-
# hash.compact # => { a: true, b: false}
|
8
|
-
# hash # => { a: true, b: false, c: nil}
|
9
|
-
# { c: nil }.compact # => {}
|
10
|
-
def compact
|
11
|
-
select {|_, value| !value.nil? }
|
12
|
-
end
|
13
|
-
|
14
|
-
# Replaces current hash with non +nil+ values.
|
15
|
-
#
|
16
|
-
# hash = { a: true, b: false, c: nil}
|
17
|
-
# hash.compact! # => { a: true, b: false}
|
18
|
-
# hash # => { a: true, b: false}
|
19
|
-
def compact!
|
20
|
-
reject! {|_, value| value.nil? }
|
21
|
-
end
|
22
|
-
end
|
@@ -1,145 +0,0 @@
|
|
1
|
-
# from: rails/activesupport/lib/active_support/core_ext/object/blank.rb
|
2
|
-
|
3
|
-
class Object # :nodoc:
|
4
|
-
# An object is blank if it's false, empty, or a whitespace string.
|
5
|
-
# For example, +false+, '', ' ', +nil+, [], and {} are all blank.
|
6
|
-
#
|
7
|
-
# This simplifies
|
8
|
-
#
|
9
|
-
# !address || address.empty?
|
10
|
-
#
|
11
|
-
# to
|
12
|
-
#
|
13
|
-
# address.blank?
|
14
|
-
#
|
15
|
-
# @return [true, false]
|
16
|
-
def blank?
|
17
|
-
respond_to?(:empty?) ? empty? : !self
|
18
|
-
end
|
19
|
-
|
20
|
-
# An object is present if it's not blank.
|
21
|
-
#
|
22
|
-
# @return [true, false]
|
23
|
-
def present?
|
24
|
-
!blank?
|
25
|
-
end
|
26
|
-
|
27
|
-
# Returns the receiver if it's present otherwise returns +nil+.
|
28
|
-
# <tt>object.presence</tt> is equivalent to
|
29
|
-
#
|
30
|
-
# object.present? ? object : nil
|
31
|
-
#
|
32
|
-
# For example, something like
|
33
|
-
#
|
34
|
-
# state = params[:state] if params[:state].present?
|
35
|
-
# country = params[:country] if params[:country].present?
|
36
|
-
# region = state || country || 'US'
|
37
|
-
#
|
38
|
-
# becomes
|
39
|
-
#
|
40
|
-
# region = params[:state].presence || params[:country].presence || 'US'
|
41
|
-
#
|
42
|
-
# @return [Object]
|
43
|
-
def presence
|
44
|
-
self if present?
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
class NilClass # :nodoc:
|
49
|
-
# +nil+ is blank:
|
50
|
-
#
|
51
|
-
# nil.blank? # => true
|
52
|
-
#
|
53
|
-
# @return [true]
|
54
|
-
def blank?
|
55
|
-
true
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
class FalseClass # :nodoc:
|
60
|
-
# +false+ is blank:
|
61
|
-
#
|
62
|
-
# false.blank? # => true
|
63
|
-
#
|
64
|
-
# @return [true]
|
65
|
-
def blank?
|
66
|
-
true
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
class TrueClass # :nodoc:
|
71
|
-
# +true+ is not blank:
|
72
|
-
#
|
73
|
-
# true.blank? # => false
|
74
|
-
#
|
75
|
-
# @return [false]
|
76
|
-
def blank?
|
77
|
-
false
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
class Array # :nodoc:
|
82
|
-
# An array is blank if it's empty:
|
83
|
-
#
|
84
|
-
# [].blank? # => true
|
85
|
-
# [1,2,3].blank? # => false
|
86
|
-
#
|
87
|
-
# @return [true, false]
|
88
|
-
alias blank? empty?
|
89
|
-
end
|
90
|
-
|
91
|
-
class Hash # :nodoc:
|
92
|
-
# A hash is blank if it's empty:
|
93
|
-
#
|
94
|
-
# {}.blank? # => true
|
95
|
-
# { key: 'value' }.blank? # => false
|
96
|
-
#
|
97
|
-
# @return [true, false]
|
98
|
-
alias blank? empty?
|
99
|
-
end
|
100
|
-
|
101
|
-
class String # :nodoc:
|
102
|
-
BLANK_RE = /\A[[:space:]]*\z/
|
103
|
-
|
104
|
-
# A string is blank if it's empty or contains whitespaces only:
|
105
|
-
#
|
106
|
-
# ''.blank? # => true
|
107
|
-
# ' '.blank? # => true
|
108
|
-
# "\t\n\r".blank? # => true
|
109
|
-
# ' blah '.blank? # => false
|
110
|
-
#
|
111
|
-
# Unicode whitespace is supported:
|
112
|
-
#
|
113
|
-
# "\u00a0".blank? # => true
|
114
|
-
#
|
115
|
-
# @return [true, false]
|
116
|
-
def blank?
|
117
|
-
# The regexp that matches blank strings is expensive. For the case of empty
|
118
|
-
# strings we can speed up this method (~3.5x) with an empty? call. The
|
119
|
-
# penalty for the rest of strings is marginal.
|
120
|
-
empty? || self =~ BLANK_RE
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
class Numeric #:nodoc:
|
125
|
-
# No number is blank:
|
126
|
-
#
|
127
|
-
# 1.blank? # => false
|
128
|
-
# 0.blank? # => false
|
129
|
-
#
|
130
|
-
# @return [false]
|
131
|
-
def blank?
|
132
|
-
false
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
class Time #:nodoc:
|
137
|
-
# No Time is blank:
|
138
|
-
#
|
139
|
-
# Time.now.blank? # => false
|
140
|
-
#
|
141
|
-
# @return [false]
|
142
|
-
def blank?
|
143
|
-
false
|
144
|
-
end
|
145
|
-
end
|