Class: Basecamp::Types::Draft

Inherits:
Object
  • Object
show all
Includes:
TypeHelpers
Defined in:
lib/basecamp/generated/types.rb

Overview

Draft

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data = {}) ⇒ Draft

Returns a new instance of Draft.



1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
# File 'lib/basecamp/generated/types.rb', line 1486

def initialize(data = {})
  @app_url = data["app_url"]
  @bucket = parse_type(data["bucket"], "DraftBucket")
  @created_at = parse_datetime(data["created_at"])
  @excerpt = data["excerpt"]
  @id = parse_integer(data["id"])
  @parent = data["parent"]
  @scheduled_posting_at = data["scheduled_posting_at"]
  @title = data["title"]
  @type = data["type"]
  @updated_at = parse_datetime(data["updated_at"])
end

Instance Attribute Details

#app_urlObject

Returns the value of attribute app_url.



1479
1480
1481
# File 'lib/basecamp/generated/types.rb', line 1479

def app_url
  @app_url
end

#bucketObject

Returns the value of attribute bucket.



1479
1480
1481
# File 'lib/basecamp/generated/types.rb', line 1479

def bucket
  @bucket
end

#created_atObject

Returns the value of attribute created_at.



1479
1480
1481
# File 'lib/basecamp/generated/types.rb', line 1479

def created_at
  @created_at
end

#excerptObject

Returns the value of attribute excerpt.



1479
1480
1481
# File 'lib/basecamp/generated/types.rb', line 1479

def excerpt
  @excerpt
end

#idObject

Returns the value of attribute id.



1479
1480
1481
# File 'lib/basecamp/generated/types.rb', line 1479

def id
  @id
end

#parentObject

Returns the value of attribute parent.



1479
1480
1481
# File 'lib/basecamp/generated/types.rb', line 1479

def parent
  @parent
end

#scheduled_posting_atObject

Returns the value of attribute scheduled_posting_at.



1479
1480
1481
# File 'lib/basecamp/generated/types.rb', line 1479

def scheduled_posting_at
  @scheduled_posting_at
end

#titleObject

Returns the value of attribute title.



1479
1480
1481
# File 'lib/basecamp/generated/types.rb', line 1479

def title
  @title
end

#typeObject

Returns the value of attribute type.



1479
1480
1481
# File 'lib/basecamp/generated/types.rb', line 1479

def type
  @type
end

#updated_atObject

Returns the value of attribute updated_at.



1479
1480
1481
# File 'lib/basecamp/generated/types.rb', line 1479

def updated_at
  @updated_at
end

Class Method Details

.required_fieldsArray<Symbol>

Returns:

  • (Array<Symbol>)


1482
1483
1484
# File 'lib/basecamp/generated/types.rb', line 1482

def self.required_fields
  %i[app_url bucket created_at excerpt id parent scheduled_posting_at title type updated_at].freeze
end

Instance Method Details

#to_hObject



1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
# File 'lib/basecamp/generated/types.rb', line 1499

def to_h
  {
    "app_url" => @app_url,
    "bucket" => @bucket,
    "created_at" => @created_at,
    "excerpt" => @excerpt,
    "id" => @id,
    "parent" => @parent,
    "scheduled_posting_at" => @scheduled_posting_at,
    "title" => @title,
    "type" => @type,
    "updated_at" => @updated_at,
  }.reject { |k, v| v.nil? && !["scheduled_posting_at"].include?(k) }
end

#to_json(*args) ⇒ Object



1514
1515
1516
# File 'lib/basecamp/generated/types.rb', line 1514

def to_json(*args)
  to_h.to_json(*args)
end