Class: Dato::Site::Repo::Field
- Inherits:
-
Base
- Object
- Base
- Dato::Site::Repo::Field
show all
- Defined in:
- lib/dato/site/repo/field.rb
Instance Attribute Summary
Attributes inherited from Base
#client
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#all(item_type_id) ⇒ Object
27
28
29
|
# File 'lib/dato/site/repo/field.rb', line 27
def all(item_type_id)
get_request "/item-types/#{item_type_id}/fields"
end
|
#create(item_type_id, resource_attributes) ⇒ Object
8
9
10
11
12
13
14
15
16
|
# File 'lib/dato/site/repo/field.rb', line 8
def create(item_type_id, resource_attributes)
body = JsonApiSerializer.new(
type: :field,
attributes: %i(api_key appeareance field_type hint label localized position validators),
required_attributes: %i(api_key appeareance field_type hint label localized position validators)
).serialize(resource_attributes)
post_request "/item-types/#{item_type_id}/fields", body
end
|
#destroy(field_id) ⇒ Object
35
36
37
|
# File 'lib/dato/site/repo/field.rb', line 35
def destroy(field_id)
delete_request "/fields/#{field_id}"
end
|
#find(field_id) ⇒ Object
31
32
33
|
# File 'lib/dato/site/repo/field.rb', line 31
def find(field_id)
get_request "/fields/#{field_id}"
end
|
#update(field_id, resource_attributes) ⇒ Object
18
19
20
21
22
23
24
25
|
# File 'lib/dato/site/repo/field.rb', line 18
def update(field_id, resource_attributes)
body = JsonApiSerializer.new(
type: :field,
attributes: %i(api_key appeareance hint label localized position validators)
).serialize(resource_attributes, field_id)
put_request "/fields/#{field_id}", body
end
|