dynamodb_geo 0.1.0 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2462d22ee572cb65c0af6c6c924bb32f7cbc29fabbf60b15f63be209da271a8a
4
- data.tar.gz: 2c611dfab3f4caa02c25911e4fcb16f6b4a47006a467b37a8df1cbb8b646a182
3
+ metadata.gz: df20011ecbf64926816afdd5e4eaaa1abfa8ca5858b663e81cd690aa2385d284
4
+ data.tar.gz: 72af72a1f8de5bce17213d8cbfc452c04df1d9c6ae641e440703a54013ff887d
5
5
  SHA512:
6
- metadata.gz: e7f45d33d1b1ff2ed85dfcaf06c2336ad9ecae230483ff9da9039ce38b69b37f632dfa896bb3ce91611eff32a98249f52ed2a257483cdbbda9a0f478e6d92787
7
- data.tar.gz: d60bdecd1555c1dfae86bbb034d8c38ede68f55c44d824ad6e7e1c3a1c5f71bd364192d5d8ae4a51affaeede24d23bd1194a1b722a9e21eb10cbbbe2b59782a4
6
+ metadata.gz: 330cb41e5276a0f0b67a00eb95c238297812b807332c30f2139b7090b41c9a190f8c2775dffa69f9b45904263aa94c94b5d00f5ba3d497e1481ce8bf7846a7e4
7
+ data.tar.gz: 35e9d9f59af12644d402911f1407242aa9eefdad21990bd8fd4a9a63b8f92c4d62a6a177826b086cac5bd9b01d4cdd2b143f07819efae7973c4833f9048919ea
data/README.md CHANGED
@@ -2,10 +2,12 @@
2
2
  ## DynamoDB
3
3
  This is an attempt at storing and querying geohash data in DynamoDB.
4
4
 
5
- We store objects in DynamoDB, when we query, we look for a customizable number of stored items by zooming out exactly one level. Returned in an attempt at the closest items first.
5
+ We store objects in DynamoDB, when we query, we look for a customizable number of stored items by zooming out exactly one level.
6
+ We return the objects in an attempt at the closest items first.
6
7
 
7
8
  Items are searched as the following.
8
- Given the lat, long we calculate a hash 9x0qz. We go up one level to 9x0q and calculate all neighbouring hashes.
9
+
10
+ Given the lat, long we calculate a hash - assume 9x0qz. We go up one level to 9x0q and calculate all neighbouring hashes.
9
11
 
10
12
  9x0p 9x0r 9x0x
11
13
  9x0n 9x0q 9x0w => ["9x0q", "9x0r", "9x0x", "9x0w", "9x0t", "9x0m", "9x0j", "9x0n", "9x0p"]
@@ -2,13 +2,14 @@ require 'dynamodb_manager'
2
2
 
3
3
  module DynamodbGeo
4
4
  class << self
5
- def new(region:, table_name:, access_key_id: nil, secret_access_key: nil, profile_name: 'default')
5
+ def new(region:, table_name:, access_key_id: nil, secret_access_key: nil, profile_name: 'default', endpoint: nil)
6
6
  DynamodbManager.new(
7
- region: region,
8
- access_key_id: access_key_id,
7
+ region: region,
8
+ access_key_id: access_key_id,
9
9
  secret_access_key: secret_access_key,
10
- profile_name: profile_name,
11
- table_name: table_name
10
+ profile_name: profile_name,
11
+ table_name: table_name,
12
+ endpoint: endpoint
12
13
  )
13
14
  end
14
15
  end
@@ -1,5 +1,5 @@
1
1
  module DynamodbGeo
2
2
  class Version
3
- STRING = '0.1.0'
3
+ STRING = '0.1.1'
4
4
  end
5
5
  end
@@ -4,7 +4,7 @@ require 'store'
4
4
 
5
5
  class DynamodbManager
6
6
  attr_accessor :client, :table_name, :hash_key, :range_key, :geohash_key, :geojson, :geohash_index, :hash_key_length, :local_area_size, :max_item_return
7
- def initialize(region:, table_name:, access_key_id: nil, secret_access_key: nil, profile_name: 'default')
7
+ def initialize(region:, table_name:, access_key_id: nil, secret_access_key: nil, profile_name: 'default', endpoint: nil)
8
8
  if access_key_id.nil? && secret_access_key.nil?
9
9
  access_key_id = ENV['AWS_ACCESS_KEY_ID']
10
10
  secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
@@ -23,10 +23,18 @@ class DynamodbManager
23
23
  @local_area_size = 5
24
24
  @max_item_return = 10
25
25
 
26
- @client = Aws::DynamoDB::Client.new(
27
- region: region,
28
- credentials: credentials,
29
- )
26
+ if endpoint
27
+ @client = Aws::DynamoDB::Client.new(
28
+ region: region,
29
+ credentials: credentials,
30
+ endpoint: endpoint
31
+ )
32
+ else
33
+ @client = Aws::DynamoDB::Client.new(
34
+ region: region,
35
+ credentials: credentials,
36
+ )
37
+ end
30
38
  end
31
39
 
32
40
  def table
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamodb_geo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Ahn
@@ -127,7 +127,7 @@ requirements: []
127
127
  rubygems_version: 3.1.2
128
128
  signing_key:
129
129
  specification_version: 4
130
- summary: dynamodb_geo-0.1.0
130
+ summary: dynamodb_geo-0.1.1
131
131
  test_files:
132
132
  - spec/dynamodb_geo_spec.rb
133
133
  - spec/geohash_spec.rb