Sha256: 6f8d19bad8dc66568591e3281b3b71c3940a2ea294caac8e8a57bc3b54943913

Contents?: true

Size: 884 Bytes

Versions: 1

Compression:

Stored size: 884 Bytes

Contents

# frozen_string_literal: true

module Awis
  module Models
    class SitesLinkingIn < Base
      attr_accessor :sites

      def initialize(response)
        @sites = []

        super(response)
      end

      def setup_data!(response)
        sites = []

        response.each_node do |node, _path|
          text = node.inner_xml
          text = nil if text.class == String && text.empty?

          if node.name == 'aws:RequestId'
            @request_id ||= text
          elsif node.name == 'aws:StatusCode'
            @status_code ||= text
          elsif node.name == 'aws:Title'
            sites << { title: text }
          elsif node.name == 'aws:Url'
            sites << { url: text }
          end
        end

        relationship_collections(@sites, sites, 2, Site)
      end
    end

    class Site < BaseEntity
      attr_accessor :title, :url
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
awis-sdk-ruby-2.1.0 lib/awis/models/sites_linking_in.rb