Class: Craftar::Token
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#resource_uri ⇒ Object
readonly
Returns the value of attribute resource_uri.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Class Method Summary collapse
Instance Method Summary collapse
- #destroy ⇒ Object
- #find(token) ⇒ Object
-
#initialize(opts) ⇒ Token
constructor
A new instance of Token.
- #save ⇒ Object
Methods inherited from Base
basic_options, create, find, list, parse_response
Constructor Details
#initialize(opts) ⇒ Token
Returns a new instance of Token.
8 9 10 11 12 |
# File 'lib/craftar/token.rb', line 8 def initialize(opts) @collection = opts[:collection] @token = opts[:token] @resource_uri = opts[:resource_uri] end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
3 4 5 |
# File 'lib/craftar/token.rb', line 3 def collection @collection end |
#resource_uri ⇒ Object (readonly)
Returns the value of attribute resource_uri.
3 4 5 |
# File 'lib/craftar/token.rb', line 3 def resource_uri @resource_uri end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
3 4 5 |
# File 'lib/craftar/token.rb', line 3 def token @token end |
Class Method Details
.craftar_name ⇒ Object
4 5 6 |
# File 'lib/craftar/token.rb', line 4 def self.craftar_name 'token' end |
Instance Method Details
#destroy ⇒ Object
25 26 27 |
# File 'lib/craftar/token.rb', line 25 def destroy self.class.delete("/token/#{@token}/", self.class.) end |
#find(token) ⇒ Object
21 22 23 |
# File 'lib/craftar/token.rb', line 21 def find(token) raise 'You cannot find a token' end |
#save ⇒ Object
14 15 16 17 18 19 |
# File 'lib/craftar/token.rb', line 14 def save response = json_call(:post, collection: @collection) @token = response['token'] @resource_uri = response['resource_uri'] self end |