Class: Latitude::API::Resources::APIKey

Inherits:
APIResource show all
Extended by:
Operations::Create, Operations::Delete, Operations::List, Operations::Update
Defined in:
lib/latitude/api/resources/api_key.rb

Constant Summary

Constants inherited from APIResource

APIResource::READ_ONLY_ATTRIBUTES

Instance Attribute Summary collapse

Attributes inherited from APIResource

#id, #meta, #path_params, #raw_data, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Operations::List

all, list

Methods included from Operations::Create

create

Methods included from Operations::Update

update

Methods included from Operations::Delete

delete

Methods inherited from APIResource

#==, #[], #[]=, #as_json, #attributes, #changed?, class_url, config_source, construct_from, #delete, execute_request, extract_path_params, #hash, id_prefix, #initialize, #inspect, instance_url, #method_missing, path_param_keys, #refresh, resource_path, resource_type, #resource_url, #respond_to_missing?, #save, #to_h, #unsaved_attributes, with_config, #write_attribute

Methods included from Attributes::ClassMethods

#attribute, #attribute_specs

Methods included from Attributes::InstanceMethods

#attribute_spec, #read_attribute, #wrap_attribute

Constructor Details

This class inherits a constructor from Latitude::API::APIResource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Latitude::API::APIResource

Instance Attribute Details

#allowed_ipsString

Returns:

  • (String)


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/latitude/api/resources/api_key.rb', line 26

class APIKey < APIResource
  attribute :name, :string
  attribute :token, :string
  attribute :token_last_slice, :string
  attribute :api_version, :string
  attribute :read_only, :boolean
  attribute :allowed_ips, :string
  attribute :created_at, :time, read_only: true
  attribute :updated_at, :time, read_only: true
  attribute :last_used_at, :time
  attribute :user, Objects::User

  resource_type "api_keys"
  resource_path "/auth/api_keys"
  id_prefix     "tok_"

  extend Operations::List
  extend Operations::Create
  extend Operations::Update
  extend Operations::Delete

  class << self
    def rotate(id, params = {}, opts = {})
      body = JSONAPI.encode(type: resource_type, id: id, attributes: params)
      parsed = execute_request(method: :put, path: instance_url(id), body: body, opts: opts)
      construct_from(parsed, opts: opts)
    end
  end

  def rotate(params = {}, opts = {})
    self.class.rotate(id, params, opts)
  end
end

#api_versionString

Returns:

  • (String)


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/latitude/api/resources/api_key.rb', line 26

class APIKey < APIResource
  attribute :name, :string
  attribute :token, :string
  attribute :token_last_slice, :string
  attribute :api_version, :string
  attribute :read_only, :boolean
  attribute :allowed_ips, :string
  attribute :created_at, :time, read_only: true
  attribute :updated_at, :time, read_only: true
  attribute :last_used_at, :time
  attribute :user, Objects::User

  resource_type "api_keys"
  resource_path "/auth/api_keys"
  id_prefix     "tok_"

  extend Operations::List
  extend Operations::Create
  extend Operations::Update
  extend Operations::Delete

  class << self
    def rotate(id, params = {}, opts = {})
      body = JSONAPI.encode(type: resource_type, id: id, attributes: params)
      parsed = execute_request(method: :put, path: instance_url(id), body: body, opts: opts)
      construct_from(parsed, opts: opts)
    end
  end

  def rotate(params = {}, opts = {})
    self.class.rotate(id, params, opts)
  end
end

#created_atTime (readonly)

Returns:

  • (Time)


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/latitude/api/resources/api_key.rb', line 26

class APIKey < APIResource
  attribute :name, :string
  attribute :token, :string
  attribute :token_last_slice, :string
  attribute :api_version, :string
  attribute :read_only, :boolean
  attribute :allowed_ips, :string
  attribute :created_at, :time, read_only: true
  attribute :updated_at, :time, read_only: true
  attribute :last_used_at, :time
  attribute :user, Objects::User

  resource_type "api_keys"
  resource_path "/auth/api_keys"
  id_prefix     "tok_"

  extend Operations::List
  extend Operations::Create
  extend Operations::Update
  extend Operations::Delete

  class << self
    def rotate(id, params = {}, opts = {})
      body = JSONAPI.encode(type: resource_type, id: id, attributes: params)
      parsed = execute_request(method: :put, path: instance_url(id), body: body, opts: opts)
      construct_from(parsed, opts: opts)
    end
  end

  def rotate(params = {}, opts = {})
    self.class.rotate(id, params, opts)
  end
end

#last_used_atTime

Returns:

  • (Time)


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/latitude/api/resources/api_key.rb', line 26

class APIKey < APIResource
  attribute :name, :string
  attribute :token, :string
  attribute :token_last_slice, :string
  attribute :api_version, :string
  attribute :read_only, :boolean
  attribute :allowed_ips, :string
  attribute :created_at, :time, read_only: true
  attribute :updated_at, :time, read_only: true
  attribute :last_used_at, :time
  attribute :user, Objects::User

  resource_type "api_keys"
  resource_path "/auth/api_keys"
  id_prefix     "tok_"

  extend Operations::List
  extend Operations::Create
  extend Operations::Update
  extend Operations::Delete

  class << self
    def rotate(id, params = {}, opts = {})
      body = JSONAPI.encode(type: resource_type, id: id, attributes: params)
      parsed = execute_request(method: :put, path: instance_url(id), body: body, opts: opts)
      construct_from(parsed, opts: opts)
    end
  end

  def rotate(params = {}, opts = {})
    self.class.rotate(id, params, opts)
  end
end

#nameString

Returns:

  • (String)


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/latitude/api/resources/api_key.rb', line 26

class APIKey < APIResource
  attribute :name, :string
  attribute :token, :string
  attribute :token_last_slice, :string
  attribute :api_version, :string
  attribute :read_only, :boolean
  attribute :allowed_ips, :string
  attribute :created_at, :time, read_only: true
  attribute :updated_at, :time, read_only: true
  attribute :last_used_at, :time
  attribute :user, Objects::User

  resource_type "api_keys"
  resource_path "/auth/api_keys"
  id_prefix     "tok_"

  extend Operations::List
  extend Operations::Create
  extend Operations::Update
  extend Operations::Delete

  class << self
    def rotate(id, params = {}, opts = {})
      body = JSONAPI.encode(type: resource_type, id: id, attributes: params)
      parsed = execute_request(method: :put, path: instance_url(id), body: body, opts: opts)
      construct_from(parsed, opts: opts)
    end
  end

  def rotate(params = {}, opts = {})
    self.class.rotate(id, params, opts)
  end
end

#read_onlyBoolean

Returns:

  • (Boolean)


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/latitude/api/resources/api_key.rb', line 26

class APIKey < APIResource
  attribute :name, :string
  attribute :token, :string
  attribute :token_last_slice, :string
  attribute :api_version, :string
  attribute :read_only, :boolean
  attribute :allowed_ips, :string
  attribute :created_at, :time, read_only: true
  attribute :updated_at, :time, read_only: true
  attribute :last_used_at, :time
  attribute :user, Objects::User

  resource_type "api_keys"
  resource_path "/auth/api_keys"
  id_prefix     "tok_"

  extend Operations::List
  extend Operations::Create
  extend Operations::Update
  extend Operations::Delete

  class << self
    def rotate(id, params = {}, opts = {})
      body = JSONAPI.encode(type: resource_type, id: id, attributes: params)
      parsed = execute_request(method: :put, path: instance_url(id), body: body, opts: opts)
      construct_from(parsed, opts: opts)
    end
  end

  def rotate(params = {}, opts = {})
    self.class.rotate(id, params, opts)
  end
end

#tokenString

Returns:

  • (String)


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/latitude/api/resources/api_key.rb', line 26

class APIKey < APIResource
  attribute :name, :string
  attribute :token, :string
  attribute :token_last_slice, :string
  attribute :api_version, :string
  attribute :read_only, :boolean
  attribute :allowed_ips, :string
  attribute :created_at, :time, read_only: true
  attribute :updated_at, :time, read_only: true
  attribute :last_used_at, :time
  attribute :user, Objects::User

  resource_type "api_keys"
  resource_path "/auth/api_keys"
  id_prefix     "tok_"

  extend Operations::List
  extend Operations::Create
  extend Operations::Update
  extend Operations::Delete

  class << self
    def rotate(id, params = {}, opts = {})
      body = JSONAPI.encode(type: resource_type, id: id, attributes: params)
      parsed = execute_request(method: :put, path: instance_url(id), body: body, opts: opts)
      construct_from(parsed, opts: opts)
    end
  end

  def rotate(params = {}, opts = {})
    self.class.rotate(id, params, opts)
  end
end

#token_last_sliceString

Returns:

  • (String)


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/latitude/api/resources/api_key.rb', line 26

class APIKey < APIResource
  attribute :name, :string
  attribute :token, :string
  attribute :token_last_slice, :string
  attribute :api_version, :string
  attribute :read_only, :boolean
  attribute :allowed_ips, :string
  attribute :created_at, :time, read_only: true
  attribute :updated_at, :time, read_only: true
  attribute :last_used_at, :time
  attribute :user, Objects::User

  resource_type "api_keys"
  resource_path "/auth/api_keys"
  id_prefix     "tok_"

  extend Operations::List
  extend Operations::Create
  extend Operations::Update
  extend Operations::Delete

  class << self
    def rotate(id, params = {}, opts = {})
      body = JSONAPI.encode(type: resource_type, id: id, attributes: params)
      parsed = execute_request(method: :put, path: instance_url(id), body: body, opts: opts)
      construct_from(parsed, opts: opts)
    end
  end

  def rotate(params = {}, opts = {})
    self.class.rotate(id, params, opts)
  end
end

#updated_atTime (readonly)

Returns:

  • (Time)


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/latitude/api/resources/api_key.rb', line 26

class APIKey < APIResource
  attribute :name, :string
  attribute :token, :string
  attribute :token_last_slice, :string
  attribute :api_version, :string
  attribute :read_only, :boolean
  attribute :allowed_ips, :string
  attribute :created_at, :time, read_only: true
  attribute :updated_at, :time, read_only: true
  attribute :last_used_at, :time
  attribute :user, Objects::User

  resource_type "api_keys"
  resource_path "/auth/api_keys"
  id_prefix     "tok_"

  extend Operations::List
  extend Operations::Create
  extend Operations::Update
  extend Operations::Delete

  class << self
    def rotate(id, params = {}, opts = {})
      body = JSONAPI.encode(type: resource_type, id: id, attributes: params)
      parsed = execute_request(method: :put, path: instance_url(id), body: body, opts: opts)
      construct_from(parsed, opts: opts)
    end
  end

  def rotate(params = {}, opts = {})
    self.class.rotate(id, params, opts)
  end
end

#userLatitude::API::Objects::User



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/latitude/api/resources/api_key.rb', line 26

class APIKey < APIResource
  attribute :name, :string
  attribute :token, :string
  attribute :token_last_slice, :string
  attribute :api_version, :string
  attribute :read_only, :boolean
  attribute :allowed_ips, :string
  attribute :created_at, :time, read_only: true
  attribute :updated_at, :time, read_only: true
  attribute :last_used_at, :time
  attribute :user, Objects::User

  resource_type "api_keys"
  resource_path "/auth/api_keys"
  id_prefix     "tok_"

  extend Operations::List
  extend Operations::Create
  extend Operations::Update
  extend Operations::Delete

  class << self
    def rotate(id, params = {}, opts = {})
      body = JSONAPI.encode(type: resource_type, id: id, attributes: params)
      parsed = execute_request(method: :put, path: instance_url(id), body: body, opts: opts)
      construct_from(parsed, opts: opts)
    end
  end

  def rotate(params = {}, opts = {})
    self.class.rotate(id, params, opts)
  end
end

Class Method Details

.rotate(id, params = {}, opts = {}) ⇒ Object



48
49
50
51
52
# File 'lib/latitude/api/resources/api_key.rb', line 48

def rotate(id, params = {}, opts = {})
  body = JSONAPI.encode(type: resource_type, id: id, attributes: params)
  parsed = execute_request(method: :put, path: instance_url(id), body: body, opts: opts)
  construct_from(parsed, opts: opts)
end

Instance Method Details

#rotate(params = {}, opts = {}) ⇒ Object



55
56
57
# File 'lib/latitude/api/resources/api_key.rb', line 55

def rotate(params = {}, opts = {})
  self.class.rotate(id, params, opts)
end