Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
module ActionSprout
  module Facebook
    class Page

      PAGE_FIELDS = 'name,category,description,about,fan_count'.freeze

      def initialize(id, api: nil, fields: PAGE_FIELDS)
        @id = id
        raise ArgumentError.new('"id" must be a non-empty string'.freeze) unless id.present?

        @api = api || API.new
        @fields = fields
      end

      def data
        page_data_response.parsed_response
      end

      private

      attr_reader :id, :api, :fields

      def page_data_response
        @_page_data_response ||= api.get(id, query: page_data_query)
      end

      def page_data_query
        { fields: fields }
      end

    end
  end
end