Class: TrueTrial::Types::TemporalElement

Inherits:
Object
  • Object
show all
Defined in:
lib/truetrial/types/temporal_element.rb

Overview

Represents a temporal element (trial, warranty, subscription, etc.) returned from the TrueTrial API.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ TemporalElement

Returns a new instance of TemporalElement.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/truetrial/types/temporal_element.rb', line 12

def initialize(attributes = {})
  @id = attributes["id"]
  @order_id = attributes["order_id"]
  @type = attributes["type"]
  @status = attributes["status"]
  @duration = attributes["duration"]
  @duration_unit = attributes["duration_unit"]
  @begins_at = attributes["begins_at"]
  @expires_at = attributes["expires_at"]
  @converted_at = attributes["converted_at"]
  @cancelled_at = attributes["cancelled_at"]
  @created_at = attributes["created_at"]
  @updated_at = attributes["updated_at"]
end

Instance Attribute Details

#begins_atObject (readonly)

Returns the value of attribute begins_at.



8
9
10
# File 'lib/truetrial/types/temporal_element.rb', line 8

def begins_at
  @begins_at
end

#cancelled_atObject (readonly)

Returns the value of attribute cancelled_at.



8
9
10
# File 'lib/truetrial/types/temporal_element.rb', line 8

def cancelled_at
  @cancelled_at
end

#converted_atObject (readonly)

Returns the value of attribute converted_at.



8
9
10
# File 'lib/truetrial/types/temporal_element.rb', line 8

def converted_at
  @converted_at
end

#created_atObject (readonly)

Returns the value of attribute created_at.



8
9
10
# File 'lib/truetrial/types/temporal_element.rb', line 8

def created_at
  @created_at
end

#durationObject (readonly)

Returns the value of attribute duration.



8
9
10
# File 'lib/truetrial/types/temporal_element.rb', line 8

def duration
  @duration
end

#duration_unitObject (readonly)

Returns the value of attribute duration_unit.



8
9
10
# File 'lib/truetrial/types/temporal_element.rb', line 8

def duration_unit
  @duration_unit
end

#expires_atObject (readonly)

Returns the value of attribute expires_at.



8
9
10
# File 'lib/truetrial/types/temporal_element.rb', line 8

def expires_at
  @expires_at
end

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/truetrial/types/temporal_element.rb', line 8

def id
  @id
end

#order_idObject (readonly)

Returns the value of attribute order_id.



8
9
10
# File 'lib/truetrial/types/temporal_element.rb', line 8

def order_id
  @order_id
end

#statusObject (readonly)

Returns the value of attribute status.



8
9
10
# File 'lib/truetrial/types/temporal_element.rb', line 8

def status
  @status
end

#typeObject (readonly)

Returns the value of attribute type.



8
9
10
# File 'lib/truetrial/types/temporal_element.rb', line 8

def type
  @type
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



8
9
10
# File 'lib/truetrial/types/temporal_element.rb', line 8

def updated_at
  @updated_at
end

Class Method Details

.from_hash(hash) ⇒ TemporalElement

Builds a TemporalElement from an API response hash.

Parameters:

  • hash (Hash)

    raw API response data

Returns:



31
32
33
# File 'lib/truetrial/types/temporal_element.rb', line 31

def self.from_hash(hash)
  new(hash)
end