Class: Stackd::Token
- Inherits:
-
Object
- Object
- Stackd::Token
- Includes:
- Concerns::RequireAttr, Concerns::TattrAccessor
- Defined in:
- lib/stackd/token.rb
Class Method Summary collapse
Instance Method Summary collapse
- #delete(*args) ⇒ Object
- #get(*args) ⇒ Object
-
#initialize(client, attrs = {}) ⇒ Token
constructor
A new instance of Token.
- #patch(*args) ⇒ Object
- #post(*args) ⇒ Object
- #put(*args) ⇒ Object
Methods included from Concerns::RequireAttr
Methods included from Concerns::TattrAccessor
Constructor Details
#initialize(client, attrs = {}) ⇒ Token
Returns a new instance of Token.
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/stackd/token.rb', line 23 def initialize client, attrs = {} self.client = client attrs.each do |key, val| public_send :"#{key}=", val if tattr? key end begin require_attr! :client, :access_token, :token_type rescue Concerns::RequireAttr::AttrNotSetError => e raise ArgumentError.new e. end end |
Class Method Details
.on_grant(&block) ⇒ Object
19 20 21 |
# File 'lib/stackd/token.rb', line 19 def self.on_grant &block @_on_grant_callbacks.push block end |
Instance Method Details
#delete(*args) ⇒ Object
65 66 67 68 69 70 71 |
# File 'lib/stackd/token.rb', line 65 def delete *args url_args = reject_body_arg *args body_arg = get_body_arg *args content_type = content_type_for body_arg Util::HTTP.delete self, get_url(*url_args), body_arg, content_type end |
#get(*args) ⇒ Object
37 38 39 |
# File 'lib/stackd/token.rb', line 37 def get *args Util::HTTP.get self, get_url(*args) end |
#patch(*args) ⇒ Object
57 58 59 60 61 62 63 |
# File 'lib/stackd/token.rb', line 57 def patch *args url_args = reject_body_arg *args body_arg = get_body_arg *args content_type = content_type_for body_arg Util::HTTP.patch self, get_url(*url_args), body_arg, content_type end |