Class: Centaman::Object::AddOn

Inherits:
Centaman::Object show all
Defined in:
lib/centaman/object/add_on.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Centaman::Object

#after_init, #initialize

Constructor Details

This class inherits a constructor from Centaman::Object

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/centaman/object/add_on.rb', line 3

def id
  @id
end

#membership_type_idObject (readonly)

Returns the value of attribute membership_type_id.



3
4
5
# File 'lib/centaman/object/add_on.rb', line 3

def membership_type_id
  @membership_type_id
end

Instance Method Details

#attributesObject

rubocop:disable Metrics/MethodLength



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/centaman/object/add_on.rb', line 30

def attributes
  [
    Centaman::Attribute.new(
      centaman_key: 'MembershipCode',
      app_key: :membership_code,
      type: :integer
    ),
    Centaman::Attribute.new(
      centaman_key: 'MembershipClass',
      app_key: :membership_class,
      type: :string
    ),
    Centaman::Attribute.new(
      centaman_key: 'Cost',
      app_key: :cost,
      type: :float
    ),
    Centaman::Attribute.new(
      centaman_key: 'Cost',
      app_key: :pay_price,
      type: :float
    ),
    Centaman::Attribute.new(
      centaman_key: 'MinimumAgeRequired',
      app_key: :minimum_age,
      type: :integer
    ),
    Centaman::Attribute.new(
      centaman_key: 'MaximumAgeRequirement',
      app_key: :maximum_age,
      type: :integer
    ),
    Centaman::Attribute.new(
      centaman_key: 'MembershipDescription',
      app_key: :membership_description,
      type: :string
    ),
    Centaman::Attribute.new(
      centaman_key: 'IsMembershipAgeBased',
      app_key: :is_age_based,
      type: :boolean
    ),
    Centaman::Attribute.new(
      centaman_key: 'SalePrice',
      app_key: :sale_price,
      type: :float
    ),
    Centaman::Attribute.new(
      centaman_key: 'IsPriceTaxInclusive',
      app_key: :is_tax_inclusive,
      type: :boolean
    ),
    Centaman::Attribute.new(
      centaman_key: 'TaxPercentage',
      app_key: :tax_percentage,
      type: :float
    ),
    Centaman::Attribute.new(
      centaman_key: 'PackageOnly',
      app_key: :package_only,
      type: :boolean
    )
  ]
end

#define_variables(args) ⇒ Object



5
6
7
8
9
# File 'lib/centaman/object/add_on.rb', line 5

def define_variables(args)
  super
  @id = membership_code
  @membership_type_id = args.fetch(:membership_type_id, nil)
end

#jsonObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/centaman/object/add_on.rb', line 11

def json
  {
    id: id,
    membership_type_id: membership_type_id,
    membership_code: membership_code,
    membership_class: membership_class,
    cost: cost,
    pay_price: pay_price,
    minimum_age: minimum_age,
    maximum_age: maximum_age,
    membership_description: membership_description,
    sale_price: sale_price,
    is_tax_inclusive: is_tax_inclusive,
    tax_percentage: tax_percentage,
    package_only: package_only
  }
end