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
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/branch_io/link_properties.rb', line 20 def initialize( = {}) = .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, .keys end end |
Instance Attribute Details
#alias ⇒ Object (readonly)
Returns the value of attribute alias.
8 9 10 |
# File 'lib/branch_io/link_properties.rb', line 8 def alias @alias end |
#campaign ⇒ Object (readonly)
Returns the value of attribute campaign.
6 7 8 |
# File 'lib/branch_io/link_properties.rb', line 6 def campaign @campaign end |
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
4 5 6 |
# File 'lib/branch_io/link_properties.rb', line 4 def channel @channel end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
10 11 12 |
# File 'lib/branch_io/link_properties.rb', line 10 def data @data end |
#feature ⇒ Object (readonly)
Returns the value of attribute feature.
5 6 7 |
# File 'lib/branch_io/link_properties.rb', line 5 def feature @feature end |
#stage ⇒ Object (readonly)
Returns the value of attribute stage.
7 8 9 |
# File 'lib/branch_io/link_properties.rb', line 7 def stage @stage end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
3 4 5 |
# File 'lib/branch_io/link_properties.rb', line 3 def end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9 10 11 |
# File 'lib/branch_io/link_properties.rb', line 9 def type @type end |
Class Method Details
.wrap(options) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/branch_io/link_properties.rb', line 12 def self.wrap() if .kind_of?(LinkProperties) else new() end end |
Instance Method Details
#as_json ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/branch_io/link_properties.rb', line 35 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 |