notifiable-geo 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 41e9ba36302992536821f97271c8058f92c9c952
4
+ data.tar.gz: f1550776e010bc8ab000cde2b47cb53fa46d43c9
5
+ SHA512:
6
+ metadata.gz: 5a86c0fb070051a963d978c044f981c3643049f272ab60de21524aabc714de41241920b982e986ccae8b8905e6290d40ac4200a7296be3a61087fba1643427a2
7
+ data.tar.gz: 27046def4175f8c41988a31ceed46b7addc0fe5f156ce8f2232b3d3164acc08eaf40522a139e4c13f627e17ee6136c1b4bf2ec3c9fd1bf5e785f9837c2d37288
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Notifiable::Geo
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/notifiable/geo`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'notifiable-geo'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install notifiable-geo
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/notifiable-geo.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,20 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ require 'active_record'
5
+ include ActiveRecord::Tasks
6
+ require "active_record/connection_adapters/postgis/postgis_database_tasks"
7
+
8
+ notifiable_path = Gem::Specification.find_by_name 'notifiable'
9
+ load "#{notifiable_path.gem_dir}/lib/tasks/db.rake"
10
+
11
+ namespace :db do
12
+ task :before_migrate do
13
+ @migration_paths << File.join(File.dirname(__FILE__), 'db', 'migrate')
14
+ end
15
+
16
+ end
17
+
18
+ RSpec::Core::RakeTask.new(:spec)
19
+
20
+ task :default => :spec
@@ -0,0 +1,8 @@
1
+ class AddLatLonToNotifiableDeviceTokens < ActiveRecord::Migration[4.2]
2
+
3
+ def change
4
+ enable_extension "postgis"
5
+ add_column :notifiable_device_tokens, :lonlat, :st_point, geographic: true
6
+ end
7
+
8
+ end
@@ -0,0 +1,5 @@
1
+ module Notifiable
2
+ class DeviceToken < ActiveRecord::Base
3
+ scope :nearby, ->(lon, lat, radius) { where('ST_DWithin(lonlat, ST_MakePoint(?,?), ?)', lon, lat, radius) }
4
+ end
5
+ end
@@ -0,0 +1,16 @@
1
+ require "notifiable"
2
+ require "rgeo"
3
+ require "rgeo-activerecord"
4
+
5
+ require "notifiable/geo/version"
6
+ require "notifiable/device_token_decorator"
7
+
8
+ RGeo::ActiveRecord::SpatialFactoryStore.instance.tap do |config|
9
+ config.default = RGeo::Geographic.spherical_factory(srid: 4326)
10
+ end
11
+
12
+ module Notifiable
13
+ module Geo
14
+
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ module Notifiable
2
+ module Geo
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,148 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: notifiable-geo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Matt Brooke-Smith
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-08-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pg
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activerecord-postgis-adapter
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.16'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.16'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: database_cleaner
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: factory_bot
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description:
112
+ email:
113
+ - matt@futureworkshops.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - README.md
119
+ - Rakefile
120
+ - db/migrate/20170116212641_add_lat_lon_to_notifiable_device_tokens.rb
121
+ - lib/notifiable/device_token_decorator.rb
122
+ - lib/notifiable/geo.rb
123
+ - lib/notifiable/geo/version.rb
124
+ homepage: https://github.com/FutureWorkshops/notifiable-geo
125
+ licenses:
126
+ - MIT
127
+ metadata: {}
128
+ post_install_message:
129
+ rdoc_options: []
130
+ require_paths:
131
+ - lib
132
+ required_ruby_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ requirements: []
143
+ rubyforge_project:
144
+ rubygems_version: 2.6.14
145
+ signing_key:
146
+ specification_version: 4
147
+ summary: Geo extensions for Notifiable
148
+ test_files: []