Class: NotionRubyMapping::StatusProperty

Inherits:
Property
  • Object
show all
Includes:
EqualsDoesNotEqual, IsEmptyIsNotEmpty
Defined in:
lib/notion_ruby_mapping/properties/status_property.rb

Overview

Status property

Constant Summary collapse

TYPE =
"status"

Instance Attribute Summary

Attributes inherited from Property

#name, #property_cache, #property_id, #will_update

Instance Method Summary collapse

Methods included from IsEmptyIsNotEmpty

#filter_is_empty, #filter_is_not_empty

Methods included from EqualsDoesNotEqual

#filter_does_not_equal, #filter_equals

Methods inherited from Property

#assert_database_property, #assert_page_property, #clear_will_update, #contents?, create_from_json, #database?, #make_filter_query, #new_name=, #page?, #property_schema_json, #remove, #retrieve_page_property, #type, #update_from_json, #update_property_schema_json

Constructor Details

#initialize(name, will_update: false, base_type: "page", property_id: nil, property_cache: nil, json: {}) ⇒ StatusProperty

Returns a new instance of StatusProperty.

Parameters:

  • name (String, Symbol)

    Property name

  • json (Boolean, Hash) (defaults to: {})


44
45
46
47
48
# File 'lib/notion_ruby_mapping/properties/status_property.rb', line 44

def initialize(name, will_update: false, base_type: "page", property_id: nil, property_cache: nil, json: {})
  super name, will_update: will_update, base_type: base_type, property_id: property_id,
              property_cache: property_cache
  @json = json
end

Instance Method Details

#property_values_jsonHash

Returns:

  • (Hash)


53
54
55
56
# File 'lib/notion_ruby_mapping/properties/status_property.rb', line 53

def property_values_json
  assert_page_property __method__
  {@name => {"status" => @json, "type" => "status"}}
end

#statusObject



15
16
17
# File 'lib/notion_ruby_mapping/properties/status_property.rb', line 15

def status
  @json
end

#status=(status) ⇒ Object



32
33
34
35
36
# File 'lib/notion_ruby_mapping/properties/status_property.rb', line 32

def status=(status)
  assert_page_property __method__
  @will_update = true
  @json = {"name" => status}
end

#status_nameString



23
24
25
26
# File 'lib/notion_ruby_mapping/properties/status_property.rb', line 23

def status_name
  assert_page_property __method__
  @json["name"]
end