autopilothq 0.0.3 → 0.0.4

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/autopilothq.rb +6 -11
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd8c8229321c6539bf26b364c6584c71a5509e54
4
- data.tar.gz: 38150dc069bfb193958b0f0495f68dbfc194beb9
3
+ metadata.gz: 9072b02c8438a37d8852b25249509be9e8de363f
4
+ data.tar.gz: 6e6a0ba5d9762e89d3db7f9e14e31eb1a0da55f2
5
5
  SHA512:
6
- metadata.gz: 578864369dffc70b1f23c49d6002e422083ba52ec2230fede5a9b1a2fa76bc6ddd2f5bfdb5f16fda1ed34970141d8fe32319b7771c8941a52f47cf7561f4799f
7
- data.tar.gz: a893f25beb8b3a93e5ca516a26648ae3c5b473d02b33d81b53fc96465ba84ed4cb0a34b6b5d211dce485cf6cd65b09073748a7652111681c37fae20f08ec679a
6
+ metadata.gz: 43bece4780d2a39a39c4236062e7bc4871f04b27eaad5b9630a12fa69deb79ea91cc4dae6f0c529c40be3df957f45411fa185bb198c22f7e51b184a157f6b000
7
+ data.tar.gz: c45402449a552e9d6886d11fdde53d081b0d28804ca9239f4aa2b5278dc8d92b99f64a8912b9de063775d956b51f2a2bd7d8894a83c25feb9b7d20eca280cc89
@@ -15,11 +15,12 @@ class Autopilothq
15
15
  "custom" => {}
16
16
  }
17
17
  }
18
- custom_attrs.each_pair{ |key, value|
19
- if key.class.to_s == "Date"
18
+ custom_attrs.each_pair{ |key, (type,value)|
19
+ next if value.nil?
20
+ if type == "date"
20
21
  value = value.to_i
21
22
  end
22
- attributes['contact']['custom'][get_key_name(key, value)] = value
23
+ attributes['contact']['custom'][get_key_name(key, type)] = value
23
24
  }
24
25
 
25
26
  response = RestClient.post 'https://api2.autopilothq.com/v1/contact', attributes.to_json, headers
@@ -36,13 +37,7 @@ class Autopilothq
36
37
  }
37
38
  end
38
39
 
39
- def self.get_key_name(name, value)
40
- type = {"Float" => "float",
41
- "Fixnum" => "integer",
42
- "String" => "string",
43
- "TrueClass" => "boolean",
44
- "FalseClass" => "boolean",
45
- "Date" => "date"}
46
- return "#{type[value.class.to_s]}--#{name.gsub(/\s+/, "--")}"
40
+ def self.get_key_name(name, type)
41
+ return "#{type}--#{name.gsub(/\s+/, "--")}"
47
42
  end
48
43
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autopilothq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Culbertson