Class: UserSchemas
Instance Method Summary
collapse
#delete_resource, #get_resource, #initialize, #parse_response, #patch_resource, #post_resource, #post_resource_with_string_result, #put_resource, #return_uri
Methods inherited from CheckValues
#check_boolean, #check_int, #check_json, #check_string
Constructor Details
This class inherits a constructor from ChinoBaseAPI
Instance Method Details
#create_user_schema(description, fields) ⇒ Object
636
637
638
639
640
641
642
643
|
# File 'lib/chino_ruby.rb', line 636
def create_user_schema(description, fields)
check_string(description)
check_json(fields)
data = {"description": description, "structure": { "fields": fields}}.to_json
schema = UserSchema.new
schema.from_json(post_resource("/user_schemas", data).to_json, true)
schema
end
|
#delete_user_schema(user_schema_id, force) ⇒ Object
655
656
657
658
659
|
# File 'lib/chino_ruby.rb', line 655
def delete_user_schema(user_schema_id, force)
check_string(user_schema_id)
check_boolean(force)
delete_resource("/user_schemas/#{user_schema_id}", force)
end
|
#get_user_schema(user_schema_id) ⇒ Object
612
613
614
615
616
617
|
# File 'lib/chino_ruby.rb', line 612
def get_user_schema(user_schema_id)
check_string(user_schema_id)
u = UserSchema.new
u.from_json(get_resource("/user_schemas/#{user_schema_id}").to_json, true)
u
end
|
#list_user_schemas(limit = nil, offset = nil) ⇒ Object
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
|
# File 'lib/chino_ruby.rb', line 619
def list_user_schemas(limit=nil, offset=nil)
schemas = GetUserSchemasResponse.new
if limit==nil && offset==nil
schemas.from_json(get_resource("/user_schemas", ChinoRuby::QUERY_DEFAULT_LIMIT, 0).to_json)
else
schemas.from_json(get_resource("/user_schemas", limit, offset).to_json)
end
us = schemas.user_schemas
schemas.user_schemas = []
us.each do |u|
schema = UserSchema.new
schema.from_json(u.to_json)
schemas.user_schemas.push(schema)
end
schemas
end
|
#update_user_schema(user_schema_id, description, fields) ⇒ Object
645
646
647
648
649
650
651
652
653
|
# File 'lib/chino_ruby.rb', line 645
def update_user_schema(user_schema_id, description, fields)
check_string(user_schema_id)
check_string(description)
check_json(fields)
data = {"description": description, "structure": { "fields": fields}}.to_json
schema = UserSchema.new
schema.from_json(put_resource("/user_schemas/#{user_schema_id}", data).to_json, true)
schema
end
|