Sha256: 054d7bf439ae3464130291a0912eced3d8f5857bd1d5d02e33035f33cb34e24e

Contents?: true

Size: 987 Bytes

Versions: 19

Compression:

Stored size: 987 Bytes

Contents

module FbGraph2
  class AppLinkHost < Node
    register_attributes(
      raw: [:name, :canonical_url],
      custom: [:ios, :iphone, :ipad, :android, :windows_phone, :web]
    )

    def initialize(id, attributes = {})
      super
      [:ios, :iphone, :ipad, :android, :windows_phone].each do |link_attr|
        if attributes.include? link_attr
          self.send :"#{link_attr}=", collect_links(attributes, link_attr)
        end
      end
      if attributes.include? :web
        self.web = Struct::AppLink::Web.new attributes[:web]
      end
    end

    private

    def collect_links(attributes, link_attr)
      Collection.new(attributes[link_attr]).collect! do |link|
        klass = case link_attr
        when :ios, :iphone, :ipad
          Struct::AppLink::Native::IOS
        when :android
          Struct::AppLink::Native::Android
        when :windows_phone
          Struct::AppLink::Native::WindowsPhone
        end
        klass.new link
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
fb_graph2-1.3.0 lib/fb_graph2/app_link_host.rb
fb_graph2-1.2.0 lib/fb_graph2/app_link_host.rb
fb_graph2-1.1.1 lib/fb_graph2/app_link_host.rb
fb_graph2-1.1.0 lib/fb_graph2/app_link_host.rb
fb_graph2-1.0.1 lib/fb_graph2/app_link_host.rb
fb_graph2-1.0.0 lib/fb_graph2/app_link_host.rb
fb_graph2-0.9.1 lib/fb_graph2/app_link_host.rb
fb_graph2-0.9.0 lib/fb_graph2/app_link_host.rb
fb_graph2-0.8.0 lib/fb_graph2/app_link_host.rb
fb_graph2-0.7.9 lib/fb_graph2/app_link_host.rb
fb_graph2-0.7.8 lib/fb_graph2/app_link_host.rb
fb_graph2-0.7.7 lib/fb_graph2/app_link_host.rb
fb_graph2-0.7.6 lib/fb_graph2/app_link_host.rb
fb_graph2-0.7.5 lib/fb_graph2/app_link_host.rb
fb_graph2-0.7.4 lib/fb_graph2/app_link_host.rb
fb_graph2-0.7.3 lib/fb_graph2/app_link_host.rb
fb_graph2-0.7.2 lib/fb_graph2/app_link_host.rb
fb_graph2-0.7.1 lib/fb_graph2/app_link_host.rb
fb_graph2-0.7.0 lib/fb_graph2/app_link_host.rb