Class: Ey::Core::Client::Token

Inherits:
Model
  • Object
show all
Defined in:
lib/ey-core/models/token.rb

Instance Method Summary collapse

Methods inherited from Model

#destroy, range_parser, #save, #to_s, #update!, #url

Instance Method Details

#save!Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ey-core/models/token.rb', line 11

def save!
  params = {
    "on_behalf_of" => {
      "id"   => self.on_behalf_of.id,
      "type" => self.on_behalf_of.class.api_name,
    }
  }
  if new_record?
    merge_attributes(self.connection.create_token(params).body["token"])
  else raise NotImplementedError # update
  end
end