Class: OCI::MarketplacePublisher::Models::OpnMembership

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/marketplace_publisher/models/opn_membership.rb

Overview

OPN membership information

Constant Summary collapse

OPN_STATUS_ENUM =
[
  OPN_STATUS_ACTIVE = 'ACTIVE'.freeze,
  OPN_STATUS_INACTIVE = 'INACTIVE'.freeze,
  OPN_STATUS_RENEWAL_IN_PROGRESS = 'RENEWAL_IN_PROGRESS'.freeze,
  OPN_STATUS_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ OpnMembership

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):

  • :time_start (DateTime)

    The value to assign to the #time_start property

  • :time_end (DateTime)

    The value to assign to the #time_end property

  • :opn_status (String)

    The value to assign to the #opn_status property

  • :opn_number (String)

    The value to assign to the #opn_number property

  • :opn_membership_type (String)

    The value to assign to the #opn_membership_type property

[View source]

76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/oci/marketplace_publisher/models/opn_membership.rb', line 76

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.time_start = attributes[:'timeStart'] if attributes[:'timeStart']

  raise 'You cannot provide both :timeStart and :time_start' if attributes.key?(:'timeStart') && attributes.key?(:'time_start')

  self.time_start = attributes[:'time_start'] if attributes[:'time_start']

  self.time_end = attributes[:'timeEnd'] if attributes[:'timeEnd']

  raise 'You cannot provide both :timeEnd and :time_end' if attributes.key?(:'timeEnd') && attributes.key?(:'time_end')

  self.time_end = attributes[:'time_end'] if attributes[:'time_end']

  self.opn_status = attributes[:'opnStatus'] if attributes[:'opnStatus']

  raise 'You cannot provide both :opnStatus and :opn_status' if attributes.key?(:'opnStatus') && attributes.key?(:'opn_status')

  self.opn_status = attributes[:'opn_status'] if attributes[:'opn_status']

  self.opn_number = attributes[:'opnNumber'] if attributes[:'opnNumber']

  raise 'You cannot provide both :opnNumber and :opn_number' if attributes.key?(:'opnNumber') && attributes.key?(:'opn_number')

  self.opn_number = attributes[:'opn_number'] if attributes[:'opn_number']

  self.opn_membership_type = attributes[:'opnMembershipType'] if attributes[:'opnMembershipType']

  raise 'You cannot provide both :opnMembershipType and :opn_membership_type' if attributes.key?(:'opnMembershipType') && attributes.key?(:'opn_membership_type')

  self.opn_membership_type = attributes[:'opn_membership_type'] if attributes[:'opn_membership_type']
end

Instance Attribute Details

#opn_membership_typeString

OPN membership type

Returns:

  • (String)

37
38
39
# File 'lib/oci/marketplace_publisher/models/opn_membership.rb', line 37

def opn_membership_type
  @opn_membership_type
end

#opn_numberString

OPN Number number

Returns:

  • (String)

33
34
35
# File 'lib/oci/marketplace_publisher/models/opn_membership.rb', line 33

def opn_number
  @opn_number
end

#opn_statusString

OPN status

Returns:

  • (String)

29
30
31
# File 'lib/oci/marketplace_publisher/models/opn_membership.rb', line 29

def opn_status
  @opn_status
end

#time_endDateTime

OPN membership end date. An RFC3339 formatted datetime string

Returns:

  • (DateTime)

25
26
27
# File 'lib/oci/marketplace_publisher/models/opn_membership.rb', line 25

def time_end
  @time_end
end

#time_startDateTime

OPN membership start date. An RFC3339 formatted datetime string

Returns:

  • (DateTime)

21
22
23
# File 'lib/oci/marketplace_publisher/models/opn_membership.rb', line 21

def time_start
  @time_start
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.

[View source]

40
41
42
43
44
45
46
47
48
49
50
# File 'lib/oci/marketplace_publisher/models/opn_membership.rb', line 40

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'time_start': :'timeStart',
    'time_end': :'timeEnd',
    'opn_status': :'opnStatus',
    'opn_number': :'opnNumber',
    'opn_membership_type': :'opnMembershipType'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.

[View source]

53
54
55
56
57
58
59
60
61
62
63
# File 'lib/oci/marketplace_publisher/models/opn_membership.rb', line 53

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'time_start': :'DateTime',
    'time_end': :'DateTime',
    'opn_status': :'String',
    'opn_number': :'String',
    'opn_membership_type': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared

[View source]

133
134
135
136
137
138
139
140
141
142
# File 'lib/oci/marketplace_publisher/models/opn_membership.rb', line 133

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    time_start == other.time_start &&
    time_end == other.time_end &&
    opn_status == other.opn_status &&
    opn_number == other.opn_number &&
    opn_membership_type == other.opn_membership_type
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself

[View source]

167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/oci/marketplace_publisher/models/opn_membership.rb', line 167

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method
[View source]

147
148
149
# File 'lib/oci/marketplace_publisher/models/opn_membership.rb', line 147

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code

[View source]

156
157
158
# File 'lib/oci/marketplace_publisher/models/opn_membership.rb', line 156

def hash
  [time_start, time_end, opn_status, opn_number, opn_membership_type].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash

[View source]

200
201
202
203
204
205
206
207
208
209
# File 'lib/oci/marketplace_publisher/models/opn_membership.rb', line 200

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object

[View source]

194
195
196
# File 'lib/oci/marketplace_publisher/models/opn_membership.rb', line 194

def to_s
  to_hash.to_s
end