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