Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

good #63

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

good #63

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified .rspec
100644 → 100755
Empty file.
Empty file modified .specification
100644 → 100755
Empty file.
Empty file modified Gemfile
100644 → 100755
Empty file.
Empty file modified Gemfile.lock
100644 → 100755
Empty file.
Empty file modified LICENSE
100644 → 100755
Empty file.
Empty file modified README
100644 → 100755
Empty file.
Empty file modified README.textile
100644 → 100755
Empty file.
9 changes: 5 additions & 4 deletions Rakefile
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ require 'rake'
require 'jeweler'
Jeweler::Tasks.new do |gem|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
gem.name = "apn_on_rails"
gem.name = "fireinc-apn_on_rails"
gem.summary = %Q{Apple Push Notifications on Rails}

gem.description = %Q{APN on Rails is a Ruby on Rails gem that allows you to
easily add Apple Push Notification (iPhone) support to your Rails application.
This version includes an association between an assumed User model and APN::Device
}

gem.email = "[email protected]"
gem.homepage = "http://github.com/PRX/apn_on_rails"
gem.authors = ["markbates", "Rebecca Nesson"]
gem.email = "[email protected]"
gem.homepage = "http://github.com/calebhaye/apn_on_rails"
gem.authors = ["markbates", "Rebecca Nesson", "Caleb Adam Haye"]
end
#Jeweler::RubygemsDotOrgsTasks.new

Expand Down
2 changes: 1 addition & 1 deletion VERSION
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.2
0.4.2.5
Empty file modified autotest/discover.rb
100644 → 100755
Empty file.
144 changes: 144 additions & 0 deletions fireinc-apn_on_rails.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
s.name = %q{fireinc-apn_on_rails}
s.version = "0.4.2.13"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["markbates", "Rebecca Nesson", "Caleb Adam Haye"]
s.date = %q{2011-11-31}
s.description = %q{APN on Rails is a Ruby on Rails gem that allows you to
easily add Apple Push Notification (iPhone) support to your Rails application. This version includes an association between an assumed User model and APN::Device
}
s.email = %q{[email protected]}
s.extra_rdoc_files = [
"LICENSE",
"README",
"README.textile"
]
s.files = [
".rspec",
".specification",
"Gemfile",
"Gemfile.lock",
"LICENSE",
"README",
"README.textile",
"Rakefile",
"VERSION",
"fireinc-apn_on_rails.gemspec",
"autotest/discover.rb",
"generators/apn_migrations_generator.rb",
"generators/templates/apn_migrations/001_create_apn_devices.rb",
"generators/templates/apn_migrations/002_create_apn_notifications.rb",
"generators/templates/apn_migrations/003_alter_apn_devices.rb",
"generators/templates/apn_migrations/004_create_apn_apps.rb",
"generators/templates/apn_migrations/005_create_groups.rb",
"generators/templates/apn_migrations/006_alter_apn_groups.rb",
"generators/templates/apn_migrations/007_create_device_groups.rb",
"generators/templates/apn_migrations/008_create_apn_group_notifications.rb",
"generators/templates/apn_migrations/009_create_pull_notifications.rb",
"generators/templates/apn_migrations/010_alter_apn_notifications.rb",
"generators/templates/apn_migrations/011_make_device_token_index_nonunique.rb",
"generators/templates/apn_migrations/012_add_launch_notification_to_apn_pull_notifications.rb",
"lib/apn_on_rails.rb",
"lib/apn_on_rails/apn_on_rails.rb",
"lib/apn_on_rails/app/models/apn/app.rb",
"lib/apn_on_rails/app/models/apn/base.rb",
"lib/apn_on_rails/app/models/apn/device.rb",
"lib/apn_on_rails/app/models/apn/device_grouping.rb",
"lib/apn_on_rails/app/models/apn/group.rb",
"lib/apn_on_rails/app/models/apn/group_notification.rb",
"lib/apn_on_rails/app/models/apn/notification.rb",
"lib/apn_on_rails/app/models/apn/pull_notification.rb",
"lib/apn_on_rails/libs/connection.rb",
"lib/apn_on_rails/libs/feedback.rb",
"lib/apn_on_rails/tasks/apn.rake",
"lib/apn_on_rails/tasks/db.rake",
"lib/apn_on_rails_tasks.rb",
"spec/active_record/setup_ar.rb",
"spec/apn_on_rails/app/models/apn/app_spec.rb",
"spec/apn_on_rails/app/models/apn/device_spec.rb",
"spec/apn_on_rails/app/models/apn/group_notification_spec.rb",
"spec/apn_on_rails/app/models/apn/notification_spec.rb",
"spec/apn_on_rails/app/models/apn/pull_notification_spec.rb",
"spec/apn_on_rails/libs/connection_spec.rb",
"spec/apn_on_rails/libs/feedback_spec.rb",
"spec/extensions/string.rb",
"spec/factories/app_factory.rb",
"spec/factories/device_factory.rb",
"spec/factories/device_grouping_factory.rb",
"spec/factories/group_factory.rb",
"spec/factories/group_notification_factory.rb",
"spec/factories/notification_factory.rb",
"spec/factories/pull_notification_factory.rb",
"spec/fixtures/hexa.bin",
"spec/fixtures/message_for_sending.bin",
"spec/rails_root/config/apple_push_notification_development.pem",
"spec/spec_helper.rb"
]
s.homepage = %q{http://github.com/calebhaye/apn_on_rails}
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.7}
s.summary = %q{Apple Push Notifications on Rails}
s.test_files = [
"spec/active_record/setup_ar.rb",
"spec/apn_on_rails/app/models/apn/app_spec.rb",
"spec/apn_on_rails/app/models/apn/device_spec.rb",
"spec/apn_on_rails/app/models/apn/group_notification_spec.rb",
"spec/apn_on_rails/app/models/apn/notification_spec.rb",
"spec/apn_on_rails/app/models/apn/pull_notification_spec.rb",
"spec/apn_on_rails/libs/connection_spec.rb",
"spec/apn_on_rails/libs/feedback_spec.rb",
"spec/extensions/string.rb",
"spec/factories/app_factory.rb",
"spec/factories/device_factory.rb",
"spec/factories/device_grouping_factory.rb",
"spec/factories/group_factory.rb",
"spec/factories/group_notification_factory.rb",
"spec/factories/notification_factory.rb",
"spec/factories/pull_notification_factory.rb",
"spec/spec_helper.rb"
]

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3

if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<configatron>, [">= 0"])
s.add_development_dependency(%q<autotest>, [">= 0"])
s.add_development_dependency(%q<sqlite3-ruby>, [">= 0"])
s.add_development_dependency(%q<rspec>, [">= 2.0.0"])
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
s.add_development_dependency(%q<jeweler>, ["~> 1.5.0"])
s.add_development_dependency(%q<rcov>, [">= 0"])
s.add_development_dependency(%q<actionpack>, ["~> 2.3.0"])
s.add_development_dependency(%q<activerecord>, ["~> 2.3.0"])
else
s.add_dependency(%q<configatron>, [">= 0"])
s.add_dependency(%q<autotest>, [">= 0"])
s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
s.add_dependency(%q<rspec>, [">= 2.0.0"])
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
s.add_dependency(%q<jeweler>, ["~> 1.5.0"])
s.add_dependency(%q<rcov>, [">= 0"])
s.add_dependency(%q<actionpack>, ["~> 2.3.0"])
s.add_dependency(%q<activerecord>, ["~> 2.3.0"])
end
else
s.add_dependency(%q<configatron>, [">= 0"])
s.add_dependency(%q<autotest>, [">= 0"])
s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
s.add_dependency(%q<rspec>, [">= 2.0.0"])
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
s.add_dependency(%q<jeweler>, ["~> 1.5.0"])
s.add_dependency(%q<rcov>, [">= 0"])
s.add_dependency(%q<actionpack>, ["~> 2.3.0"])
s.add_dependency(%q<activerecord>, ["~> 2.3.0"])
end
end

Empty file modified generators/apn_migrations_generator.rb
100644 → 100755
Empty file.
Empty file modified generators/templates/apn_migrations/001_create_apn_devices.rb
100644 → 100755
Empty file.
Empty file.
Empty file modified generators/templates/apn_migrations/003_alter_apn_devices.rb
100644 → 100755
Empty file.
Empty file modified generators/templates/apn_migrations/004_create_apn_apps.rb
100644 → 100755
Empty file.
Empty file modified generators/templates/apn_migrations/005_create_groups.rb
100644 → 100755
Empty file.
Empty file modified generators/templates/apn_migrations/006_alter_apn_groups.rb
100644 → 100755
Empty file.
Empty file modified generators/templates/apn_migrations/007_create_device_groups.rb
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified lib/apn_on_rails.rb
100644 → 100755
Empty file.
Empty file modified lib/apn_on_rails/apn_on_rails.rb
100644 → 100755
Empty file.
7 changes: 4 additions & 3 deletions lib/apn_on_rails/app/models/apn/app.rb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,15 @@ def self.send_notifications_for_cert(the_cert, app_id)
conditions = ["app_id = ?", app_id]
end
begin
APN::Connection.open_for_delivery({:cert => the_cert}) do |conn, sock|
APN::Device.find_each(:conditions => conditions) do |dev|
APN::Device.find_each(:conditions => conditions) do |dev|
APN::Connection.open_for_delivery({:cert => the_cert}) do |conn, sock|
dev.unsent_notifications.each do |noty|
conn.write(noty.message_for_sending)
noty.sent_at = Time.now
noty.save
end
end
sleep(1)
end
rescue Exception => e
log_connection_exception(e)
Expand Down Expand Up @@ -144,7 +145,7 @@ def self.process_devices_for_cert(the_cert)


protected
def log_connection_exception(ex)
def self.log_connection_exception(ex)
puts ex.message
end

Expand Down
Empty file modified lib/apn_on_rails/app/models/apn/base.rb
100644 → 100755
Empty file.
3 changes: 2 additions & 1 deletion lib/apn_on_rails/app/models/apn/device.rb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ class APN::Device < APN::Base
belongs_to :app, :class_name => 'APN::App'
has_many :notifications, :class_name => 'APN::Notification'
has_many :unsent_notifications, :class_name => 'APN::Notification', :conditions => 'sent_at is null'
belongs_to :user

validates_uniqueness_of :token, :scope => :app_id
validates_uniqueness_of :token, :scope => :artist_id
validates_format_of :token, :with => /^[a-z0-9]{8}\s[a-z0-9]{8}\s[a-z0-9]{8}\s[a-z0-9]{8}\s[a-z0-9]{8}\s[a-z0-9]{8}\s[a-z0-9]{8}\s[a-z0-9]{8}$/

before_create :set_last_registered_at
Expand Down
Empty file modified lib/apn_on_rails/app/models/apn/device_grouping.rb
100644 → 100755
Empty file.
Empty file modified lib/apn_on_rails/app/models/apn/group.rb
100644 → 100755
Empty file.
Empty file modified lib/apn_on_rails/app/models/apn/group_notification.rb
100644 → 100755
Empty file.
Empty file modified lib/apn_on_rails/app/models/apn/notification.rb
100644 → 100755
Empty file.
Empty file modified lib/apn_on_rails/app/models/apn/pull_notification.rb
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion lib/apn_on_rails/libs/connection.rb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def open(options = {}, &block) # :nodoc:
ssl.connect

yield ssl, sock if block_given?

ensure
ssl.close
sock.close
end
Expand Down
Empty file modified lib/apn_on_rails/libs/feedback.rb
100644 → 100755
Empty file.
Empty file modified lib/apn_on_rails/tasks/apn.rake
100644 → 100755
Empty file.
Empty file modified lib/apn_on_rails/tasks/db.rake
100644 → 100755
Empty file.
Empty file modified lib/apn_on_rails_tasks.rb
100644 → 100755
Empty file.
16 changes: 8 additions & 8 deletions apn_on_rails.gemspec → presskit-apn_on_rails.gemspec
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
s.name = %q{apn_on_rails}
s.version = "0.4.2"
s.name = %q{presskit-apn_on_rails}
s.version = "0.1"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["markbates", "Rebecca Nesson"]
s.date = %q{2011-01-04}
s.authors = ["markbates", "Rebecca Nesson", "Caleb Adam Haye"]
s.date = %q{2011-11-31}
s.description = %q{APN on Rails is a Ruby on Rails gem that allows you to
easily add Apple Push Notification (iPhone) support to your Rails application.
easily add Apple Push Notification (iPhone) support to your Rails application. This version includes an association between an assumed User model and APN::Device
}
s.email = %q{[email protected]}
s.email = %q{[email protected]}
s.extra_rdoc_files = [
"LICENSE",
"README",
Expand All @@ -29,7 +29,7 @@ easily add Apple Push Notification (iPhone) support to your Rails application.
"README.textile",
"Rakefile",
"VERSION",
"apn_on_rails.gemspec",
"presskit-apn_on_rails.gemspec",
"autotest/discover.rb",
"generators/apn_migrations_generator.rb",
"generators/templates/apn_migrations/001_create_apn_devices.rb",
Expand Down Expand Up @@ -80,7 +80,7 @@ easily add Apple Push Notification (iPhone) support to your Rails application.
"spec/rails_root/config/apple_push_notification_development.pem",
"spec/spec_helper.rb"
]
s.homepage = %q{http://github.com/PRX/apn_on_rails}
s.homepage = %q{http://github.com/calebhaye/apn_on_rails}
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.7}
s.summary = %q{Apple Push Notifications on Rails}
Expand Down
Empty file modified spec/active_record/setup_ar.rb
100644 → 100755
Empty file.
Empty file modified spec/apn_on_rails/app/models/apn/app_spec.rb
100644 → 100755
Empty file.
Empty file modified spec/apn_on_rails/app/models/apn/device_spec.rb
100644 → 100755
Empty file.
Empty file modified spec/apn_on_rails/app/models/apn/group_notification_spec.rb
100644 → 100755
Empty file.
Empty file modified spec/apn_on_rails/app/models/apn/notification_spec.rb
100644 → 100755
Empty file.
Empty file modified spec/apn_on_rails/app/models/apn/pull_notification_spec.rb
100644 → 100755
Empty file.
Empty file modified spec/apn_on_rails/libs/connection_spec.rb
100644 → 100755
Empty file.
Empty file modified spec/apn_on_rails/libs/feedback_spec.rb
100644 → 100755
Empty file.
Empty file modified spec/extensions/string.rb
100644 → 100755
Empty file.
Empty file modified spec/factories/app_factory.rb
100644 → 100755
Empty file.
Empty file modified spec/factories/device_factory.rb
100644 → 100755
Empty file.
Empty file modified spec/factories/device_grouping_factory.rb
100644 → 100755
Empty file.
Empty file modified spec/factories/group_factory.rb
100644 → 100755
Empty file.
Empty file modified spec/factories/group_notification_factory.rb
100644 → 100755
Empty file.
Empty file modified spec/factories/notification_factory.rb
100644 → 100755
Empty file.
Empty file modified spec/factories/pull_notification_factory.rb
100644 → 100755
Empty file.
Empty file modified spec/fixtures/hexa.bin
100644 → 100755
Empty file.
Empty file modified spec/fixtures/message_for_sending.bin
100644 → 100755
Empty file.
Empty file modified spec/rails_root/config/apple_push_notification_development.pem
100644 → 100755
Empty file.
Empty file modified spec/spec_helper.rb
100644 → 100755
Empty file.