sharkapps 0.1.13 → 0.1.14

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -12,3 +12,5 @@ group :development do
12
12
  gem "jeweler", "~> 1.5.2"
13
13
  gem "rcov", ">= 0"
14
14
  end
15
+
16
+ gem 'rabl'
data/Gemfile.lock CHANGED
@@ -44,7 +44,11 @@ GEM
44
44
  mime-types (~> 1.16)
45
45
  treetop (~> 1.4.8)
46
46
  mime-types (1.16)
47
+ multi_json (1.3.2)
47
48
  polyglot (0.3.2)
49
+ rabl (0.6.9)
50
+ activesupport (>= 2.3.14)
51
+ multi_json (~> 1.0)
48
52
  rack (1.2.3)
49
53
  rack-mount (0.6.14)
50
54
  rack (>= 1.0.0)
@@ -76,10 +80,12 @@ GEM
76
80
 
77
81
  PLATFORMS
78
82
  ruby
83
+ x86-mingw32
79
84
 
80
85
  DEPENDENCIES
81
86
  bundler (~> 1.0.0)
82
87
  jeweler (~> 1.5.2)
88
+ rabl
83
89
  rails (>= 3.0.9)
84
90
  rcov
85
91
  shoulda
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.13
1
+ 0.1.14
@@ -0,0 +1,54 @@
1
+ class Api::AccountsController < ApplicationController
2
+ skip_before_filter :ensure_canvas_connected_to_facebook
3
+ before_filter :authorize_access
4
+ before_filter :find_account, :only => [:show]
5
+
6
+ # GET /accounts/1
7
+ # GET /accounts/1.xml
8
+ def show
9
+ respond_to do |wants|
10
+ wants.html # show.html.erb
11
+ wants.json {}
12
+ wants.xml { render :xml => @account }
13
+ end
14
+ end
15
+
16
+ # POST /accounts
17
+ # POST /accounts.xml
18
+ def create
19
+ @account = Account.find_or_create_by_fbid(params[:id])
20
+
21
+ respond_to do |format|
22
+ if @account.save
23
+ format.html { }
24
+ format.xml { }
25
+ format.json { render :action => "show.rabl"}
26
+ end
27
+ end
28
+ end
29
+
30
+ def unauthorized
31
+ @error = "Token is not correct"
32
+
33
+ respond_to do |format|
34
+ format.html { }
35
+ format.xml { }
36
+ format.json { }
37
+ end
38
+ end
39
+
40
+ private
41
+
42
+ def authorize_access
43
+ token = "fioerAppforBlat"
44
+ if token != params[:token]
45
+ puts "TOKEN is INVALID!!"
46
+ render :action => "unauthorized.rabl"
47
+ end
48
+ end
49
+
50
+ def find_account
51
+ @account = Account.find(params[:id])
52
+ end
53
+
54
+ end
@@ -0,0 +1,3 @@
1
+ object @account
2
+
3
+ attributes :fbid, :acc_hash
@@ -0,0 +1,2 @@
1
+ object @error
2
+
@@ -7,7 +7,7 @@
7
7
  <%= link_to image_tag("https://s3.amazonaws.com/appforma_static/logos/logo_solo.png", :border => 0), "http://www.appforma.com", {:target => "_blank"}%>
8
8
  </div>
9
9
  <div id="logo_dot_link">
10
- <%= link_to t('general.logo_link'), "http://www.appforma.com/pricing?ref=#{@account.fbid}", {:target => "_blank"}%>
10
+ <%= link_to t('general.logo_link'), "http://www.appforma.com/products", {:target => "_blank"}%>
11
11
  </div>
12
12
  </div>
13
13
  <% when Account::LOGO_DUAL %>
data/config/routes.rb CHANGED
@@ -3,4 +3,9 @@ Rails.application.routes.draw do
3
3
  match 'locale_selector' => 'appforma#locale_selector', :as => :locale_selector
4
4
  match 'not_subscribed' => 'appforma#not_subscribed', :as => :not_subscribed
5
5
  match 'not_authorized' => 'appforma#not_authorized', :as => :not_authorized
6
+
7
+ #API routes
8
+ scope "/api/v1" do
9
+ resources :accounts, :only => [:show, :create, :unauthorized], :controller => "api/accounts"
10
+ end
6
11
  end
@@ -16,6 +16,7 @@ class AppformaAccount < ActiveResource::Base
16
16
  cur_account.trial_remaining = acc.trial_remaining
17
17
  end
18
18
  cur_account.last_approval_check = Time.now
19
+ cur_account.footer_state = acc.branding
19
20
  cur_account.save(false)
20
21
  cur_account
21
22
  end
data/sharkapps.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sharkapps}
8
- s.version = "0.1.13"
8
+ s.version = "0.1.14"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Eyal Kedem"]
12
- s.date = %q{2012-02-08}
12
+ s.date = %q{2012-04-29}
13
13
  s.description = %q{integration utilities with the shark apps framework}
14
14
  s.email = %q{ekedem@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -24,7 +24,10 @@ Gem::Specification.new do |s|
24
24
  "README.rdoc",
25
25
  "Rakefile",
26
26
  "VERSION",
27
+ "app/controllers/api/accounts_controller.rb",
27
28
  "app/controllers/appforma_controller.rb",
29
+ "app/views/api/accounts/show.rabl",
30
+ "app/views/api/accounts/unauthorized.rabl",
28
31
  "app/views/appforma/_footer.html.erb",
29
32
  "app/views/appforma/_header.html.erb",
30
33
  "app/views/appforma/_notifications.html.erb",
@@ -62,12 +65,14 @@ Gem::Specification.new do |s|
62
65
  s.specification_version = 3
63
66
 
64
67
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
68
+ s.add_runtime_dependency(%q<rabl>, [">= 0"])
65
69
  s.add_development_dependency(%q<rails>, [">= 3.0.9"])
66
70
  s.add_development_dependency(%q<shoulda>, [">= 0"])
67
71
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
68
72
  s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
69
73
  s.add_development_dependency(%q<rcov>, [">= 0"])
70
74
  else
75
+ s.add_dependency(%q<rabl>, [">= 0"])
71
76
  s.add_dependency(%q<rails>, [">= 3.0.9"])
72
77
  s.add_dependency(%q<shoulda>, [">= 0"])
73
78
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
@@ -75,6 +80,7 @@ Gem::Specification.new do |s|
75
80
  s.add_dependency(%q<rcov>, [">= 0"])
76
81
  end
77
82
  else
83
+ s.add_dependency(%q<rabl>, [">= 0"])
78
84
  s.add_dependency(%q<rails>, [">= 3.0.9"])
79
85
  s.add_dependency(%q<shoulda>, [">= 0"])
80
86
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sharkapps
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 13
9
+ - 14
10
10
  segments_generated: true
11
- version: 0.1.13
11
+ version: 0.1.14
12
12
  platform: ruby
13
13
  authors:
14
14
  - Eyal Kedem
@@ -16,12 +16,27 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-02-08 00:00:00 +02:00
19
+ date: 2012-04-29 00:00:00 +03:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
- name: rails
23
+ name: rabl
24
24
  version_requirements: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ segments_generated: true
33
+ version: "0"
34
+ requirement: *id001
35
+ prerelease: false
36
+ type: :runtime
37
+ - !ruby/object:Gem::Dependency
38
+ name: rails
39
+ version_requirements: &id002 !ruby/object:Gem::Requirement
25
40
  none: false
26
41
  requirements:
27
42
  - - ">="
@@ -33,12 +48,12 @@ dependencies:
33
48
  - 9
34
49
  segments_generated: true
35
50
  version: 3.0.9
36
- requirement: *id001
51
+ requirement: *id002
37
52
  prerelease: false
38
53
  type: :development
39
54
  - !ruby/object:Gem::Dependency
40
55
  name: shoulda
41
- version_requirements: &id002 !ruby/object:Gem::Requirement
56
+ version_requirements: &id003 !ruby/object:Gem::Requirement
42
57
  none: false
43
58
  requirements:
44
59
  - - ">="
@@ -48,12 +63,12 @@ dependencies:
48
63
  - 0
49
64
  segments_generated: true
50
65
  version: "0"
51
- requirement: *id002
66
+ requirement: *id003
52
67
  prerelease: false
53
68
  type: :development
54
69
  - !ruby/object:Gem::Dependency
55
70
  name: bundler
56
- version_requirements: &id003 !ruby/object:Gem::Requirement
71
+ version_requirements: &id004 !ruby/object:Gem::Requirement
57
72
  none: false
58
73
  requirements:
59
74
  - - ~>
@@ -65,12 +80,12 @@ dependencies:
65
80
  - 0
66
81
  segments_generated: true
67
82
  version: 1.0.0
68
- requirement: *id003
83
+ requirement: *id004
69
84
  prerelease: false
70
85
  type: :development
71
86
  - !ruby/object:Gem::Dependency
72
87
  name: jeweler
73
- version_requirements: &id004 !ruby/object:Gem::Requirement
88
+ version_requirements: &id005 !ruby/object:Gem::Requirement
74
89
  none: false
75
90
  requirements:
76
91
  - - ~>
@@ -82,12 +97,12 @@ dependencies:
82
97
  - 2
83
98
  segments_generated: true
84
99
  version: 1.5.2
85
- requirement: *id004
100
+ requirement: *id005
86
101
  prerelease: false
87
102
  type: :development
88
103
  - !ruby/object:Gem::Dependency
89
104
  name: rcov
90
- version_requirements: &id005 !ruby/object:Gem::Requirement
105
+ version_requirements: &id006 !ruby/object:Gem::Requirement
91
106
  none: false
92
107
  requirements:
93
108
  - - ">="
@@ -97,7 +112,7 @@ dependencies:
97
112
  - 0
98
113
  segments_generated: true
99
114
  version: "0"
100
- requirement: *id005
115
+ requirement: *id006
101
116
  prerelease: false
102
117
  type: :development
103
118
  description: integration utilities with the shark apps framework
@@ -117,7 +132,10 @@ files:
117
132
  - README.rdoc
118
133
  - Rakefile
119
134
  - VERSION
135
+ - app/controllers/api/accounts_controller.rb
120
136
  - app/controllers/appforma_controller.rb
137
+ - app/views/api/accounts/show.rabl
138
+ - app/views/api/accounts/unauthorized.rabl
121
139
  - app/views/appforma/_footer.html.erb
122
140
  - app/views/appforma/_header.html.erb
123
141
  - app/views/appforma/_notifications.html.erb