Class: BranchIO::LinkProperties
- Inherits:
-
Object
- Object
- BranchIO::LinkProperties
- Defined in:
- lib/branch_io/link_properties.rb
Defined Under Namespace
Classes: ErrorInvalidParameters
Instance Attribute Summary collapse
-
#alias ⇒ Object
readonly
Returns the value of attribute alias.
-
#campaign ⇒ Object
readonly
Returns the value of attribute campaign.
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#feature ⇒ Object
readonly
Returns the value of attribute feature.
-
#stage ⇒ Object
readonly
Returns the value of attribute stage.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(options = {}) ⇒ LinkProperties
constructor
A new instance of LinkProperties.
Constructor Details
#initialize(options = {}) ⇒ LinkProperties
Returns a new instance of LinkProperties.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/branch_io/link_properties.rb', line 21 def initialize(={}) @tags = .delete(:tags) ||.delete("tags") @channel = .delete(:channel) || .delete("channel") @feature = .delete(:feature) || .delete("feature") @campaign = .delete(:campaign) || .delete("campaign") @stage = .delete(:stage) || .delete("stage") @alias = .delete(:alias) || .delete("alias") @type = .delete(:type) || .delete("type") @data = .delete(:data) || .delete("data") unless .empty? raise ErrorInvalidParameters.new(.keys) end end |
Instance Attribute Details
#alias ⇒ Object (readonly)
Returns the value of attribute alias.
9 10 11 |
# File 'lib/branch_io/link_properties.rb', line 9 def alias @alias end |
#campaign ⇒ Object (readonly)
Returns the value of attribute campaign.
7 8 9 |
# File 'lib/branch_io/link_properties.rb', line 7 def campaign @campaign end |
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
5 6 7 |
# File 'lib/branch_io/link_properties.rb', line 5 def channel @channel end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
11 12 13 |
# File 'lib/branch_io/link_properties.rb', line 11 def data @data end |
#feature ⇒ Object (readonly)
Returns the value of attribute feature.
6 7 8 |
# File 'lib/branch_io/link_properties.rb', line 6 def feature @feature end |
#stage ⇒ Object (readonly)
Returns the value of attribute stage.
8 9 10 |
# File 'lib/branch_io/link_properties.rb', line 8 def stage @stage end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
4 5 6 |
# File 'lib/branch_io/link_properties.rb', line 4 def @tags end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
10 11 12 |
# File 'lib/branch_io/link_properties.rb', line 10 def type @type end |
Class Method Details
.wrap(options) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/branch_io/link_properties.rb', line 13 def self.wrap() if .kind_of?(LinkProperties) else new() end end |
Instance Method Details
#as_json ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/branch_io/link_properties.rb', line 36 def as_json json = {} json[:tags] = if json[:channel] = channel if channel json[:feature] = feature if feature json[:campaign] = campaign if campaign json[:stage] = stage if stage json[:alias] = self.alias if self.alias json[:type] = type if type json[:data] = data if data json end |