social 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,27 @@
1
+ ok:
2
+ development:
3
+ # production
4
+ api_server: 'http://api.odnoklassniki.ru/'
5
+ application_key: ''
6
+ secret_key: ''
7
+ staging: # staging
8
+ api_server: 'http://api.odnoklassniki.ru/'
9
+ application_key: ''
10
+ secret_key: ''
11
+ production: # production
12
+ api_server: 'http://api.odnoklassniki.ru/'
13
+ application_key: ''
14
+ secret_key: ''
15
+ vk:
16
+ production:
17
+ key: ""
18
+ app_id: 1
19
+ staging:
20
+ key: ""
21
+ app_id: 1
22
+ vk_staging:
23
+ key: ""
24
+ app_id: 1
25
+ development:
26
+ key: ""
27
+ app_id: 1
@@ -1,52 +1,51 @@
1
1
  module Social
2
- module Config
2
+ class Config
3
3
 
4
- @@network_name = nil
4
+ #@@network_name = nil
5
5
 
6
- def self.included(network)
7
- network.send(:include, InstanceMethods)
8
- @@network_name = network.name.split('::').last.downcase
9
- end
10
-
11
- module InstanceMethods
12
-
13
- def network_name
14
- @@network_name
15
- end
6
+ #def self.included(network)
7
+ # require 'pry'
8
+ # binding.pry
9
+ # network.send(:include, InstanceMethods)
10
+ # @@network_name = network.name.split('::').last.downcase
11
+ #end
16
12
 
17
- def network
18
- @network
19
- end
20
-
21
- def config
22
- @config_data ||= load_config_file
23
- end
13
+ def initialize(network_name)
14
+ @network_name = network_name
15
+ end
24
16
 
25
- def config_file_path=(new_path)
26
- @config_file_path = new_path
27
- @config = load_config_file if @config_data
28
- end
17
+ def network_name
18
+ @network_name
19
+ end
20
+
21
+ def config
22
+ @config_data ||= load_config_file
23
+ end
29
24
 
30
- def config_root=(new_root)
31
- @config_root = new_root
32
- end
25
+ def config_file_path=(new_path)
26
+ @config_file_path = new_path
27
+ @config = load_config_file if @config_data
28
+ end
33
29
 
34
- def config_root
35
- @config_root ||= File.join(Rails.root, 'config') if defined?(Rails)
36
- @config_root ||= ENV['SOCIAL_CONFIG_ROOT']
37
- @config_root ||= File.join('.', 'config')
38
- end
30
+ def config_root=(new_root)
31
+ @config_root = new_root
32
+ end
39
33
 
40
- def config_file_path
41
- @config_file_path ||= ENV['SOCIAL_CONFIG_PATH']
42
- @config_file_path ||= File.joint(self.config_root, 'social.yml')
43
- end
34
+ def config_root
35
+ @config_root ||= File.join(Rails.root, 'config') if defined?(Rails)
36
+ @config_root ||= ENV['SOCIAL_CONFIG_ROOT']
37
+ @config_root ||= File.join('.', 'config')
38
+ end
44
39
 
45
- def load_config_file
46
- YAML.load_file(config_file_path).with_indifferent_access
47
- end
40
+ def config_file_path
41
+ @config_file_path ||= ENV['SOCIAL_CONFIG_PATH']
42
+ @config_file_path ||= File.join(self.config_root, 'social.yml')
43
+ end
48
44
 
45
+ def load_config_file
46
+ YAML.load_file(config_file_path).with_indifferent_access
49
47
  end
50
48
 
49
+
51
50
  end
52
51
  end
@@ -1,11 +1,14 @@
1
1
  module Social
2
- module Config
2
+ class Config
3
3
  module Ok
4
- include Social::Config
5
-
6
4
  def config
7
- env = ENV['APP_ENV'] || ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development'
8
- super['ok'][]
5
+ unless @config
6
+ @env = ENV['APP_ENV'] || ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development'
7
+ @config_ins = Social::Config.new('ok')
8
+ @config = @config_ins.config['ok'][@env]
9
+ end
10
+
11
+ @config
9
12
  end
10
13
  end
11
14
  end
@@ -1,13 +1,18 @@
1
1
  module Social
2
- module Config
2
+ class Config
3
3
  module Vk
4
- include Social::Config
5
4
 
6
5
  def config
7
- env = ENV['APP_ENV'] || ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development'
8
- super['vk'][env.to_s]
6
+
7
+ unless @config
8
+ @env = ENV['APP_ENV'] || ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development'
9
+ @config_ins = Social::Config.new('vk')
10
+ @config = @config_ins.config['vk'][@env]
11
+ end
9
12
 
13
+ @config
10
14
  end
15
+
11
16
  end
12
17
  end
13
18
  end
@@ -1,3 +1,3 @@
1
1
  module Social
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
24
24
  s.add_development_dependency 'rack', '~> 1.4.1'
25
25
  s.add_development_dependency 'rack-test', '~> 0.6.1'
26
26
  s.add_development_dependency "rr", "~> 1.0"
27
+ s.add_development_dependency "pry", "~> 0.9.8.4"
27
28
  s.add_development_dependency 'activesupport', "~> 3.1.3"
28
29
  s.add_development_dependency 'i18n', '~> 0.6.0'
29
30
  end
@@ -4,9 +4,24 @@ describe Social do
4
4
 
5
5
  it "support ok" do
6
6
  Social::Network(:ok).user.should_not be_nil
7
+ Social::Network(:ok).rate.should_not be_nil
7
8
  end
8
9
 
9
10
  it "support vk" do
10
11
  Social::Network(:vk).user.should_not be_nil
12
+ Social::Network(:vk).rate.should_not be_nil
13
+ end
14
+
15
+ it "must load config to vk" do
16
+ Social::Network(:vk).config.should_not be_nil
17
+ Social::Network(:vk).config['key'].should_not be_nil
18
+ Social::Network(:vk).config['app_id'].should_not be_nil
19
+ end
20
+
21
+ it "must load config to vk" do
22
+ Social::Network(:ok).config.should_not be_nil
23
+ Social::Network(:ok).config['api_server'].should_not be_nil
24
+ Social::Network(:ok).config['application_key'].should_not be_nil
25
+ Social::Network(:ok).config['secret_key'].should_not be_nil
11
26
  end
12
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-12 00:00:00.000000000Z
12
+ date: 2012-03-24 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec-core
16
- requirement: &70103475836660 !ruby/object:Gem::Requirement
16
+ requirement: &70327502176360 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2.0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70103475836660
24
+ version_requirements: *70327502176360
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec-expectations
27
- requirement: &70103475835920 !ruby/object:Gem::Requirement
27
+ requirement: &70327502175840 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '2.0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70103475835920
35
+ version_requirements: *70327502175840
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rack
38
- requirement: &70103475835060 !ruby/object:Gem::Requirement
38
+ requirement: &70327502175380 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.4.1
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70103475835060
46
+ version_requirements: *70327502175380
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rack-test
49
- requirement: &70103475834420 !ruby/object:Gem::Requirement
49
+ requirement: &70327502174920 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.6.1
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70103475834420
57
+ version_requirements: *70327502174920
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rr
60
- requirement: &70103475833760 !ruby/object:Gem::Requirement
60
+ requirement: &70327502174420 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,21 @@ dependencies:
65
65
  version: '1.0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70103475833760
68
+ version_requirements: *70327502174420
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: &70327502173960 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: 0.9.8.4
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *70327502173960
69
80
  - !ruby/object:Gem::Dependency
70
81
  name: activesupport
71
- requirement: &70103475833200 !ruby/object:Gem::Requirement
82
+ requirement: &70327502173480 !ruby/object:Gem::Requirement
72
83
  none: false
73
84
  requirements:
74
85
  - - ~>
@@ -76,10 +87,10 @@ dependencies:
76
87
  version: 3.1.3
77
88
  type: :development
78
89
  prerelease: false
79
- version_requirements: *70103475833200
90
+ version_requirements: *70327502173480
80
91
  - !ruby/object:Gem::Dependency
81
92
  name: i18n
82
- requirement: &70103475832600 !ruby/object:Gem::Requirement
93
+ requirement: &70327502173020 !ruby/object:Gem::Requirement
83
94
  none: false
84
95
  requirements:
85
96
  - - ~>
@@ -87,7 +98,7 @@ dependencies:
87
98
  version: 0.6.0
88
99
  type: :development
89
100
  prerelease: false
90
- version_requirements: *70103475832600
101
+ version_requirements: *70327502173020
91
102
  description: ! "This is social networks api wrapper and authorization tools for social
92
103
  applications. \n Now it is a compilation of code from various projects in production.
93
104
  Without tests. =( NOT RECOMMENDED USE IN PRODUCTION."
@@ -103,6 +114,7 @@ files:
103
114
  - LICENSE
104
115
  - README.md
105
116
  - Rakefile
117
+ - config/social.yml
106
118
  - lib/social.rb
107
119
  - lib/social/auth.rb
108
120
  - lib/social/auth/controller.rb