samenessed 0.1.1 → 0.1.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 02eed8b5764172e17aababeaf660ec37000c88f1
4
- data.tar.gz: 8e6c687cb47cbd646275b39b7b15c7fba930d278
5
- SHA512:
6
- metadata.gz: b529edd520d28496938ad2594f8ebf420bd13be9c51760bf46191be836a3874a7b2ae2722391467a32d6cdd5155506aacf39260e2601f881d1860908350ff532
7
- data.tar.gz: 2fa2ddb62f46282e153780e220a80506cf5f4891307954a07619c39792380688aa1d09740a7fb4bfc7ff630fe35eace43d218f8cfe73b6d4319af254349a8191
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZDk3NmEzZjEzNWZkYmI3NTZiODU3ZGZlN2RlNGQyOWMzNmM0NDlkYQ==
5
+ data.tar.gz: !binary |-
6
+ MzM5MGQzZTk0NDVkMDgwZjdlOWZiN2Y5OTJjYzVkODU3NTI1ODllNQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MWM5N2M1Y2EyNDNmYjczMDRmNjNmZjRlNzc0NDY3ZjA3OWFhNjgwNWIxY2Zm
10
+ MGRmZTRjNjZhOWE2MGEyMThhNmIxMzlmN2QxNzhkNDlhOTc1MmEwY2Q2MTM5
11
+ MGVjYjc2YTI4ZGIzNzVhMzE3ODQ0ODcyMjYwNTE1NDE4NTMyYTE=
12
+ data.tar.gz: !binary |-
13
+ YTExNDU4Y2E4MTIyY2FlNzJkMjI5OWQyM2RiYzlmMjk4NmFiYjYyOTBlZjc4
14
+ OGYyYzgzMWI5Nzc1NGEwNjYzNDQyNzJlZjRkNTZkNjJjNTc1Zjc1NWNjYmZk
15
+ MmVjZDU1ZDVjNjcwOTdkMTQ5NGJlM2FhYTcyZjYzNGM5NDZhODE=
data/README.md CHANGED
@@ -18,7 +18,7 @@ Or install it yourself as:
18
18
 
19
19
  ## Prerequisites
20
20
 
21
- Ensure to call Samenessed.load_config_file(path_to_your_config_file) before issuing any functions. You can include this line in an initializer wihtin your rails application.
21
+ Ensure to call Samenessed.load_config_file(path_to_your_config_file) for loading the configuration from a config file or Samenessed.load_config_from_hash({ :site => "sameness.example.com", :user => 'my_user', :password => 'my_password' }) for loading a configuration hash before issuing any functions. You can include this line in an initializer wihtin your rails application.
22
22
 
23
23
  ## Usage
24
24
 
data/lib/samenessed.rb CHANGED
@@ -14,6 +14,7 @@ module Samenessed
14
14
  @site = config["site"]
15
15
  @user = config["user"]
16
16
  @password = config["password"]
17
+ init_class_connections
17
18
  return config
18
19
  end
19
20
 
@@ -21,6 +22,7 @@ module Samenessed
21
22
  @site = hash[:site]
22
23
  @user = hash[:user]
23
24
  @password = hash[:password]
25
+ init_class_connections
24
26
  return hash
25
27
  end
26
28
 
@@ -40,4 +42,17 @@ module Samenessed
40
42
  def self.password
41
43
  @password
42
44
  end
45
+
46
+ private
47
+
48
+ def self.init_class_connections
49
+ Samenessed::Principal.site = site
50
+ Samenessed::Principal.user = user
51
+ Samenessed::Principal.password = password
52
+
53
+ Samenessed::Subject.site = site
54
+ Samenessed::Subject.user = user
55
+ Samenessed::Subject.password = password
56
+ end
57
+
43
58
  end
@@ -11,11 +11,7 @@ module Samenessed
11
11
  # - from_account_name : The id of the origin account
12
12
  # - to_account_type : The type of the target account
13
13
  def self.fetch_identity(from_account_type, from_account_name, to_account_type)
14
- raise ArgumentError, "No from account type given!" if from_account_type.nil?
15
- raise ArgumentError, "No from account name given!" if from_account_name.nil?
16
- raise ArgumentError, "No to account type given!" if to_account_type.nil?
17
-
18
- h = Principal.get(:fetch, { :from => { :account_type => from_account_type, :name => from_account_name }, :to => { :account_type => to_account_type } } )
14
+ h = fetch_principal from_account_type, from_account_name, to_account_type
19
15
 
20
16
  unless h.nil?
21
17
  h["name"]
@@ -23,5 +19,15 @@ module Samenessed
23
19
  nil
24
20
  end
25
21
  end
22
+
23
+ def self.fetch_principal(from_account_type, from_account_name, to_account_type)
24
+ raise ArgumentError, "No from account type given!" if from_account_type.nil?
25
+ raise ArgumentError, "No from account name given!" if from_account_name.nil?
26
+ raise ArgumentError, "No to account type given!" if to_account_type.nil?
27
+
28
+ h = Principal.get(:fetch, { :from => { :account_type => from_account_type, :name => from_account_name }, :to => { :account_type => to_account_type } } )
29
+
30
+ return h
31
+ end
26
32
  end
27
33
  end
@@ -1,3 +1,3 @@
1
1
  module Samenessed
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: samenessed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Weber
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-23 00:00:00.000000000 Z
11
+ date: 2013-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -28,56 +28,56 @@ dependencies:
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ! '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ! '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: pry
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ! '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pry-debugger
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ! '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: activeresource
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ! '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ! '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: Samenessed provides access to the sameness service using simple object
@@ -109,17 +109,17 @@ require_paths:
109
109
  - lib
110
110
  required_ruby_version: !ruby/object:Gem::Requirement
111
111
  requirements:
112
- - - '>='
112
+ - - ! '>='
113
113
  - !ruby/object:Gem::Version
114
114
  version: '0'
115
115
  required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  requirements:
117
- - - '>='
117
+ - - ! '>='
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  requirements: []
121
121
  rubyforge_project:
122
- rubygems_version: 2.0.6
122
+ rubygems_version: 2.0.7
123
123
  signing_key:
124
124
  specification_version: 4
125
125
  summary: A sameness access gem.