user_timezone 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 79f9b7d75beac7d2d4e5dbba1aa4b65f4f8bbfba
4
- data.tar.gz: 60d17f2f052ba8b82523b4c05b537c1e0eec6e1f
3
+ metadata.gz: 9496b13404d333bcc234132e8ae4f44b1b283909
4
+ data.tar.gz: 4f610c692cf6002e0e13162f145f5fc7d0c6b741
5
5
  SHA512:
6
- metadata.gz: 902ea953a3034d4a01c209eb9435c7da9c4b40dd07d5f7d0b5b60bc2e19c4d8867ce6d56ce366dd37364994a251c349b7120ae75bdb8cdb17a1f845d6ce81e59
7
- data.tar.gz: cf343e688ba0df0fcbac918a5ff9400c5d843493ba50b19399a66a1dd0859a8bf0932ff66ebf985b3cad664ce6575e9135a95cada29accbd0c5bda69dca8d7ca
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
- * [User Timezone Detector Gem](#user-timezone-detector-gem)
12
- * [Installation](#installation)
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
- * [Development](#development)
19
- * [Contributing](#contributing)
20
- * [Rate Limits](#rate-limits)
21
- * [License](#license)
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 Exception => e
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
- get_array_attribute_filters(object, @options[:using])
91
+ gen_array_attribute_filters(object, @options[:using])
92
92
  else
93
- get_map_attribute_filters(object, @options[:using])
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 get_array_attribute_filters(object, attributes)
109
- filters = []
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 get_map_attribute_filters(object, map)
117
- filters = []
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 get_object_filter(object, local_name, filter_name)
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?
@@ -1,3 +1,3 @@
1
1
  module UserTimezone
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
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.0
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-21 00:00:00.000000000 Z
11
+ date: 2016-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty