Sha256: fe3fe1c8af298698bcbd86c2ddc1f1a50479beca7df2651596b08155ec44812d

Contents?: true

Size: 549 Bytes

Versions: 1

Compression:

Stored size: 549 Bytes

Contents

module SearchConsoleApi
  module Resources
    module Sites
      class List
        def initialize(access_token:)
          @access_token = access_token
        end

        def call
          return [] unless response["siteEntry"].is_a?(Array)

          response["siteEntry"].each_with_object([]) do |attrs, sites|
            sites << Objects::Site.new(attrs)
          end
        end

        private

        def response
          @response ||= Request.get(access_token: @access_token, path: "/sites")
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
search_console_api-0.0.5 lib/search_console_api/resources/sites/list.rb