shopqi-app 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,11 +5,11 @@ module ShopQiApp
5
5
  end
6
6
 
7
7
  def signed_in?
8
- !cookies.signed[:shop_id].blank?
8
+ !current_shop.nil?
9
9
  end
10
10
 
11
11
  def current_shop
12
- @current_shop ||= (signed_in? && Shop.find(cookies.signed[:shop_id]))
12
+ @current_shop ||= (!cookies.signed[:shop_id].blank? && Shop.find_by_id(cookies.signed[:shop_id]))
13
13
  end
14
14
 
15
15
  def shop_url
@@ -0,0 +1,8 @@
1
+ class Shop < ActiveRecord::Base
2
+ attr_accessible :shop_id, :name, :shopqi_domain, :access_token
3
+
4
+ def self.find_for_shopqi_oauth(data)
5
+ shop = data.extra.raw_info.shop
6
+ where(shop_id: shop.id).first_or_create! name: shop.name, shopqi_domain: shop.shopqi_domain, access_token: data.credentials.token
7
+ end
8
+ end
@@ -1,9 +1,4 @@
1
- class Shop < ActiveRecord::Base
1
+ require "#{ShopQiApp::Engine.models_dir}/shop"
2
+ class Shop
2
3
  attr_accessible :shop_id, :name, :shopqi_domain, :access_token
3
-
4
- def self.find_for_shopqi_oauth(data)
5
- shop = data.extra.raw_info.shop
6
- where(shop_id: shop.id).first_or_create! name: shop.name, shopqi_domain: shop.shopqi_domain, access_token: data.credentials.token
7
- end
8
-
9
4
  end
@@ -3,6 +3,10 @@ module ShopQiApp
3
3
  isolate_namespace ShopQiApp
4
4
  engine_name 'shopqi_app'
5
5
 
6
+ def models_dir
7
+ root.join 'app', 'models'
8
+ end
9
+
6
10
  config.generators do |g|
7
11
  g.template_engine :haml
8
12
  g.test_framework :rspec, :views => false
@@ -1,3 +1,3 @@
1
1
  module ShopQiApp
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopqi-app
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-17 00:00:00.000000000 Z
12
+ date: 2012-07-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -151,6 +151,7 @@ files:
151
151
  - app/controllers/shopqi_app/omniauth_callbacks_controller.rb
152
152
  - app/controllers/shopqi_app/sessions_controller.rb
153
153
  - app/models/secret_setting.rb
154
+ - app/models/shop.rb
154
155
  - app/views/shopqi_app/sessions/new.html.haml
155
156
  - lib/generators/shopqi_app/templates/db/migrate/create_shops.rb
156
157
  - lib/generators/shopqi_app/templates/app/helpers/home_helper.rb
@@ -188,7 +189,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
188
189
  version: '0'
189
190
  segments:
190
191
  - 0
191
- hash: -226147441
192
+ hash: -895272655
192
193
  required_rubygems_version: !ruby/object:Gem::Requirement
193
194
  none: false
194
195
  requirements:
@@ -197,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
198
  version: '0'
198
199
  segments:
199
200
  - 0
200
- hash: -226147441
201
+ hash: -895272655
201
202
  requirements: []
202
203
  rubyforge_project:
203
204
  rubygems_version: 1.8.24