lolcation_client 0.1.5 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db6234d327df630f577bd8197571cc9d82bbf68f
4
- data.tar.gz: 1cb4d0b5bea591cccf8a46d1130882f53bda1293
3
+ metadata.gz: 057c4665dc46558ae6ebcec4b9fe877730b3ed0a
4
+ data.tar.gz: fbd6cf5ef7551570fa61f1a39c8f65991160e5fe
5
5
  SHA512:
6
- metadata.gz: 2ffbf03b2f04f554a9b5636f78f39317afe258e3bb736c643e2eea058a6414008f7c863e9bbdee02eca3777ba752c5ed7a1a932ace45eb3301fa217125e2527b
7
- data.tar.gz: 25428aae5bdd403434efd1b653c18abeed5c8c686a7acaaf05cb1d0619bb4ccf6e6a5226e43eb5f9ee3699204aae22e82af7e982bf57ef414d9a51ce75e6bac9
6
+ metadata.gz: 114e6203067b0db7ef07d4863e9a4cf9c55dc8382f1fc88055ed2e4fb358dd4b90d4133f76899f66da2d3f869303a229be9054168bf016044c45f40cc7956506
7
+ data.tar.gz: 3596bf4e16fa5c488680538870f0abdc514f2b17def7ee6df415c79c2cddee62c2b06b76d83f49275843f01dc2823a94413a2021a9c22c77623f5486708ca41a
data/.gitignore CHANGED
@@ -16,3 +16,4 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  TODO
19
+ spec/dummy/config/lolcation.yml
@@ -1,16 +1,16 @@
1
1
  class AddLolcationTo<%= table_name.camelize %> < ActiveRecord::Migration
2
2
  def self.up
3
3
  change_table :<%= table_name %> do |t|
4
- t.float :lolcation_latitude
5
- t.float :lolcation_longitude
6
- t.string :lolcation_id
7
- t.string :lolcation_name
8
- t.string :lolcation_address_street
9
- t.string :lolcation_address_neighborhood
10
- t.string :lolcation_address_city
11
- t.string :lolcation_address_state
12
- t.string :lolcation_address_number
13
- t.string :lolcation_address_zipcode
4
+ t.float :lolcation_latitude
5
+ t.float :lolcation_longitude
6
+ t.integer :lolcation_id
7
+ t.string :lolcation_name
8
+ t.string :lolcation_address_street
9
+ t.string :lolcation_address_neighborhood
10
+ t.string :lolcation_address_city
11
+ t.string :lolcation_address_state
12
+ t.string :lolcation_address_number
13
+ t.string :lolcation_address_zipcode
14
14
  end
15
15
  end
16
16
  end
@@ -15,15 +15,13 @@ module LolcationClient
15
15
 
16
16
  json = JSON.parse(response.body, object_class: OpenStruct)
17
17
 
18
- if json.error.present?
19
- self.errors.add(:base, json.error)
20
- false
21
- elsif json.localization.present?
22
- self.lolcation_id = json.localization.id
23
- self.lolcation_latitude = json.localization.latitude
24
- self.lolcation_longitude = json.localization.longitude
18
+ if json.success
19
+ self.lolcation_id = json.id
20
+ self.lolcation_latitude = json.latitude
21
+ self.lolcation_longitude = json.longitude
22
+ true
25
23
  else
26
- json.map {|error, message| self.errors.add("lolcation_#{error}", message[0])}
24
+ self.errors.add(:base, json.error)
27
25
  false
28
26
  end
29
27
  end
@@ -16,7 +16,7 @@ module LolcationClient
16
16
 
17
17
  list = json['localizations']
18
18
 
19
- return list.map(&:objectId) if options[:only_ids]
19
+ return list.map{|item| item.id.to_i} if options[:only_ids]
20
20
 
21
21
  list
22
22
  end
@@ -1,3 +1,3 @@
1
1
  module LolcationClient
2
- VERSION = "0.1.5"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lolcation_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo Zaghi