Sha256: 554e574bf55ff2455c65a2f6905aef7e3d874b8c3172ee4c5a4c3a5515f3c54b

Contents?: true

Size: 882 Bytes

Versions: 18

Compression:

Stored size: 882 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
    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

18 entries across 18 versions & 1 rubygems

Version Path
fb_graph2-0.6.2 lib/fb_graph2/app_link_host.rb
fb_graph2-0.6.1 lib/fb_graph2/app_link_host.rb
fb_graph2-0.6.0 lib/fb_graph2/app_link_host.rb
fb_graph2-0.5.3 lib/fb_graph2/app_link_host.rb
fb_graph2-0.5.2 lib/fb_graph2/app_link_host.rb
fb_graph2-0.5.1 lib/fb_graph2/app_link_host.rb
fb_graph2-0.5.0 lib/fb_graph2/app_link_host.rb
fb_graph2-0.4.4 lib/fb_graph2/app_link_host.rb
fb_graph2-0.4.3 lib/fb_graph2/app_link_host.rb
fb_graph2-0.4.1 lib/fb_graph2/app_link_host.rb
fb_graph2-0.4.0 lib/fb_graph2/app_link_host.rb
fb_graph2-0.3.2 lib/fb_graph2/app_link_host.rb
fb_graph2-0.3.1 lib/fb_graph2/app_link_host.rb
fb_graph2-0.3.0 lib/fb_graph2/app_link_host.rb
fb_graph2-0.2.0 lib/fb_graph2/app_link_host.rb
fb_graph2-0.1.3 lib/fb_graph2/app_link_host.rb
fb_graph2-0.1.2 lib/fb_graph2/app_link_host.rb
fb_graph2-0.1.1 lib/fb_graph2/app_link_host.rb