Class: Bitly::API::Bitlink::Deeplink

Inherits:
Object
  • Object
show all
Includes:
Bitly::API::Base
Defined in:
lib/bitly/api/bitlink/deeplink.rb

Instance Attribute Summary

Attributes included from Bitly::API::Base

#response

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Bitly::API::Base

#assign_attributes

Constructor Details

#initialize(data:) ⇒ Deeplink

Returns a new instance of Deeplink.



15
16
17
# File 'lib/bitly/api/bitlink/deeplink.rb', line 15

def initialize(data:)
  assign_attributes(data)
end

Class Method Details

.attributesObject



10
11
12
# File 'lib/bitly/api/bitlink/deeplink.rb', line 10

def self.attributes
  [:app_uri_path, :install_type, :install_url, :app_id]
end

Instance Method Details

#to_json(opts = nil) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/bitly/api/bitlink/deeplink.rb', line 19

def to_json(opts=nil)
  self.class.attributes.reduce({}) do |memo, key|
    value = instance_variable_get("@#{key}")
    memo[key] = value if value
    memo
  end.to_json(opts)
end