oma 0.0.1a → 0.0.1b

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.
Files changed (2) hide show
  1. data/lib/opensrs/oma.rb +11 -3
  2. metadata +3 -3
@@ -11,12 +11,14 @@ module OpenSRS
11
11
  @base = url
12
12
  @creds = creds
13
13
  end
14
+
15
+ def uri ( method = '' )
16
+ URI.parse( @base )
17
+ end
14
18
 
15
19
  def request(method, params = {})
16
20
  params["credentials"] = @creds
17
21
 
18
- uri = URI.parse( @base + "/" + method.to_s)
19
-
20
22
  http = Net::HTTP.new(uri.host, uri.port)
21
23
  http.use_ssl = true
22
24
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
@@ -39,6 +41,7 @@ module OpenSRS
39
41
  if response["error"] =~ /Invalid credentials supplied in request/
40
42
  raise InvalidCredentials, response["error"]
41
43
  end
44
+ raise Exception, response["error"]
42
45
  end
43
46
  response
44
47
  end
@@ -65,7 +68,11 @@ module OpenSRS
65
68
  @credentials = { :client => "Ruby OpenSRS::OMA 0.01", :user => @username, :password => @password }
66
69
  super( @url, @credentials )
67
70
  end
68
-
71
+
72
+ def uri ( method = @method )
73
+ URI.parse( @base + "/" + method.to_s)
74
+ end
75
+
69
76
  METHODS = %w(
70
77
  add_role
71
78
  authenticate
@@ -124,6 +131,7 @@ module OpenSRS
124
131
  def self.create_methods
125
132
  METHODS.each do |method|
126
133
  define_method method do |*argv|
134
+ @method = method
127
135
  valid?( request method, *argv )
128
136
  end
129
137
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oma
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3314893
4
+ hash: 3314890
5
5
  prerelease: true
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1a
10
- version: 0.0.1a
9
+ - 1b
10
+ version: 0.0.1b
11
11
  platform: ruby
12
12
  authors:
13
13
  - Peter Blair