Class: Hook0::Generated::EventsPerDayEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/hook0/generated/models.rb

Overview

The EventsPerDayEntry the API declares.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(amount:, application_id:, application_name:, date:, is_provisional:) ⇒ EventsPerDayEntry

Returns a new instance of EventsPerDayEntry.

Parameters:

  • amount (Integer)

    carries amount.

  • application_id (String)

    carries application_id.

  • application_name (String)

    carries application_name.

  • date (Date)

    carries date.

  • is_provisional (Boolean)

    carries is_provisional.



1140
1141
1142
1143
1144
1145
1146
1147
# File 'lib/hook0/generated/models.rb', line 1140

def initialize(amount:, application_id:, application_name:, date:, is_provisional:)
  @amount = amount
  @application_id = application_id
  @application_name = application_name
  @date = date
  @is_provisional = is_provisional
  freeze
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



1129
1130
1131
# File 'lib/hook0/generated/models.rb', line 1129

def amount
  @amount
end

#application_idObject (readonly)

Returns the value of attribute application_id.



1129
1130
1131
# File 'lib/hook0/generated/models.rb', line 1129

def application_id
  @application_id
end

#application_nameObject (readonly)

Returns the value of attribute application_name.



1129
1130
1131
# File 'lib/hook0/generated/models.rb', line 1129

def application_name
  @application_name
end

#dateObject (readonly)

Returns the value of attribute date.



1129
1130
1131
# File 'lib/hook0/generated/models.rb', line 1129

def date
  @date
end

#is_provisionalObject (readonly)

Returns the value of attribute is_provisional.



1129
1130
1131
# File 'lib/hook0/generated/models.rb', line 1129

def is_provisional
  @is_provisional
end

Class Method Details

.from_json(value) ⇒ EventsPerDayEntry

Read one out of what the API answered.

Parameters:

  • value (Object)

    the JSON document the API answered

Returns:



1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
# File 'lib/hook0/generated/models.rb', line 1153

def self.from_json(value)
  fields = Runtime.as_fields(value, "EventsPerDayEntry")
  new(
    amount: Runtime.read(fields, "amount", Runtime::INTEGER),
    application_id: Runtime.read(fields, "application_id", Runtime::UUID),
    application_name: Runtime.read(fields, "application_name", Runtime::TEXT),
    date: Runtime.read(fields, "date", Runtime::DATE),
    is_provisional: Runtime.read(fields, "is_provisional", Runtime::BOOLEAN)
  )
end

Instance Method Details

#==(other) ⇒ Boolean Also known as: eql?

Whether that value carries the same members as this one.

Parameters:

  • other (Object)

Returns:

  • (Boolean)


1181
1182
1183
# File 'lib/hook0/generated/models.rb', line 1181

def ==(other)
  other.is_a?(EventsPerDayEntry) && to_h == other.to_h
end

#hashInteger

A value two equal instances share, so that either may key a hash.

Returns:

  • (Integer)


1189
1190
1191
# File 'lib/hook0/generated/models.rb', line 1189

def hash
  to_h.hash
end

#to_hHash{String => Object}

Write one back the way the API reads it.

Returns:

  • (Hash{String => Object})


1167
1168
1169
1170
1171
1172
1173
1174
1175
# File 'lib/hook0/generated/models.rb', line 1167

def to_h
  out = {}
  out["amount"] = @amount
  out["application_id"] = @application_id
  out["application_name"] = @application_name
  out["date"] = Runtime.day(@date)
  out["is_provisional"] = @is_provisional
  out
end