biola_web_services 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,37 +3,91 @@ module BiolaWebServices
3
3
  require 'rest_client'
4
4
  require 'json'
5
5
 
6
- mattr_accessor :url
7
- self.url = 'https://ws.biola.edu'
6
+ def self.url
7
+ @@url ||= 'https://ws.biola.edu'
8
+ end
9
+
10
+ def self.url=(url)
11
+ @@url = url
12
+ end
13
+
14
+ def self.auth_type
15
+ @@auth_type ||= :cert
16
+ end
17
+
18
+ def self.auth_type=(auth_type)
19
+ unless [:cert, :login].include? auth_type
20
+ raise ArgumentError, 'Valid types are :cert and :login'
21
+ end
22
+
23
+ @@auth_type = auth_type.to_sym
24
+ end
25
+
26
+ def self.cert_path
27
+ @@cert_path.to_s
28
+ end
29
+
30
+ def self.cert_path=(cert_path)
31
+ @@cert_path = cert_path
32
+ end
8
33
 
9
- mattr_accessor :auth_type
10
- self.auth_type = :cert # :cert or :login
34
+ def self.key_path
35
+ @@key_path.to_s
36
+ end
11
37
 
12
- mattr_accessor :cert_path
13
- self.cert_path = ''
38
+ def self.key_path=(key_path)
39
+ @@key_path = key_path
40
+ end
14
41
 
15
- mattr_accessor :key_path
16
- self.key_path = ''
42
+ def self.key_password
43
+ @@key_password.to_s
44
+ end
45
+
46
+ def self.key_password=(key_password)
47
+ @@key_password = key_password
48
+ end
17
49
 
18
- mattr_accessor :key_password
19
- self.key_password = ''
50
+ def self.username
51
+ @@username.to_s
52
+ end
20
53
 
21
- mattr_accessor :username
22
- self.username = ''
54
+ def self.username=(username)
55
+ @@username = username
56
+ end
23
57
 
24
- mattr_accessor :password
25
- self.password = ''
58
+ def self.password
59
+ @@password.to_s
60
+ end
61
+
62
+ def self.password=(password)
63
+ @@pasword = password
64
+ end
26
65
 
27
- mattr_accessor :verify_ssl
28
- self.verify_ssl = true
66
+ def self.verify_ssl
67
+ @@verify_ssl ||= true
68
+ end
69
+
70
+ def self.verify_ssl=(verify_ssl)
71
+ @@verify_ssl = verify_ssl
72
+ end
29
73
 
30
74
  private
31
75
 
32
- mattr_accessor :cert
33
- self.cert = nil
76
+ def self.cert
77
+ @@cert ||= nil
78
+ end
79
+
80
+ def self.cert=(cert)
81
+ @@cert = cert
82
+ end
34
83
 
35
- mattr_accessor :key
36
- self.key = nil
84
+ def self.key
85
+ @@key ||= nil
86
+ end
87
+
88
+ def self.key=(key)
89
+ @@key = key
90
+ end
37
91
 
38
92
  def self.connect_with_cert(service_name)
39
93
 
@@ -72,8 +126,8 @@ module BiolaWebServices
72
126
  end
73
127
  end
74
128
 
75
- def self.method_missing(m)
129
+ def self.method_missing(m, *args)
76
130
  BiolaWebServices::Service.new(m)
77
131
  end
78
132
 
79
- end
133
+ end
@@ -21,7 +21,7 @@ module BiolaWebServices
21
21
 
22
22
  def method_missing(m, *args)
23
23
 
24
- method_name = m.to_s.camelcase.delete('?!')
24
+ method_name = ruby_to_ws_method_name(m)
25
25
  modifier = m.to_s[-1, 1]
26
26
  args = args[0] if args.length == 1
27
27
 
@@ -41,6 +41,11 @@ module BiolaWebServices
41
41
 
42
42
  end
43
43
 
44
+ # Basically just a stripped down, customized version of Rails' camelize
45
+ def ruby_to_ws_method_name(method_name)
46
+ method_name.to_s.gsub(/(^|_)(.)/) { $2.upcase }.delete('?!')
47
+ end
48
+
44
49
  end
45
50
 
46
51
  end
@@ -1,5 +1,5 @@
1
1
  module BiolaWebServices
2
2
 
3
- VERSION = '0.1.2'
3
+ VERSION = '0.1.3'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,99 +1,70 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: biola_web_services
3
- version: !ruby/object:Gem::Version
4
- hash: 31
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 2
10
- version: 0.1.2
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Adam Crownoble
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-05-26 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-03-16 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: rest-client
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &82335240 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
18
+ requirements:
26
19
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 15
29
- segments:
30
- - 1
31
- - 6
32
- - 0
20
+ - !ruby/object:Gem::Version
33
21
  version: 1.6.0
34
22
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: json
38
23
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *82335240
25
+ - !ruby/object:Gem::Dependency
26
+ name: json
27
+ requirement: &82334560 !ruby/object:Gem::Requirement
40
28
  none: false
41
- requirements:
29
+ requirements:
42
30
  - - ~>
43
- - !ruby/object:Gem::Version
44
- hash: 3
45
- segments:
46
- - 1
47
- - 5
48
- - 0
31
+ - !ruby/object:Gem::Version
49
32
  version: 1.5.0
50
33
  type: :runtime
51
- version_requirements: *id002
34
+ prerelease: false
35
+ version_requirements: *82334560
52
36
  description: Simple Ruby wrapper for Biola Web Services REST calls
53
37
  email: adam.crownoble@biola.edu
54
38
  executables: []
55
-
56
39
  extensions: []
57
-
58
40
  extra_rdoc_files: []
59
-
60
- files:
41
+ files:
61
42
  - lib/biola_web_services.rb
62
43
  - lib/biola_web_services/version.rb
63
44
  - lib/biola_web_services/biola_web_services.rb
64
45
  - lib/biola_web_services/service.rb
65
46
  homepage: http://biola.edu/it
66
47
  licenses: []
67
-
68
48
  post_install_message:
69
49
  rdoc_options: []
70
-
71
- require_paths:
50
+ require_paths:
72
51
  - lib
73
- required_ruby_version: !ruby/object:Gem::Requirement
52
+ required_ruby_version: !ruby/object:Gem::Requirement
74
53
  none: false
75
- requirements:
76
- - - ">="
77
- - !ruby/object:Gem::Version
78
- hash: 3
79
- segments:
80
- - 0
81
- version: "0"
82
- required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
59
  none: false
84
- requirements:
85
- - - ">="
86
- - !ruby/object:Gem::Version
87
- hash: 3
88
- segments:
89
- - 0
90
- version: "0"
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
91
64
  requirements: []
92
-
93
65
  rubyforge_project:
94
- rubygems_version: 1.8.4
66
+ rubygems_version: 1.8.16
95
67
  signing_key:
96
68
  specification_version: 3
97
69
  summary: Biola Web Services helper methods
98
70
  test_files: []
99
-