Skip to content

Commit

Permalink
Added import tasks.
Browse files Browse the repository at this point in the history
  • Loading branch information
seaneshbaugh committed Mar 31, 2014
1 parent 6286b13 commit f5d82e1
Show file tree
Hide file tree
Showing 5 changed files with 500 additions and 1 deletion.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -10,6 +10,7 @@ gem 'devise'
gem 'exception_notification'
gem 'honeypot-captcha'
gem 'kaminari'
gem 'mechanize'
gem 'ransack'
gem 'rmagick'
gem 'sanitize', '2.0.3'
Expand Down
21 changes: 21 additions & 0 deletions Gemfile.lock
Expand Up @@ -72,6 +72,8 @@ GEM
railties (~> 3.1)
warden (~> 1.2.1)
diff-lcs (1.2.4)
domain_name (0.5.18)
unf (>= 0.0.5, < 1.0.0)
erubis (2.7.0)
eventmachine (1.0.3)
exception_notification (4.0.0)
Expand All @@ -89,6 +91,8 @@ GEM
highline (1.6.19)
hike (1.2.3)
honeypot-captcha (0.0.2)
http-cookie (1.0.2)
domain_name (~> 0.5)
i18n (0.6.1)
journey (1.0.4)
jquery-rails (3.0.4)
Expand Down Expand Up @@ -119,12 +123,23 @@ GEM
skinny (~> 0.2.3)
sqlite3 (~> 1.3)
thin (~> 1.5.0)
mechanize (2.7.2)
domain_name (~> 0.5, >= 0.5.1)
http-cookie (~> 1.0.0)
mime-types (~> 1.17, >= 1.17.2)
net-http-digest_auth (~> 1.1, >= 1.1.1)
net-http-persistent (~> 2.5, >= 2.5.2)
nokogiri (~> 1.4)
ntlm-http (~> 0.1, >= 0.1.1)
webrobots (>= 0.0.9, < 0.2)
metaclass (0.0.1)
mime-types (1.23)
mocha (0.14.0)
metaclass (~> 0.0.1)
multi_json (1.7.7)
mysql2 (0.3.11)
net-http-digest_auth (1.4)
net-http-persistent (2.9.4)
net-scp (1.1.2)
net-ssh (>= 2.6.5)
net-sftp (2.1.2)
Expand All @@ -133,6 +148,7 @@ GEM
net-ssh-gateway (1.2.0)
net-ssh (>= 2.6.5)
nokogiri (1.5.10)
ntlm-http (0.1.1)
orm_adapter (0.4.0)
polyamorous (0.5.0)
activerecord (~> 3.0)
Expand Down Expand Up @@ -235,8 +251,12 @@ GEM
uglifier (2.1.1)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
unf (0.1.3)
unf_ext
unf_ext (0.0.6)
warden (1.2.2)
rack (>= 1.0)
webrobots (0.1.1)
websocket (1.0.7)
xpath (1.0.0)
nokogiri (~> 1.3)
Expand Down Expand Up @@ -266,6 +286,7 @@ DEPENDENCIES
less-rails
libv8 (= 3.11.8.13)
mailcatcher
mechanize
mysql2
quiet_assets
rails (= 3.2.13)
Expand Down
8 changes: 7 additions & 1 deletion app/models/card.rb
@@ -1,8 +1,9 @@
class Card < ActiveRecord::Base
attr_accessible :multiverse_id, :name, :card_set_id, :mana_cost, :converted_mana_cost, :card_type, :card_text, :flavor_text, :power, :toughness, :loyalty, :rarity, :card_number, :artist
attr_accessible :multiverse_id, :name, :card_set_id, :layout, :mana_cost, :converted_mana_cost, :colors, :card_type, :card_supertypes, :card_types, :card_subtypes, :card_text, :flavor_text, :power, :toughness, :loyalty, :rarity, :card_number, :artist

belongs_to :card_set

has_many :card_parts
has_many :collections
has_many :users, :through => :collections

Expand All @@ -16,9 +17,14 @@ class Card < ActiveRecord::Base
if self.new_record?
self.multiverse_id ||= ''
self.name ||= ''
self.layout ||= ''
self.mana_cost ||= ''
self.converted_mana_cost ||= ''
self.colors ||= ''
self.card_type ||= ''
self.card_supertypes ||= ''
self.card_types ||= ''
self.card_subtypes ||= ''
self.card_text ||= ''
self.flavor_text ||= ''
self.power ||= ''
Expand Down
34 changes: 34 additions & 0 deletions app/models/card_part.rb
@@ -0,0 +1,34 @@
class CardPart < ActiveRecord::Base
attr_accessible :multiverse_id, :name, :card_id, :layout, :mana_cost, :converted_mana_cost, :colors, :card_type, :card_supertypes, :card_types, :card_subtypes, :card_text, :flavor_text, :power, :toughness, :loyalty, :rarity, :card_number, :artist

belongs_to :card

validates_presence_of :multiverse_id

validates_presence_of :name

validates_presence_of :card_id

after_initialize do
if self.new_record?
self.multiverse_id ||= ''
self.name ||= ''
self.layout ||= ''
self.mana_cost ||= ''
self.converted_mana_cost ||= ''
self.colors ||= ''
self.card_type ||= ''
self.card_supertypes ||= ''
self.card_types ||= ''
self.card_subtypes ||= ''
self.card_text ||= ''
self.flavor_text ||= ''
self.power ||= ''
self.toughness ||= ''
self.loyalty ||= ''
self.rarity ||= ''
self.card_number ||= ''
self.artist ||= ''
end
end
end

0 comments on commit f5d82e1

Please sign in to comment.