Class: Square::Connect::Node
- Inherits:
-
Object
- Object
- Square::Connect::Node
- Defined in:
- lib/square/connect/node.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#identifier ⇒ Object
Returns the value of attribute identifier.
Instance Method Summary collapse
- #fetch ⇒ Object
-
#initialize(*args) {|attributes| ... } ⇒ Node
constructor
A new instance of Node.
Constructor Details
#initialize(*args) {|attributes| ... } ⇒ Node
Returns a new instance of Node.
6 7 8 9 10 11 12 |
# File 'lib/square/connect/node.rb', line 6 def initialize(*args) attributes = args. self.identifier = attributes[:id] || attributes[:identifier] || args.first self.access_token = tokenize attributes[:access_token] || args.second yield attributes if block_given? self.endpoint ||= endpoint_for identifier end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
4 5 6 |
# File 'lib/square/connect/node.rb', line 4 def access_token @access_token end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
4 5 6 |
# File 'lib/square/connect/node.rb', line 4 def endpoint @endpoint end |
#identifier ⇒ Object
Returns the value of attribute identifier.
4 5 6 |
# File 'lib/square/connect/node.rb', line 4 def identifier @identifier end |
Instance Method Details
#fetch ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/square/connect/node.rb', line 14 def fetch access_token_required! attributes = handle_response do access_token.get endpoint end self.class.new attributes.merge( access_token: access_token ) end |