Class: AdvancedBilling::SaleRepSubscription

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/advanced_billing/models/sale_rep_subscription.rb

Overview

SaleRepSubscription Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(id: SKIP, site_name: SKIP, subscription_url: SKIP, customer_name: SKIP, created_at: SKIP, mrr: SKIP, usage: SKIP, recurring: SKIP, last_payment: SKIP, churn_date: SKIP, additional_properties: {}) ⇒ SaleRepSubscription

Returns a new instance of SaleRepSubscription.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/advanced_billing/models/sale_rep_subscription.rb', line 91

def initialize(id: SKIP, site_name: SKIP, subscription_url: SKIP,
               customer_name: SKIP, created_at: SKIP, mrr: SKIP,
               usage: SKIP, recurring: SKIP, last_payment: SKIP,
               churn_date: SKIP, additional_properties: {})
  # Add additional model properties to the instance.
  additional_properties.each do |_name, _value|
    instance_variable_set("@#{_name}", _value)
  end

  @id = id unless id == SKIP
  @site_name = site_name unless site_name == SKIP
  @subscription_url = subscription_url unless subscription_url == SKIP
  @customer_name = customer_name unless customer_name == SKIP
  @created_at = created_at unless created_at == SKIP
  @mrr = mrr unless mrr == SKIP
  @usage = usage unless usage == SKIP
  @recurring = recurring unless recurring == SKIP
  @last_payment = last_payment unless last_payment == SKIP
  @churn_date = churn_date unless churn_date == SKIP
end

Instance Attribute Details

#churn_dateString

TODO: Write general description for this method

Returns:

  • (String)


50
51
52
# File 'lib/advanced_billing/models/sale_rep_subscription.rb', line 50

def churn_date
  @churn_date
end

#created_atString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/advanced_billing/models/sale_rep_subscription.rb', line 30

def created_at
  @created_at
end

#customer_nameString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/advanced_billing/models/sale_rep_subscription.rb', line 26

def customer_name
  @customer_name
end

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


14
15
16
# File 'lib/advanced_billing/models/sale_rep_subscription.rb', line 14

def id
  @id
end

#last_paymentString

TODO: Write general description for this method

Returns:

  • (String)


46
47
48
# File 'lib/advanced_billing/models/sale_rep_subscription.rb', line 46

def last_payment
  @last_payment
end

#mrrString

TODO: Write general description for this method

Returns:

  • (String)


34
35
36
# File 'lib/advanced_billing/models/sale_rep_subscription.rb', line 34

def mrr
  @mrr
end

#recurringString

TODO: Write general description for this method

Returns:

  • (String)


42
43
44
# File 'lib/advanced_billing/models/sale_rep_subscription.rb', line 42

def recurring
  @recurring
end

#site_nameString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/advanced_billing/models/sale_rep_subscription.rb', line 18

def site_name
  @site_name
end

#subscription_urlString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/advanced_billing/models/sale_rep_subscription.rb', line 22

def subscription_url
  @subscription_url
end

#usageString

TODO: Write general description for this method

Returns:

  • (String)


38
39
40
# File 'lib/advanced_billing/models/sale_rep_subscription.rb', line 38

def usage
  @usage
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/advanced_billing/models/sale_rep_subscription.rb', line 113

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  site_name = hash.key?('site_name') ? hash['site_name'] : SKIP
  subscription_url =
    hash.key?('subscription_url') ? hash['subscription_url'] : SKIP
  customer_name = hash.key?('customer_name') ? hash['customer_name'] : SKIP
  created_at = hash.key?('created_at') ? hash['created_at'] : SKIP
  mrr = hash.key?('mrr') ? hash['mrr'] : SKIP
  usage = hash.key?('usage') ? hash['usage'] : SKIP
  recurring = hash.key?('recurring') ? hash['recurring'] : SKIP
  last_payment = hash.key?('last_payment') ? hash['last_payment'] : SKIP
  churn_date = hash.key?('churn_date') ? hash['churn_date'] : SKIP

  # Clean out expected properties from Hash.
  additional_properties = hash.reject { |k, _| names.value?(k) }

  # Create object from extracted values.
  SaleRepSubscription.new(id: id,
                          site_name: site_name,
                          subscription_url: subscription_url,
                          customer_name: customer_name,
                          created_at: created_at,
                          mrr: mrr,
                          usage: usage,
                          recurring: recurring,
                          last_payment: last_payment,
                          churn_date: churn_date,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/advanced_billing/models/sale_rep_subscription.rb', line 53

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['site_name'] = 'site_name'
  @_hash['subscription_url'] = 'subscription_url'
  @_hash['customer_name'] = 'customer_name'
  @_hash['created_at'] = 'created_at'
  @_hash['mrr'] = 'mrr'
  @_hash['usage'] = 'usage'
  @_hash['recurring'] = 'recurring'
  @_hash['last_payment'] = 'last_payment'
  @_hash['churn_date'] = 'churn_date'
  @_hash
end

.nullablesObject

An array for nullable fields



85
86
87
88
89
# File 'lib/advanced_billing/models/sale_rep_subscription.rb', line 85

def self.nullables
  %w[
    churn_date
  ]
end

.optionalsObject

An array for optional fields



69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/advanced_billing/models/sale_rep_subscription.rb', line 69

def self.optionals
  %w[
    id
    site_name
    subscription_url
    customer_name
    created_at
    mrr
    usage
    recurring
    last_payment
    churn_date
  ]
end