user_timezone 0.3.0 → 0.3.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 +4 -4
- data/README.md +7 -7
- data/lib/user_timezone/timezone_detector.rb +8 -16
- data/lib/user_timezone/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9496b13404d333bcc234132e8ae4f44b1b283909
|
4
|
+
data.tar.gz: 4f610c692cf6002e0e13162f145f5fc7d0c6b741
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01aa15e801824d7708fe3f5023a952c07052696a09843f8b5f6cbe92f8e6c4ecb60d60371c2c3c94a2b83f22dbc6bb4f342a43f8c24d12239241252897f25b99
|
7
|
+
data.tar.gz: 272d12ea5b4c5f74a83b745f0367c13e1f312474f9a21fba6581463ba744b2e9cb2d26d1daee43f73948c481d766dcd782e5acb0d3851b73c6e3befc87607d98
|
data/README.md
CHANGED
@@ -8,17 +8,17 @@ classes and auto-populate the timezone field with detected attributes.
|
|
8
8
|
|
9
9
|
**Table of Contents**
|
10
10
|
|
11
|
-
* [
|
12
|
-
|
13
|
-
* [Usage](#usage)
|
11
|
+
* [Installation](#installation)
|
12
|
+
* [Usage](#usage)
|
14
13
|
* [Automatically populating the timezone field](#automatically-populating-the-timezone-field)
|
15
14
|
* [Getting the current time for a user, contact or account](#getting-the-current-time-for-a-user,-contact-or-account)
|
16
15
|
* [Compatible Lookup Combinations](#compatible-lookup-combinations)
|
17
16
|
* [What if my local class attributes are different?](#what-if-my-local-class-attributes-are-different?)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
* [Development](#development)
|
18
|
+
* [Contributing](#contributing)
|
19
|
+
* [Rate Limits](#rate-limits)
|
20
|
+
* [License](#license)
|
21
|
+
|
22
22
|
## Installation
|
23
23
|
|
24
24
|
Add this line to your application's Gemfile:
|
@@ -37,7 +37,7 @@ module UserTimezone
|
|
37
37
|
else
|
38
38
|
results.first[what_to_detect]
|
39
39
|
end
|
40
|
-
rescue
|
40
|
+
rescue StandardException => e
|
41
41
|
err e.inspect
|
42
42
|
raise e if @options[:raise_errors]
|
43
43
|
nil
|
@@ -88,9 +88,9 @@ module UserTimezone
|
|
88
88
|
#
|
89
89
|
def get_filters(object)
|
90
90
|
if @options[:using].is_a?(Array)
|
91
|
-
|
91
|
+
gen_array_attribute_filters(object, @options[:using])
|
92
92
|
else
|
93
|
-
|
93
|
+
gen_map_attribute_filters(object, @options[:using])
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
@@ -105,24 +105,16 @@ module UserTimezone
|
|
105
105
|
# @param [Hash] attributes Attributes to use in generating filters
|
106
106
|
# @return [String] api request URL
|
107
107
|
#
|
108
|
-
def
|
109
|
-
|
110
|
-
attributes.each do |filter_name|
|
111
|
-
filters << get_object_filter(object, filter_name, filter_name)
|
112
|
-
end
|
113
|
-
filters
|
108
|
+
def gen_array_attribute_filters(object, attributes)
|
109
|
+
attributes.map { |filter_name| gen_object_filter(object, filter_name, filter_name) }
|
114
110
|
end
|
115
111
|
|
116
|
-
def
|
117
|
-
|
118
|
-
map.each do |local_name, filter_name|
|
119
|
-
filters << get_object_filter(object, local_name, filter_name)
|
120
|
-
end
|
121
|
-
filters
|
112
|
+
def gen_map_attribute_filters(object, map)
|
113
|
+
map.map { |local_name, filter_name| gen_object_filter(object, local_name, filter_name) }
|
122
114
|
end
|
123
115
|
|
124
116
|
|
125
|
-
def
|
117
|
+
def gen_object_filter(object, local_name, filter_name)
|
126
118
|
if object.is_a?(Hash)
|
127
119
|
filter_val = object[local_name]
|
128
120
|
("#{filter_name}=" << URI::encode(filter_val)) unless filter_val.nil?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: user_timezone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jay El-Kaake
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|