Class: SoftLayer::Messaging::AuthedResource
- Inherits:
-
RestClient::Resource
- Object
- RestClient::Resource
- SoftLayer::Messaging::AuthedResource
- Defined in:
- lib/softlayer/messaging/auth.rb
Instance Method Summary collapse
- #auth ⇒ Object
- #auth=(value) ⇒ Object
- #authed_action(&block) ⇒ Object
- #delete(*args) ⇒ Object
- #get(*args) ⇒ Object
- #head(*args) ⇒ Object
- #patch(*args) ⇒ Object
- #post(*args) ⇒ Object
- #put(*args) ⇒ Object
- #to_s ⇒ Object
Instance Method Details
#auth ⇒ Object
32 33 34 |
# File 'lib/softlayer/messaging/auth.rb', line 32 def auth @options[:auth] end |
#auth=(value) ⇒ Object
36 37 38 |
# File 'lib/softlayer/messaging/auth.rb', line 36 def auth=(value) @options[:auth] = value end |
#authed_action(&block) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/softlayer/messaging/auth.rb', line 40 def authed_action(&block) return block.call if auth.nil? auth. if auth.auth_token.nil? headers['x-auth-token'] = auth.auth_token begin return block.call rescue RestClient::Unauthorized auth. headers['x-auth-token'] = auth.auth_token return block.call end end |
#delete(*args) ⇒ Object
75 76 77 |
# File 'lib/softlayer/messaging/auth.rb', line 75 def delete(*args) authed_action{ super(*args) } end |
#get(*args) ⇒ Object
55 56 57 |
# File 'lib/softlayer/messaging/auth.rb', line 55 def get(*args) authed_action{ super(*args) } end |
#head(*args) ⇒ Object
59 60 61 |
# File 'lib/softlayer/messaging/auth.rb', line 59 def head(*args) authed_action{ super(*args) } end |
#patch(*args) ⇒ Object
71 72 73 |
# File 'lib/softlayer/messaging/auth.rb', line 71 def patch(*args) authed_action{ super(*args) } end |
#post(*args) ⇒ Object
63 64 65 |
# File 'lib/softlayer/messaging/auth.rb', line 63 def post(*args) authed_action{ super(*args) } end |
#put(*args) ⇒ Object
67 68 69 |
# File 'lib/softlayer/messaging/auth.rb', line 67 def put(*args) authed_action{ super(*args) } end |
#to_s ⇒ Object
79 80 81 |
# File 'lib/softlayer/messaging/auth.rb', line 79 def to_s "AuthedResource<#{@url}>" end |