Class: Zanox::TrackingCategory
- Defined in:
- lib/zanox/resources/tracking_category.rb
Instance Attribute Summary collapse
-
#adspace ⇒ Object
readonly
Returns the value of attribute adspace.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#pid ⇒ Object
readonly
Returns the value of attribute pid.
-
#program ⇒ Object
readonly
Returns the value of attribute program.
-
#sale_fixed ⇒ Object
readonly
Returns the value of attribute sale_fixed.
-
#sale_percent ⇒ Object
readonly
Returns the value of attribute sale_percent.
-
#transaction_type ⇒ Object
readonly
Returns the value of attribute transaction_type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data) ⇒ TrackingCategory
constructor
-
pid (Integer) AdSpace ID - name (String) The name of the tracking category - program (Hash) The program in input - adspace (Hash) The adspace in input - transaction_type (String) The type of the transaction (leads, sales) - sale_fixed (Float) The fixed value of the sale - sale_percent (Float) The percent value of the sale.
-
Methods included from Hashable
Constructor Details
#initialize(data) ⇒ TrackingCategory
-
pid (Integer) AdSpace ID
-
name (String) The name of the tracking category
-
program (Hash) The program in input
-
adspace (Hash) The adspace in input
-
transaction_type (String) The type of the transaction (leads, sales)
-
sale_fixed (Float) The fixed value of the sale
-
sale_percent (Float) The percent value of the sale
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/zanox/resources/tracking_category.rb', line 38 def initialize(data) @pid = data['@id'].to_i @name = data['name'] @program = { id: data['program']['@id'].to_i, name: data['program']['$'] } @adspace = { id: data['adspace']['@id'].to_i, name: data['adspace']['$'] } @transaction_type = data['transactionType'] @sale_fixed = data['saleFixed'] @sale_percent = data['salePercent'] end |
Instance Attribute Details
#adspace ⇒ Object (readonly)
Returns the value of attribute adspace.
27 28 29 |
# File 'lib/zanox/resources/tracking_category.rb', line 27 def adspace @adspace end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
27 28 29 |
# File 'lib/zanox/resources/tracking_category.rb', line 27 def name @name end |
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
27 28 29 |
# File 'lib/zanox/resources/tracking_category.rb', line 27 def pid @pid end |
#program ⇒ Object (readonly)
Returns the value of attribute program.
27 28 29 |
# File 'lib/zanox/resources/tracking_category.rb', line 27 def program @program end |
#sale_fixed ⇒ Object (readonly)
Returns the value of attribute sale_fixed.
27 28 29 |
# File 'lib/zanox/resources/tracking_category.rb', line 27 def sale_fixed @sale_fixed end |
#sale_percent ⇒ Object (readonly)
Returns the value of attribute sale_percent.
27 28 29 |
# File 'lib/zanox/resources/tracking_category.rb', line 27 def sale_percent @sale_percent end |
#transaction_type ⇒ Object (readonly)
Returns the value of attribute transaction_type.
27 28 29 |
# File 'lib/zanox/resources/tracking_category.rb', line 27 def transaction_type @transaction_type end |
Class Method Details
.find(program_id, adspace_id) ⇒ Object
55 56 57 58 |
# File 'lib/zanox/resources/tracking_category.rb', line 55 def find(program_id, adspace_id) response = API.request("programapplications/program/#{program_id}/adspace/#{adspace_id}/trackingcategories") [response.tracking_category_item].flatten.map { |tracking_category| new(tracking_category) } end |