ish_models 0.0.33.146 → 0.0.33.147

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ish/user_profile.rb +26 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b97e9f9e4ed76c66c50d30bf5f4ec80f2532058e7a8b687a049bd87f07f98434
4
- data.tar.gz: f27c9a996be622b67ace6dbba51473d83cb5b5af6e4c390a7f28cdd25e0ac1fa
3
+ metadata.gz: 2af4a30d5895c96dfa6e0b57604155431d3bad1e63545983525a6703f8def2b5
4
+ data.tar.gz: e6d1ab4d19a4eae08bb34da2855a7fe08f582af676933fb0c856ed57e77796e0
5
5
  SHA512:
6
- metadata.gz: e936a99d778b9eea62cd3cb1895990ea3aaae2d756fcdefb2bedd21847d5d8f604fba33e88604965e35a7958325bee0b613a22a083a32e0728fb21970a61ceea
7
- data.tar.gz: 3300a0193da951151944262f0d6065655a2ba9e63e560d66db668aa36b24f3d0dc7544517c0c0e171d141a0c6256c5416fc27380d5a63044cc6516a5f142ed0d
6
+ metadata.gz: 2be04cc815e921d2807dffe0ad15feadeeec327b72cacbef49b96b505d85c4870f0d45d5293749db8c05dad2163e1874fc1e2d70c2b33ba12deee38cd8c96f84
7
+ data.tar.gz: c8611fdae51db950f7b218e52cbafebaeada3416d535392c91a628ce7aaa8adc6b17fb793af20f1496887dc23ca7cda83beb483665de797cbf1eaae6d14056f2
@@ -81,4 +81,30 @@ class Ish::UserProfile
81
81
  ::Gameui::PremiumPurchase.where( user_profile_id: self.id )
82
82
  end
83
83
 
84
+ # used in rake tasks
85
+ def self.generate delta
86
+ email = delta[:email]
87
+ password = delta[:password]
88
+ role_name = delta[:role_name]
89
+
90
+ profile = Ish::UserProfile.where( email: email ).first
91
+ if profile
92
+ puts! profile, "UserProfile#generate, already exists"
93
+ return
94
+ end
95
+
96
+ user = User.where( email: email ).first
97
+ if !user
98
+ user = User.new({ email: email, password: password })
99
+ end
100
+ profile = Ish::UserProfile.new({ email: email, name: email, role_name: role_name, user: user })
101
+ profile.save
102
+
103
+ if profile.persisted?
104
+ ;
105
+ else
106
+ puts! profile.errors.full_messages, "Cannot save profile"
107
+ end
108
+ end
109
+
84
110
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ish_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.33.146
4
+ version: 0.0.33.147
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
@@ -171,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
171
  - !ruby/object:Gem::Version
172
172
  version: '0'
173
173
  requirements: []
174
- rubygems_version: 3.0.3.1
174
+ rubygems_version: 3.1.6
175
175
  signing_key:
176
176
  specification_version: 4
177
177
  summary: models of ish