Class: Gonebusy::EntitiesCategoryResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/gonebusy/models/entities_category_response.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(id = nil, name = nil, short_name = nil, long_name = nil, description = nil, parent_category_id = nil, is_active = nil, subcategories = nil) ⇒ EntitiesCategoryResponse

Returns a new instance of EntitiesCategoryResponse.



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/gonebusy/models/entities_category_response.rb', line 53

def initialize(id = nil,
               name = nil,
               short_name = nil,
               long_name = nil,
               description = nil,
               parent_category_id = nil,
               is_active = nil,
               subcategories = nil)
  @id = id
  @name = name
  @short_name = short_name
  @long_name = long_name
  @description = description
  @parent_category_id = parent_category_id
  @is_active = is_active
  @subcategories = subcategories
end

Instance Attribute Details

#descriptionString

description of Category

Returns:



23
24
25
# File 'lib/gonebusy/models/entities_category_response.rb', line 23

def description
  @description
end

#idInteger

id of Category

Returns:

  • (Integer)


7
8
9
# File 'lib/gonebusy/models/entities_category_response.rb', line 7

def id
  @id
end

#is_activeBoolean

status of Category

Returns:

  • (Boolean)


31
32
33
# File 'lib/gonebusy/models/entities_category_response.rb', line 31

def is_active
  @is_active
end

#long_nameString

extended name for Category

Returns:



19
20
21
# File 'lib/gonebusy/models/entities_category_response.rb', line 19

def long_name
  @long_name
end

#nameString

name of Category

Returns:



11
12
13
# File 'lib/gonebusy/models/entities_category_response.rb', line 11

def name
  @name
end

#parent_category_idInteger

id of parent Category, if any

Returns:

  • (Integer)


27
28
29
# File 'lib/gonebusy/models/entities_category_response.rb', line 27

def parent_category_id
  @parent_category_id
end

#short_nameString

abbreviated name for Category

Returns:



15
16
17
# File 'lib/gonebusy/models/entities_category_response.rb', line 15

def short_name
  @short_name
end

#subcategoriesList of Integer

array of subcategory ids, if any

Returns:

  • (List of Integer)


35
36
37
# File 'lib/gonebusy/models/entities_category_response.rb', line 35

def subcategories
  @subcategories
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/gonebusy/models/entities_category_response.rb', line 72

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash
  id = hash['id']
  name = hash['name']
  short_name = hash['short_name']
  long_name = hash['long_name']
  description = hash['description']
  parent_category_id = hash['parent_category_id']
  is_active = hash['is_active']
  subcategories = hash['subcategories']

  # Create object from extracted values
  EntitiesCategoryResponse.new(id,
                               name,
                               short_name,
                               long_name,
                               description,
                               parent_category_id,
                               is_active,
                               subcategories)
end

.namesObject

A mapping from model property names to API property names



38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/gonebusy/models/entities_category_response.rb', line 38

def self.names
  if @_hash.nil?
    @_hash = {}
    @_hash["id"] = "id"
    @_hash["name"] = "name"
    @_hash["short_name"] = "short_name"
    @_hash["long_name"] = "long_name"
    @_hash["description"] = "description"
    @_hash["parent_category_id"] = "parent_category_id"
    @_hash["is_active"] = "is_active"
    @_hash["subcategories"] = "subcategories"
  end
  @_hash
end