Sha256: 3791f6ca6ecc902d6644017a1edf6c3b4d8b957dbe775ed822690dd69744eb7b

Contents?: true

Size: 950 Bytes

Versions: 1

Compression:

Stored size: 950 Bytes

Contents

module Awis
  module Models
    class SitesLinkingIn < Base
      attr_accessor :sites

      def initialize(response)
        @sites = []
        setup_data!( loading_response(response) )
      end

      def setup_data!(response)
        sites = []

        response.each_node do |node, path|
          text = node.inner_xml

          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
      attr_accessor :title, :url
      
      def initialize(options)
        options.each do |key, value|
          instance_variable_set("@#{key}", value)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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