Sha256: b82f6276d2b2136a77485938488380203f44c923e0c3cca3106f6aafe7d536dd

Contents?: true

Size: 777 Bytes

Versions: 4

Compression:

Stored size: 777 Bytes

Contents

module Buffer
  class Client
    module Profile
      def profiles
        response = get("/profiles.json")
        response.map { |profile| Buffer::Profile.new(profile) }
      end

      def profile_by_id(id)
        response = get("/profiles/#{id}.json")
        Buffer::Profile.new(response)
      end

      def schedules_by_profile_id(id)
        response = get("/profiles/#{id}/schedules.json")
        response.map { |a_response| Buffer::Schedule.new(a_response) }
      end

      def set_schedules(id, options)
        schedules = Buffer::Encode.encode(
                        options.fetch(:schedules) { raise ArgumentError })
        post("/profiles/#{id}/schedules/update.json",
                        body: { schedules: schedules })
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
buffer-0.1.3 lib/buffer/profile.rb
buffer-0.1.2 lib/buffer/profile.rb
buffer-0.1.1 lib/buffer/profile.rb
buffer-0.1.0 lib/buffer/profile.rb